PDC Summer School

This page contains useful information for the PDC summer school.

Account and login

Please see instructions for acquiring a PDC account and logging in to PDC clusters in the General instructions for PDC courses.

Virtual machine

All participants will receive a USB memory stick with an Ubuntu virtual machine (VM) image which can be used to log in to PDC. To use the VM, you will need to install VirtualBox. The image can also be downloaded here.

Note that you can also use the VM for the Software Engineering and Singularity lessons, so we recommend all participants to install VirtualBox.

Compiling code

<<<<<<< HEAD Dardel has different compiler environments which you will use to compile code for the lab exercises. Detailed information can be found at https://www.pdc.kth.se/support/documents/software_development/development_intro.html, but a summary is found below.

Dardel uses compiler wrappers so that source code is compiled with the compiler environment currently loaded. By default the PrgEnv-cray module is loaded when you log in, but you can change to the Intel compiler suite by ======= Dardel have different compiler environments which you will use to compile code for the lab exercises. Detailed information can be found at https://www.pdc.kth.se/support/documents/software_development/development_intro.html, but a summary is found below.

Dardel uses compiler wrappers so that source code is compiled with the compiler environment currently loaded. By default the PrgEnv-cray module is loaded when you log in, but you can change to the AMD compiler suite by >>>>>>> 4d729ef0c05b7932d305c428695633397b7c00d4

$ module swap PrgEnv-cray PrgEnv-aocc

and to GNU compilers with

$ module swap PrgEnv-cray PrgEnv-gnu

Regardless of which compiler suite is loaded, you should use the same compiler commands ftn, cc and CC to compile.

Compiling serial and MPI code (note that no MPI flags are needed):

# Fortran
ftn [flags] source.f90
# C
cc [flags] source.c
# C++
CC [flags] source.cpp

Compiling OpenMP code:

ftn -homp source.f90
cc -fopenmp source.c
CC -fopenmp source.cpp

<<<<<<< HEAD

Running jobs

After logging in you are on the login node of the cluster. The login node is a shared resource and should not be used for running parallel jobs. Instead, the SLURM scheduling system should be used to either run interactive jobs or submit batch jobs to the queue (see How to Run Jobs). ======= Running jobs ————

After logging in you are on the login node of the cluster. The login node is a shared resource and should not be used for running parallel jobs. Instead, the SLURM scheduling system should be used to either run interactive jobs or submit batch jobs to the queue (see How to Run Jobs). >>>>>>> 4d729ef0c05b7932d305c428695633397b7c00d4 You can however use the login node to edit files and compile code.

To request compute resources interactively or via a batch job, you need to specify an allocation ID, a reservation ID, how much time your job needs and how many nodes it should use. To request an interactive node for 1 hour, run the command

$ salloc -A edu19.summer --reservation <reservation-name> -N 1 -t 1:0:0

When the interactive compute node is allocated to you, a new shell session is started (in the same terminal). <<<<<<< HEAD To run a parallel job on the interactive node, type:

$ srun -n 32 ./my_executable

$ srun -n 32 ./my_executable

>>>>>>> 4d729ef0c05b7932d305c428695633397b7c00d4 To run a batch job, you first need to prepare a submit script. In the simplest case, it can look like this:

#!/bin/bash -l
#SBATCH -A edu19.summer
#SBATCH --reservation=<reservation-name>
#SBATCH -P shared
#SBATCH -J name-of-my-job
#SBATCH -t 1:00:00
#SBATCH -N 2

<<<<<<< HEAD

srun -n 64 ./my_executable > my_output_file 2>&1

>>>>>>> 4d729ef0c05b7932d305c428695633397b7c00d4 To submit the job to the scheduler, type

$ sbatch my_submit_script.bash

You can then monitor the job using

$ squeue -u <your-username>

and if you need to cancel the job, find its job-ID using the squeue command and type

$ scancel <job-ID>

File transfer

Files are transferred with scp from PDC to your local machine as follows:

$ scp <username>@dardel.pdc.kth.se:<filename> .

or the other way by:

$ scp <filename> <username>@dardel.pdc.kth.se:~/

Here is more information on Using scp/rsync

Lab exercises

Quick Reference Guide

Check out our quick reference guide to using PDC resources.

Introduction to PDC

Lecture slides can be found here.

Hands-on exercises can be found in this page.

Software engineering

All course material, including exercises and installation/preparation steps to be done before the summer school starts, can be found on this page.

Singularity

Lecture slides can be found here.

OpenMP

All exercises can be found in this GitHub repository. You can either clone it to your computer or navigate the exercises on GitHub.

CUDA

All exercises can be found in this GitHub repository. You can either clone it to your computer or navigate the exercises on GitHub.

Instructions for the two sets of exercises:

  • Lab 1 in C and guidelines for solving the lab in Fortran.

  • Lab 2 in C (and use the same guidelines as above for solving it in Fortran).

MPI

All exercises can be found in this GitHub repository. You can either clone it to your computer or navigate the exercises on GitHub.

Performance Engineering

TBD