Compiling c, c++ and fortran code
Login
Login and you are in a login node. Create a folder for your project, and change directory to this folder. Create or copy your source code to this folder. Place your job script on same place as your compiled program.
Load modul
To list programs and compilers, use
module avail
or
module spider as eg, module spider icc or module spider gcc
We recommend using intel compilers and
module load intel/2020b
(You get compilers, MPI and libraries)
For GNU compilers:
module load foss/2020b
Write "module list" for checking what is loaded.
NOTE! Add same module load in the job script as the compiled code.
(See more Modules – High Performance Computing Group (ntnu.no))
Compile code
Intel (example)
Sequential: icc -O3 -o mycode mycode.c
OpenMP: icc -O3 -qopenmp -o mycode mycode.c
MPI: mpiicc -O3 mycode mycode.c
Hybrid: mpiicc -O3 -qopenmp -o mycode mycode.c
(Same for fortran: ifort, mpiifort)
GNU (example)
Sequential: gcc -O3 -o mycode mycode.c
OpenMP: gcc -O3 -fopenmp -o mycode mycode.c
MPI: mpicc -O3 -o mycode mycode.c
Hybrid: mpicc -O3 -fopenmp -o mycode mycode.c
(same for fortran: gfortan and mpifort)
Run your program via Slurm and job script.
See: Running Jobs – High Performance Computing Group (ntnu.no)
Python packages
There are 2 ways of installing python packages on Idun.
Virtual Enviroment
See Modules – High Performance Computing Group (ntnu.no)
Pip install (local)
Load python module.
(Check if the module is already installed on the python version)
Use command (remember --user) (only on login node)
pip install packages --user
Example numpy:
pip install numpy --user
You do not need to do anything when running jobs on compute node.