From 43cd6f92ed458a1d4a7670e10dcd763291333918 Mon Sep 17 00:00:00 2001 From: Repo Updater <noreply@mpcdf.mpg.de> Date: Tue, 19 Nov 2024 10:07:46 +0100 Subject: [PATCH] b7df38db re-enable jupyterlab for Binder and beyond --- README.md | 4 ---- environment.yml | 7 ++++--- examples/slurm/submit_mpi4py.sh | 12 ++++++------ examples/slurm/submit_multiprocessing.sh | 10 +++++----- examples/slurm/submit_multithreading.sh | 10 +++++----- examples/slurm/submit_sequential.sh | 6 +++--- notebooks/01--Introduction.ipynb | 17 ++++++++++++----- notebooks/03--Python_Refresher.ipynb | 10 ++++++---- notebooks/05--NumPy_SciPy.ipynb | 5 +++-- 9 files changed, 44 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index ab8e92c..2d20884 100644 --- a/README.md +++ b/README.md @@ -78,9 +78,5 @@ commercial Python distributions -- and use `conda` or `mamba` together with the ### Jupyter presentation via RISE * Presentation of the Jupyter notebook cells as slides is possible via the [RISE](http://rise.readthedocs.io/en/latest/index.html) extension. - * Installation - * `pip install RISE` - * `jupyter-nbextension install rise --py --sys-prefix` - * `jupyter-nbextension enable rise --py --sys-prefix` * To enter presentation mode, simply press <Alt+r> from within a notebook. diff --git a/environment.yml b/environment.yml index 4f31eed..0ce4a14 100644 --- a/environment.yml +++ b/environment.yml @@ -4,7 +4,7 @@ channels: - conda-forge - nodefaults dependencies: - - python=3.12 + - python=3.11 - pip - libopenblas=*=*openmp* - numpy @@ -26,5 +26,6 @@ dependencies: - mpi4py - hdf5=*=mpi* - h5py=*=mpi* - # - jupyterlab - # - notebook + - jupyterlab + - notebook<7 + - rise diff --git a/examples/slurm/submit_mpi4py.sh b/examples/slurm/submit_mpi4py.sh index d789d21..2d52609 100644 --- a/examples/slurm/submit_mpi4py.sh +++ b/examples/slurm/submit_mpi4py.sh @@ -1,6 +1,6 @@ #!/bin/bash -l # -# Example job script for using MPI4PY on Cobra@MPCDF. +# Example job script for using MPI4PY on Raven@MPCDF. # #SBATCH -o ./job.out.%j #SBATCH -e ./job.err.%j @@ -8,17 +8,17 @@ #SBATCH -J PYTHON_MPI #SBATCH --mail-type=none #SBATCH --nodes=1 -#SBATCH --ntasks-per-node=40 +#SBATCH --ntasks-per-node=72 #SBATCH --cpus-per-task=1 #SBATCH --time=00:10:00 # run time in h:m:s, up to 24h possible module purge -module load gcc/10 impi/2019.9 -module load anaconda/3/2021.05 -module load mpi4py/3.0.3 +module load gcc/13 openmpi/4.1 +module load anaconda/3/2023.03 +module load mpi4py/3.1.5 # avoid overbooking of the cores which would occur via NumPy/MKL threading # as the parallelization takes place via MPI tasks export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK:-1} -srun python ./python_mpi4py.py +srun python3 ./python_mpi4py.py diff --git a/examples/slurm/submit_multiprocessing.sh b/examples/slurm/submit_multiprocessing.sh index c1f112c..c773a4f 100644 --- a/examples/slurm/submit_multiprocessing.sh +++ b/examples/slurm/submit_multiprocessing.sh @@ -1,6 +1,6 @@ #!/bin/bash -l # -# Example job script for using Python-Multiprocessing on Cobra@MPCDF. +# Example job script for using Python-Multiprocessing on Raven@MPCDF. # #SBATCH -o ./job.out.%j #SBATCH -e ./job.err.%j @@ -9,12 +9,12 @@ #SBATCH --mail-type=none #SBATCH --nodes=1 #SBATCH --ntasks-per-node=1 # only start 1 task via srun because Python multiprocessing starts more tasks internally -#SBATCH --cpus-per-task=40 # assign all the cores to that first task to make room for Python's multiprocessing tasks +#SBATCH --cpus-per-task=72 # assign all the cores to that first task to make room for Python's multiprocessing tasks #SBATCH --time=00:10:00 module purge -module load gcc/10 impi/2019.9 -module load anaconda/3/2021.05 +module load gcc/13 openmpi/4.1 +module load anaconda/3/2023.03 # avoid overbooking of the cores which might occur via NumPy/MKL threading, # as the parallelization takes place via processes/multiprocessing @@ -22,4 +22,4 @@ export OMP_NUM_THREADS=1 # pass the number of available cores via the command line, and # use that number to spawn as many workers from multiprocessing -srun python ./python_multiprocessing.py $SLURM_CPUS_PER_TASK +srun python3 ./python_multiprocessing.py $SLURM_CPUS_PER_TASK diff --git a/examples/slurm/submit_multithreading.sh b/examples/slurm/submit_multithreading.sh index dec6259..b632564 100644 --- a/examples/slurm/submit_multithreading.sh +++ b/examples/slurm/submit_multithreading.sh @@ -1,6 +1,6 @@ #!/bin/bash -l # -# Example job script for using Python with Multithreading (OpenMP, Numba, numexpr) on Cobra@MPCDF. +# Example job script for using Python with Multithreading (OpenMP, Numba, numexpr) on Raven@MPCDF. # #SBATCH -o ./job.out.%j #SBATCH -e ./job.err.%j @@ -9,12 +9,12 @@ #SBATCH --mail-type=none #SBATCH --nodes=1 #SBATCH --ntasks-per-node=1 # only start 1 task via srun because Python multiprocessing starts more tasks internally -#SBATCH --cpus-per-task=40 # assign all the cores to that first task to make room for Python's multiprocessing tasks +#SBATCH --cpus-per-task=72 # assign all the cores to that first task to make room for Python's multiprocessing tasks #SBATCH --time=00:10:00 module purge -module load gcc/10 impi/2019.9 -module load anaconda/3/2021.05 +module load gcc/13 openmpi/4.1 +module load anaconda/3/2023.03 # set the correct number of threads for various thread-parallel modules export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK @@ -23,4 +23,4 @@ export NUMEXPR_NUM_THREADS=$SLURM_CPUS_PER_TASK # pin OpenMP threads to cores export OMP_PLACES=cores -srun python ./python_multithreading.py +srun python3 ./python_multithreading.py diff --git a/examples/slurm/submit_sequential.sh b/examples/slurm/submit_sequential.sh index 1c6dd5f..1ccc329 100644 --- a/examples/slurm/submit_sequential.sh +++ b/examples/slurm/submit_sequential.sh @@ -12,10 +12,10 @@ #SBATCH --time=0:10:00 # run time, up to 24h module purge -module load gcc/10 impi/2019.9 -module load anaconda/3/2021.05 +module load gcc/13 openmpi/4.1 +module load anaconda/3/2023.03 # avoid overbooking of the cores which might occur via NumPy/MKL threading export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK:-1} -srun python ./python_hello_world.py +srun python3 ./python_hello_world.py diff --git a/notebooks/01--Introduction.ipynb b/notebooks/01--Introduction.ipynb index 7c5d519..5f8cee4 100644 --- a/notebooks/01--Introduction.ipynb +++ b/notebooks/01--Introduction.ipynb @@ -14,7 +14,7 @@ "\n", "Sebastian Kehl, Sebastian Ohlmann, Klaus Reuter\n", "\n", - "_25-27 July 2023_\n", + "_26-28 November 2024_\n", "\n", "HPC Application Support Group\n", "\n", @@ -192,7 +192,7 @@ }, "source": [ "### Software Option 2: Python infrastructure on the MPCDF HPC systems\n", - "* Python is provided via the Anaconda Python Distribution\n", + "* Python is provided via conda-based Python distributions (now based on 'conda-forge', historically Anaconda)\n", "* software is accessible via environment modules, e.g. \n", " `module purge` \n", " `module load gcc/12 impi/2021.9` \n", @@ -210,8 +210,15 @@ "source": [ "### Software Option 3: Python environment for your local computer\n", "* On a recent Linux system, install all the necessary packages via the package manager\n", - "* Alternatively, install the Anaconda Python Distribution (https://www.anaconda.com) and use the `conda` package manager and the file `environment.yml` to add all necessary packages" + "* Alternatively, install [Miniforge](https://conda-forge.org/miniforge/) and use the `conda` package manager and the file `environment.yml` that is provided together with the course material to add all necessary packages" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { @@ -231,9 +238,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.12" + "version": "3.12.7" } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/notebooks/03--Python_Refresher.ipynb b/notebooks/03--Python_Refresher.ipynb index 21f5600..7a35497 100644 --- a/notebooks/03--Python_Refresher.ipynb +++ b/notebooks/03--Python_Refresher.ipynb @@ -20,6 +20,9 @@ "cell_type": "markdown", "metadata": { "collapsed": true, + "jupyter": { + "outputs_hidden": true + }, "slideshow": { "slide_type": "subslide" } @@ -28,7 +31,7 @@ "### Python: History and Status\n", "* First version released in 1991 by G. van Rossum\n", "* [Implementations](https://wiki.python.org/moin/PythonImplementations): **cPython**, PyPy, Pyston, ...\n", - "* Language versions: 2.7 (legacy, ✞2020), now 3.8 - 3.11 \n", + "* Language versions: 2.7 (legacy, ✞2020), now 3 (relevant versions are 3.8 - 3.13) \n", " (to migrate legacy code, the packages `2to3`, `six`, `future` are helpful)" ] }, @@ -869,7 +872,6 @@ "cell_type": "code", "execution_count": 16, "metadata": { - "scrolled": false, "slideshow": { "slide_type": "skip" } @@ -1436,9 +1438,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.12" + "version": "3.12.7" } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/notebooks/05--NumPy_SciPy.ipynb b/notebooks/05--NumPy_SciPy.ipynb index e2e6d9a..5b51411 100644 --- a/notebooks/05--NumPy_SciPy.ipynb +++ b/notebooks/05--NumPy_SciPy.ipynb @@ -814,7 +814,8 @@ }, "source": [ "* performance is problem- and size-dependent\n", - "* $\\to$ may be faster, but not necessarily!" + "* $\\to$ may be faster, but not necessarily!\n", + "* keep mutability in mind!" ] }, { @@ -1788,7 +1789,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.12" + "version": "3.11.10" }, "rise": { "enable_chalkboard": true, -- GitLab