Parallelization of the Game of Life in openMP, MPI and CUDA
In the folder Project there is the makefile that compiles the OpenMP, MPI, the sequential version repectively in the folder OpenMP, MPI and Project. So, is possible to compile these file with the make command from bash. All the bin files will be located in the folder bin.
In each folder MPI,OpenMP and Project there are the scripts bash that execute the program with the parameters mentioned in the report . The MPI script doesn't shows the evolution also for the small dimensions ( number of columns < 1000 ). If you want see the evolution on the terminal for small dimentions, change in the MPI script, the flag not_show_evolution from 1 to 0.
To execute with the script, in the folder in which is located the script:
bash name_of_the_script.sh
In the folder in which are contained the files, Project for the serial, MPI, OpenMp and CUDA for the other.
Common execution parameters:
- nRows, nCols are respectively the number of rows and columns of the Game of Life grid.
- timesteps are the number of time step with which execute the game.
icc -O0 glife_sequential.c -o gol_sequntial
icc -O3 -ipo -xHost glife_sequential.c -o gol_sequntial
./gol_sequential nRows nCols timesteps
icc experiment03.c -qopenmp -o gol_omp
./gol_omp nRows nCols timesteps number_of_threads
mpiicc main_MPI.c ../utils.c mpi_utils.c -o gol_mpi
MPI execution parameters:
-
host_list_n.txt is file that contains the list of the host used, and n must be replace with the number of nodes ( 1, 2, 4, 8). These files are located in the folder MPI/hostfile, and there is a file for each nuber of node.
-
n_process_per_host is the number of process that each node must executes.
-
tot_procesess is the total number of processes.
-
Version ( 1 or 2) is the display version used. The experiments are made with the version 2.
-
show_result is a flag that indicates if show or not the evolution of the game in the terminal for nCols lower than 1000. 0 to see the evolution on the terminal, 1 otherwise.
-
nNodes is the number of nodes of the cluster used, and must be the same of the hostfile choosen (1, 2, 4, 8).
mpiexec -hostfile host_list_n.txt -perhost n_process_per_host -np tot_procesesses ./gol_mpi nRows nCols timesteps version show_result nNodes
nvcc gol_cuda.cu -o gol_cuda
In this case, the parameter number_of_threads must be a multiple of 32, and the max is 1024.
./gol_cuda nRows nCols number_of_threads
Contributors: