Exercise: Hello World!
Most exercises provide some code to start with. These codes are in the teacher's home directory, ~x78k0001. In order to get the code for an exercise, you copy the whole directory to a place in your $HOME, like this:
$ cp -a ~x78k0001/Hello ~
In this exercise we want to initialize MPI, print out size/rank, and finalize the MPI. There are 7 FIXME markers in the C code (5 in the case of the Fortran code) which are related to the name of calls to MPI initialization and finalization as well as obtaining the size of a communicator. Some FIXME markers concern arguments of the calls. Your task is to replace the FIXME markers with the correct code.
In the directory Hello, there are f and c subdirectories for Fortran and C, respectively.To make Intel MPI and compilers available, you should load two modules in the Terminal:
In order to compile an MPI program, you have to use one of the MPI wrapper scripts of the MPI library instead of directly running the compilers, e.g. in the case of Intel MPI, mpiicc, mpiicpc, and mpiifort for C, C++, and Fortran codes, respectively. In this case exercise:
For C++:
$ mpiicpc hello.cpp
For Fortran:
$ mpiifort hello.F90
For running the code you should use mpirun:
$ mpirun -np # ./my_executable
If the compilation and building the binary is done as explained above, the name of the executable will be a.out. Here, "#" is the number of processes you want to use. Each Fritz compute node has 72 cores. You can try running with different number of MPI processes up to 72.