This labs we will focus on brushing up on your basic C++ skills. We will implement a trivial parallel sorting using C++ threads only (or whatever native C++ STL libraries you can remember).
First we need to remember, how to work with the cluster.
Log in to parlab.ms.mff.cuni.cz
(SSH runs on port 42222) using your LDAP credentials.
Use SLURM tools like sinfo
or squeue
to look around. Check out the documentation https://gitlab.mff.cuni.cz/mff/hpc/clusters if necessary.
Make sure you can run jobs via srun
. To get you started, argument -p
selects partition (job queue), the -A
is your account, -n 1
makes sure your job is started only once (that's important if you single core -c 1
), and -c
allocates given number of cores (regular workers have 32 physical cores with HT, so 64 is maximum). For instance:
$> srun -p mpi-homo-short -A nprg058s -n 1 -c 64 ./your-app
Setup your workspace so that you can easily edit the code and run it on the cluster. Please do not use SSH Remove VSCode extension! It consumes awfully lot memory on the parlab headnode (which may lead to bad situations when many students do this simultaneously). A few tips:
rsync
or scp
(on Linux or using WSL/MSYS/CygWin) to sync your code with parlab. You can set a script or configure your IDE to run it after every save.Remember to run all your code on the workers including the compilation (make
). The headnode parlab
does not even have all the compilers/libraries installed.
/home/_teaching/advpara/labs/01-cpp-sort
and copy it into your home folder, so you can edit it.std::sort()
in your threads. The recommended approach is to use MergeSort or other divide-and-conquer sorting algorithms, but anything goes.Note: If you wish to implement and debug the assignment locally, you will need bpplib (a header-only C++ library) to make it work. On linux, just fix the Makefile (path to bpplib). On Windows (Visual Studio), set a BPP_LIB
environmental variable that holds the path of bpplib
's include
subdir.