From 8eca8dc059f6afff47fdbd9b08106f6a37cee220 Mon Sep 17 00:00:00 2001
From: Repo Updater <noreply@mpcdf.mpg.de>
Date: Wed, 29 Sep 2021 21:38:58 +0200
Subject: [PATCH] 246089b9 add pybind11 stub

---
 examples/pybind11/setup.py                   |  0
 examples/pybind11/src/cube.cpp               |  0
 notebooks/1b--Introduction.ipynb             | 11 +++++---
 notebooks/2d--Diffusion.ipynb                | 17 ++++++++++++
 notebooks/2e--Interfacing_with_C_and_F.ipynb | 28 +++++++++++---------
 notebooks/fortran/Makefile                   |  7 +++--
 6 files changed, 44 insertions(+), 19 deletions(-)
 create mode 100644 examples/pybind11/setup.py
 create mode 100644 examples/pybind11/src/cube.cpp

diff --git a/examples/pybind11/setup.py b/examples/pybind11/setup.py
new file mode 100644
index 0000000..e69de29
diff --git a/examples/pybind11/src/cube.cpp b/examples/pybind11/src/cube.cpp
new file mode 100644
index 0000000..e69de29
diff --git a/notebooks/1b--Introduction.ipynb b/notebooks/1b--Introduction.ipynb
index d3087d1..7a3c4fd 100644
--- a/notebooks/1b--Introduction.ipynb
+++ b/notebooks/1b--Introduction.ipynb
@@ -167,10 +167,13 @@
    "source": [
     "### Option 1: Cloud-based MPCDF Jupyter notebook service (beta)\n",
     "\n",
-    "* Use the link communicated by email to access a cloud-based Jupyter service\n",
-    "* Course material *and* software are already there, you can start right away!\n",
-    "* Please note that a session is terminated after 12h\n",
-    "* Please note that the storage is temporary, i.e. download your modified notebooks in time via the JupyterLab GUI if necessary"
+    "* Use the link communicated by email to access a Jupyter service on the MPCDF HPC cloud\n",
+    "* The course material *and* software are provided via an interactive JupyterLab interface\n",
+    "* Each instance provides up to 6 virtual CPU cores and up to 12 GB RAM (0.3 cores and 1.75 GB guaranteed)\n",
+    "* Please keep the following points in mind\n",
+    "    * Use the JupyterLab menu **File $\\to$ Shut down** to free resources when finished\n",
+    "    * A session is terminated after 12h\n",
+    "    * The storage is only temporary, i.e. download your modified notebooks and data in time via the GUI"
    ]
   },
   {
diff --git a/notebooks/2d--Diffusion.ipynb b/notebooks/2d--Diffusion.ipynb
index ab8a565..c152ebe 100644
--- a/notebooks/2d--Diffusion.ipynb
+++ b/notebooks/2d--Diffusion.ipynb
@@ -5500,6 +5500,23 @@
     "* Advantage: Python code compatibility is preserved\n",
     "* Disadvantage: Debugging rather complex in case @jit does not work as expected"
    ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {
+    "slideshow": {
+     "slide_type": "subslide"
+    }
+   },
+   "source": [
+    "## pystencils -- a high performance package for stencil computations\n",
+    "\n",
+    "* sympy-based code generator for stencil computations on NumPy arrays\n",
+    "* due to knowledge about the structure of the stencil, the code can be highly optimized and may outperform cython or Numba\n",
+    "* install via conda or pip, find more information at  \n",
+    "  https://i10git.cs.fau.de/pycodegen/pystencils\n",
+    "* optional exercise: implement the computation using pystencils"
+   ]
   }
  ],
  "metadata": {
diff --git a/notebooks/2e--Interfacing_with_C_and_F.ipynb b/notebooks/2e--Interfacing_with_C_and_F.ipynb
index 64dd807..09b51f5 100644
--- a/notebooks/2e--Interfacing_with_C_and_F.ipynb
+++ b/notebooks/2e--Interfacing_with_C_and_F.ipynb
@@ -12,7 +12,7 @@
     "\n",
     "**Python for HPC course**\n",
     "\n",
-    "Sebastian Ohlmann, Klaus Reuter\n",
+    "2018-2021 Sebastian Ohlmann, Klaus Reuter\n",
     "\n",
     "Max Planck Computing and Data Facility, Garching"
    ]
@@ -35,7 +35,7 @@
     "\n",
     "## Steps\n",
     "\n",
-    "* create software interface between Python and C/C++/Fortran\n",
+    "* create software interface between Python/NumPy and C/C++/Fortran\n",
     "* compile and link to a Python module"
    ]
   },
@@ -49,14 +49,11 @@
    "source": [
     "## Interfacing Options\n",
     "\n",
-    "* Fortran: `f2py`\n",
-    "* C/C++/CUDA: Cython\n",
-    "    * Transparent NumPy support\n",
-    "    * Options\n",
-    "        1. compile all code into a single Python module (shared object, `.so`)\n",
-    "        2. Python (`.so`) extension contains only the interface code and links to a second shared object containing the code to be called\n",
+    "* Fortran $\\longrightarrow$ **f2py**\n",
+    "* C/C++/CUDA $\\longrightarrow$ **Cython**\n",
+    "* C++ $\\longrightarrow$ **pybind11**\n",
     "\n",
-    "Other possibilities are (not covered here):\n",
+    "Some other options (not covered here):\n",
     "\n",
     "* Swig, an interface generator\n",
     "* Boost.Python for C++ codes\n",
@@ -433,10 +430,15 @@
     }
    },
    "source": [
-    "### Thank you very much\n",
-    "\n",
-    "### Questions?"
+    "## pybind11"
    ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": []
   }
  ],
  "metadata": {
@@ -456,7 +458,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.8.3"
+   "version": "3.8.8"
   }
  },
  "nbformat": 4,
diff --git a/notebooks/fortran/Makefile b/notebooks/fortran/Makefile
index e0b338a..b996abf 100644
--- a/notebooks/fortran/Makefile
+++ b/notebooks/fortran/Makefile
@@ -1,10 +1,13 @@
+FC ?= gfortran
+MPIFC ?= mpif90
+
 all: diff.exe
 
 diff.exe: diff.F90
-	gfortran -O3 -march=native -fopt-info-vec -fopenmp -fno-strict-aliasing -o $@ $<
+	$(FC) -O3 -march=native -fopt-info-vec -fopenmp -o $@ $<
 
 diff_mpi.exe: diff_mpi.F90
-	mpif90 -O3 -march=native -fopt-info-vec -fopenmp -fno-strict-aliasing -o $@ $<
+	$(MPIFC) -O3 -march=native -fopt-info-vec -fopenmp -o $@ $<
 
 .PHONY: clean
 clean:
-- 
GitLab