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
Branches
Tags v1.1
No related merge requests found
......@@ -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
......
......@@ -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
```
#!/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
......@@ -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:
......
......@@ -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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment