Skip to content

Commit 0ae319a

Browse files
Merge branch 'main' of https://github.com/UPPMAX/HPC-python
2 parents 32e6854 + 783ee2c commit 0ae319a

File tree

5 files changed

+46
-22
lines changed

5 files changed

+46
-22
lines changed

docs/day2/evaluation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
Evaluation
33
==========
44

5-
The evaluation form can be found here: https://forms.office.com/e/LFA8rPncbF
5+
The evaluation form can be found here: https://forms.office.com/e/rartwsGrvY

docs/day2/use_isolated_environments.rst

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ Breakout room according to grouping
420420

421421
- `Python <https://lunarc-documentation.readthedocs.io/en/latest/guides/applications/Python/>`_
422422

423-
UPPMAX
423+
UPPMAX (only Pelle)
424424

425425
- `Python venv <https://docs.uppmax.uu.se/software/python_venv/>`_
426426
- `Video By Richel <https://www.youtube.com/watch?v=lj_Q-5l0BqU>`_
@@ -430,7 +430,7 @@ Breakout room according to grouping
430430
- `Venv <https://docs.hpc2n.umu.se/software/userinstalls/#venv>`_
431431
- `Video by Richel <https://www.youtube.com/watch?v=_ev3g5Zvn9g>`_
432432

433-
.. tab: conda
433+
.. tab:: conda
434434

435435
NSC:
436436

@@ -520,7 +520,7 @@ Breakout room according to grouping
520520
521521
- Check that the above packages are there by ``conda list``.
522522

523-
2. Let's make a Jupyter installation based on Python 3.11.7
523+
2. Let's make a Jupyter installation based on Python 3.11.7
524524

525525
.. code-block:: console
526526
@@ -558,9 +558,9 @@ Breakout room according to grouping
558558

559559
.. tab:: UPPMAX
560560

561-
1. Let's make a Spyder installation in a `conda environment <https://saturncloud.io/blog/how-to-ensure-that-spyder-runs-within-a-conda-environment/#step-2-create-a-conda-environment>`_
561+
Let's make a Spyder installation in a `conda environment <https://saturncloud.io/blog/how-to-ensure-that-spyder-runs-within-a-conda-environment/#step-2-create-a-conda-environment>`_
562562

563-
.. tabs:::
563+
.. tabs::
564564

565565
.. tab:: Bianca
566566

@@ -576,7 +576,7 @@ Breakout room according to grouping
576576
which python # should point to the conda environment!
577577
python -V # should give python version 3.12.X
578578
579-
.. tab:: Pelle
579+
.. tab:: Pelle
580580

581581
.. code-block::
582582
@@ -749,10 +749,24 @@ Breakout room according to grouping
749749
which python # should point to the conda environment!
750750
python -V # should give python version 3.12.X
751751
752-
.. tab:: UPPMAX: Pelle
752+
.. tab:: UPPMAX: Bianca
753753

754-
.. code-block:: console
754+
.. code-block::
755755
756+
ml conda
757+
export CONDA_PKG_DIRS=/proj/hpc-python-uppmax/$USER
758+
export CONDA_ENVS_PATH=/proj/hpc-python-uppmax/$USER
759+
conda create --prefix $CONDA_ENVS_PATH/example python=3.12 -c conda-forge
760+
source activate example
761+
# A prompt "(/path-to/example/)" should show up
762+
# double-check we are using python from the Conda environment!
763+
which python # should point to the conda environment!
764+
python -V # should give python version 3.12.X
765+
766+
.. tab:: UPPMAX: Pelle
767+
768+
.. code-block::
769+
756770
ml Miniforge3/24.11.3-0
757771
export CONDA_PKG_DIRS=/proj/hpc-python-uppmax/$USER #only needed once per session
758772
export CONDA_ENVS_PATH=/proj/hpc-python-uppmax/$USER #only needed once per session
@@ -762,7 +776,7 @@ Breakout room according to grouping
762776
# double-check we are using python from the Conda environment!
763777
which python # should point to the conda environment!
764778
python -V # should give python version 3.12.X
765-
779+
766780
.. tab:: HPC2N
767781

768782
Skip this exercise
@@ -777,6 +791,9 @@ Breakout room according to grouping
777791

778792

779793

794+
795+
796+
780797
.. challenge:: (optional) 5. Make a test environment and spread (venv)
781798

782799
Read `here <https://uppmax.github.io/HPC-python/extra/isolated_deeper.html#creator-developer>`_

docs/day3/evaluation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
Evaluation
33
==========
44

5-
The evaluation form can be found here: https://forms.office.com/e/GCB2xjM7zx  
5+
The evaluation form can be found here: https://forms.office.com/e/6RPcNSWC6E 

docs/day4/evaluation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
Evaluation
33
==========
44

5-
The evaluation form can be found here: https://forms.office.com/e/KL2EEU3x2M 
5+
The evaluation form can be found here: https://forms.office.com/e/i9FE60VZhV 

docs/day4/parallel.rst

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -434,23 +434,30 @@ in Python rather than learning to write those codes.
434434
Optional flags for ``srun`` for writing output and error files are ``-o output_%j.out -e error_%j.err`` instead
435435
of writing on the terminal screen.
436436

437-
**Data dependencied**
437+
.. warning::
438438

439-
In general, one cannot parallelize an serial algorithm; let's take the case of:
439+
**Data dependencies**
440440

441+
In general, one cannot parallelize a serial algorithm; let's take the case of:
441442

442-
.. code-block:: python
443+
.. code-block:: python
443444
444-
a[0] = 0
445-
for i in range(1, N):
446-
a[i] = a[i-1] + i
445+
a[0] = 0
446+
for i in range(1, N):
447+
a[i] = a[i-1] + i
447448
448-
Here, the iteration *i* depends on the previous iteration *i-1*. One needs to transform this algorithm:
449+
Let's say we have the elements :code:`a[0], a[1],..., a[5]` and only two processes. Process number one
450+
takes the elements :code:`a[0], a[1], a[2]` and process number two :code:`a[3], a[4], a[5]`.
451+
Because in the loop the iteration ``i`` depends on the previous iteration ``i-1``, process two will have
452+
conflicts computing :code:`a[3]` because it depends on :code:`a[2]` which is owned by process one.
453+
454+
One can avoid data dependencies by transforming the initial algorithm to a more suitable algorithm for
455+
parallelization:
449456

450-
.. code-block:: python
457+
.. code-block:: python
451458
452-
for i in range(N):
453-
a[i] = 0.5 * i * (i + 1)
459+
for i in range(N):
460+
a[i] = 0.5 * i * (i + 1)
454461
455462
456463

0 commit comments

Comments
 (0)