Skip to content
Snippets Groups Projects
Commit 12cb1a6e authored by Dirk Pleiter's avatar Dirk Pleiter
Browse files

Update of general instructions

parent cf2768ff
No related branches found
No related tags found
No related merge requests found
# PDC Summer School: General Instructions for the MPI Labs
# PDC Summer School 2021: General Instructions for the MPI Labs
## Where to run
......@@ -20,8 +20,7 @@ Related to the Kerberos-based authentication environment, please check the [Kerb
Software, which is not available by default, needs to be loaded as a [module](https://www.pdc.kth.se/support/documents/run_jobs/job_scheduling.html#accessing-software) at login. Use ``module avail`` to get a list of available modules. The following modules are of interest for this lab exercises:
- **UPDATE** Different versions of the GNU compiler suite (``gcc/*``)
- **UPDATE** Different versions of the Intel compiler suite (``i-compilers/*``)
- Different versions of OpenMPI based on different versions of the GNU compiler suite (``openmpi/*``)
For more information see the [software development documentation page](https://www.pdc.kth.se/support/documents/software_development/development.html).
......@@ -32,44 +31,16 @@ To use the Tegner compute nodes you have to submit [SLURM batch jobs](https://ww
## Compiling MPI programs on Tegner
By default the cray compiler is loaded into your environment. In order to use another compiler you have to swap compiler modules:
The following shell commands show a simple example on how to compile an MPI program using Fortran, C or C++:
```
module swap PrgEnv-cray PrgEnv-gnu
module load openmpi
mpif90 my_prog.f90
mpicc my_prog.c
mpicxx my_prog.cc
```
or
```
module swap PrgEnv-cray PrgEnv-intel
```
On Beskow one should always use the *compiler wrappers* `cc`, `CC` or
`ftn` (for C, C++ and Fortran codes, respectively),
which will automatically link to MPI libraries and linear
algebra libraries like BLAS, LAPACK, etc.
Examples:
```
# Fortran
ftn [flags] source.f90
# C
cc [flags] source.c
# C++
CC [flags] source.cpp
```
Note: if you are using the Intel Programming Environment, and
if you are compiling C code, you might see error messages containing:
```
error: identifier "_Float128" is undefined
```
A workaround is to add a compiler flag:
```
cc -D_Float128=__float128 source.c
```
With the first line the default version of the OpenMPI module is loaded.
## Running MPI programs
......@@ -79,8 +50,7 @@ First it is necessary to book a node for interactive use:
salloc -A <allocation-name> -N 1 -t 1:0:0
```
You might also need to specify a reservation by adding the flag
`--reservation=<name-of-reservation>`.
You might also need to specify a reservation by adding the flag `--reservation=<name-of-reservation>`.
Then the srun command is used to launch an MPI application:
......@@ -90,17 +60,7 @@ srun -n 24 ./example.x
In this example we will start 24 MPI tasks (there are 24 cores per node on the Tegner Thin nodes).
If you do not use srun and try to start your program on the login node then you will get an error similar to
```
Fatal error in MPI_Init: Other MPI error, error stack:
MPIR_Init_thread(408): Initialization failed
MPID_Init(123).......: channel initialization failed
MPID_Init(461).......: PMI2 init failed: 1
```
## MPI Exercises
- MPI Lab 1: [Program Structure and Point-to-Point Communication in MPI](lab1/README.md)
- MPI Lab 2: [Collective and Non-Blocking Communication](lab2/README.md)
- MPI Lab 3: [Advanced Topics](lab3/README.md)
\ No newline at end of file
- MPI Lab 2: [MPI I/O and MPI performance](lab2/README.md)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment