The repository contains a set of challenges to be solved using parallel computing techniques. The challenges are designed to be solved using the OpenMP and CUDA frameworks.
The challenges are part of the Parallel Computing course at the Politecnico di Milano.
The challenges fall into two main categories:
- Challenge 1 - OpenMP. This challenge is designed to parallelize the Merge Sort algorithm using the OpenMP framework.
- Challenge 2 - CUDA. The goal of this challenge is to parallelize the 2D convolution algorithm using the CUDA framework. Two solutions are proposed: a naive solution using the GPU and an advanced solution using shared memory (tiling technique).
Of course, you need to have the OpenMP and CUDA frameworks installed on your machine to run the following code. You will also need a compatible GPU to run the CUDA code (otherwise you can use the Google Colab).
If you have CLion installed, this is a simple story. Just open the project and run the code using the provided CMakeLists.txt file.
Otherwise, you can compile the code using the command line.
- Compile the CMakeFiles:
cd Parallel-Computing-Challenges # repository folder cmake . # where the CMakeLists.txt file is located
- Compile all the challenges using the following commands:
# assuming you are in the repository folder where the CMakeLists.txt file is located make -f ./Makefile -C . all
- And finally, run the compiled code:
# assuming you are in the repository folder where the CMakeLists.txt file is located ./openmp-parallel-mergesort 1000 # where 1000 is the size of the array to be sorted export MASK_SIZE=3 && export MATRIX_HEIGHT=100 && export MATRIX_WIDTH=100 && ./cuda-2d-convolution # and so on...
- Clean the compiled files:
# assuming you are in the repository folder where the CMakeLists.txt file is located make -f ./Makefile -C . clean
You can also compile just one of the challenges using the following commands:
- Compile the CMakeFiles:
cd Parallel-Computing-Challenges cmake .
- Compile only one of the challenges using the following commands:
or
# assuming you are in the repository folder where the CMakeLists.txt file is located make -f ./Makefile -C . openmp-parallel-mergesort
# assuming you are in the repository folder where the CMakeLists.txt file is located make -f ./Makefile -C . cuda-2d-convolution
- And finally, run the compiled code:
or
./openmp-parallel-mergesort 1000
export MASK_SIZE=3 && export MATRIX_HEIGHT=100 && export MATRIX_WIDTH=100 && ./cuda-2d-convolution
The names of the executables are available in the CMakeLists.txt file. However, here is a list of available programs: