Informações

Autores Erik-Jan Lingen, Matthias Möller
Prazo de entrega Sem prazo
Limite de submissão No limitation

Entrar

Sandbox

This material is part of the course Practical Introduction to Parallel Programming and meant for educational purposes only.


Course slides can be downloaded here.


You can use this sandbox to test your code making use of one or multiple parallelizatio techniques at the same time, e.g., MPI-OpenMP or MPI-Threads.


If you want to run this or any other exercise on your own computer you can download this archive, which provides a framework for building your code with CMake. You have to ensure that you have installed a C/C++ compiler that supports OpenMP (e.g. GCC or Intel's C/C++ compiler), an MPI library (e.g. OpenMPI), a POSIX Threads implementation, and CMake.

Once you downloaded the pipp2023.zip archive please run the following under Linux / macOS:

$> unzip pipp2023.zip
$> cd pipp2023
$> mkdir build
$> cd build
$> CC=gcc-11 CXX=g++-11 cmake ..
-- The C compiler identification is GNU 11.1.0
-- The CXX compiler identification is GNU 11.1.0
...
-- Configuring done
-- Generating done
-- Build files have been written to: <PATH-TO>/pipp2023/build
$> make -j4

The line CC=gcc-11 CXX=g++-11 cmake .. configures a build with the GNU C/C++ compiler version 11. If you simply type cmake .. CMake will try to find the system's default compiler. You can explicitly enable/disable MPI, OpenMP, Threads by adding one or more of the switches

cmake .. -DUSE_MPI=ON/OFF -DUSE_OpenMP=ON/OFF -DUSE_Threads=ON/OFF

If you have more than 4 cores you can compile your codes with more than 4 processes in parallel, e.g. make -j8.

Under Windows, CMake can be used to generate project files for Microsoft Visual Studio. Please check the documentation.

If you want to add new source files, simply copy them into one of the different directories introduction, mpi, openmp, threads, and projects and run cmake .. again. Make sure that no two files have the same name.


Questão 1: Sandbox
Questão 2: Number of MPI processes

Specify the number of MPI processes (1-64) that should be used for running your program (mpirun -np <nproc>)

Questão 3: OpenMP environment variables

Specify the OpenMP environment variables that should be used for running your program (mpirun -x OMP_NUM_THREADS=1 -x ...). Use semicolons to separate multiple variables

Questão 4: Command Line Argument

Specify the command line arguments that should be passed to your program when it is run. Arguments must be given in quotes and separated by commas. Leave this filed empty if you do not want to specify command line arguments.

Example: "1","int","arg=2" is interpreted as three arguments 1, int, and arg=2.