From 36f29c0a8bd37da91052d23592c50d387b6fe004 Mon Sep 17 00:00:00 2001 From: Kjartan Thor Wikfeldt <ktwikfeldt@gmail.com> Date: Tue, 13 Aug 2019 17:47:17 +0200 Subject: [PATCH] update from aprun to srun --- README.md | 12 +++++++++--- advanced_lab/README.md | 4 ++-- advanced_lab/run.csh | 2 +- intro_lab/README.md | 4 ++-- old_intro_lab/README.md | 3 ++- 5 files changed, 16 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 0a230d7..133ba9c 100644 --- a/README.md +++ b/README.md @@ -32,15 +32,21 @@ First it is necessary to book a node for interactive use: salloc -A <allocation-name> -N 1 -t 1:0:0 ``` -Then the aprun command is used to launch an OpenMP application: +An environment variable specifying the number of threads should also be set: ``` -aprun -n 1 -d <number of threads> -cc none ./example.x +export OMP_NUM_THREADS=<number-of-threads> +``` + +Then the srun command is used to launch an OpenMP application: + +``` +srun -n 1 ./example.x ``` In this example we will start one task with 32 threads (there are 32 cores per node on the Beskow nodes). -It is important to use the `aprun` command since otherwise the job will run on the Beskow login node. +It is important to use the `srun` command since otherwise the job will run on the Beskow login node. # OpenMP Exercises diff --git a/advanced_lab/README.md b/advanced_lab/README.md index f007c53..303086c 100644 --- a/advanced_lab/README.md +++ b/advanced_lab/README.md @@ -50,7 +50,7 @@ difficult task is to make a good use of all the available cores. Choose to work with either the given serial C/Fortran 90 code or, if you think you have time, write your own implementation (but don’t waste time and energy). -Compile the code by typing make and execute the program ``shwater2d`` with ``aprun`` as +Compile the code by typing make and execute the program ``shwater2d`` with ``srun`` as described in the [general instructions](https://www.pdc.kth.se/support/documents/courses/summerschool.html). @@ -145,6 +145,6 @@ reflective boundary conditions, thus at the boundary ``` #!/bin/csh foreach n (`seq 1 1 16`) - env OMP_NUM_THREADS=$n aprun -n 1 -d $n ./a.out + env OMP_NUM_THREADS=$n srun -n 1 ./a.out end ``` diff --git a/advanced_lab/run.csh b/advanced_lab/run.csh index 4d2700d..e249203 100644 --- a/advanced_lab/run.csh +++ b/advanced_lab/run.csh @@ -1,4 +1,4 @@ #!/bin/csh foreach n (`seq 1 1 16`) - env OMP_NUM_THREADS=$n aprun -n 1 -d $n ./shwater2d + env OMP_NUM_THREADS=$n srun -n 1 ./shwater2d end diff --git a/intro_lab/README.md b/intro_lab/README.md index 6c56b81..be5b483 100644 --- a/intro_lab/README.md +++ b/intro_lab/README.md @@ -51,7 +51,7 @@ export OMP_NUM_THREADS=<number-of-threads> To run an OpenMP code on a computing node of Beskow: ``` -aprun -n 1 -d <number-of-threads> -cc none ./name_exec +srun -n 1 ./name_exec ``` ## Exercise 1 - OpenMP Hello World: get familiar with OpenMp Environment @@ -68,7 +68,7 @@ Your code using 4 threads should behave similarly to: Input: ``` -aprun -n 1 -d 4 -cc none ./hello +srun -n 1 ./hello ``` Output: diff --git a/old_intro_lab/README.md b/old_intro_lab/README.md index 00cc836..f461701 100644 --- a/old_intro_lab/README.md +++ b/old_intro_lab/README.md @@ -35,7 +35,8 @@ $ make part1ex1 Run the resulting program: ```bash -aprun -n 1 -d number of threads ./part1ex1 +export OMP_NUM_THREADS=<number of threads> +srun -n 1 ./part1ex1 ``` Remember that on the Cray you need to set the environment variable OMP_NUM_THREADS to the number of threads as described in the general instructions. -- GitLab