diff --git a/README.md b/README.md index ab8e92c443e6b9fabcb4a5f6679703956b9101be..2d20884123bf83a51d9848c71963bd90e33aaecc 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 4f31eed2d1b7518eb9d92ee473d7372582571ec7..0ce4a14d54cc75d61da4521db109ff9504456ca9 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 d789d21cb94a963868969cd61aa9ac8992d19d20..2d526095af5d50f0f034f58af5129c09c34bf88e 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 c1f112c865c70ef0d1feac982f44fd61dc74d0d8..c773a4f887c2f31a33fb0d3e8543071165780ac3 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 dec6259819bc738de180903905e0b1e48a4fd5ad..b632564e61a5500f053a367bbe755f7b728774f9 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 1c6dd5f7ef72df71c3b4679b73dca95c74bdbdef..1ccc32945786c41b113303bb29aac09de5a2a187 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 7c5d5190375947f7797efb001c97a96ace960fcb..5f8cee4c4e60ab29485c4fd35bd2d71b5004337d 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 21f56006d2cdd53bbb2d8070312c1319177bff16..7a354976aba33004ffa844514300dde0fe8f6dd1 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 e2e6d9acb74dd156b91b6fa1d01a3fc7c80e76f6..5b514112b91bcd479f72d6d3a71c2f7cda760f73 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,