Skip to content
Snippets Groups Projects
Commit 36f29c0a authored by Kjartan Thor Wikfeldt's avatar Kjartan Thor Wikfeldt
Browse files

update from aprun to srun

parent 6fb9f35b
No related branches found
No related tags found
No related merge requests found
...@@ -32,15 +32,21 @@ First it is necessary to book a node for interactive use: ...@@ -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 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). 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 # OpenMP Exercises
......
...@@ -50,7 +50,7 @@ difficult task is to make a good use of all the available cores. ...@@ -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 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). 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 described in the [general
instructions](https://www.pdc.kth.se/support/documents/courses/summerschool.html). instructions](https://www.pdc.kth.se/support/documents/courses/summerschool.html).
...@@ -145,6 +145,6 @@ reflective boundary conditions, thus at the boundary ...@@ -145,6 +145,6 @@ reflective boundary conditions, thus at the boundary
``` ```
#!/bin/csh #!/bin/csh
foreach n (`seq 1 1 16`) 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 end
``` ```
#!/bin/csh #!/bin/csh
foreach n (`seq 1 1 16`) 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 end
...@@ -51,7 +51,7 @@ export OMP_NUM_THREADS=<number-of-threads> ...@@ -51,7 +51,7 @@ export OMP_NUM_THREADS=<number-of-threads>
To run an OpenMP code on a computing node of Beskow: 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 ## Exercise 1 - OpenMP Hello World: get familiar with OpenMp Environment
...@@ -68,7 +68,7 @@ Your code using 4 threads should behave similarly to: ...@@ -68,7 +68,7 @@ Your code using 4 threads should behave similarly to:
Input: Input:
``` ```
aprun -n 1 -d 4 -cc none ./hello srun -n 1 ./hello
``` ```
Output: Output:
......
...@@ -35,7 +35,8 @@ $ make part1ex1 ...@@ -35,7 +35,8 @@ $ make part1ex1
Run the resulting program: Run the resulting program:
```bash ```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. 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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment