There are two main frameworks which are necessary for proceeding with these labs -- openmp
and mpi
. Programming Experience with C
language is also recommended to follow through.
I have performed the installation on a Mac OSX environment, and thus the installation process on other Operating systems would differ.
-
Installed using
GCC
Compiler -
I have installed
gcc-10
using homebrew in mac. -
Compilation
gcc-10 -fopenmp <file_name.c>
- Execution
./a.out
- To set the number of threads, run this command in the terminal before compiling the program.
export OMP_NUM_THREADS=<number of threads to use>
- Installed
open-mpi
using
brew install openmpi
- To Compile -
mpicc -o <output_file_name> <file_name>.c
- To Run -
mpirun -np <number_of_processors> <output_file_name>
-
Default Compiler Location :
/usr/local/bin/mpicc
-
To create more than 2 processors :
mpirun -np 3 --oversubscribe a.out
In this, we use the Open MP constructs to use multiple threads to compute and store the fibonacci series in a parallel manner.
A template for MPI constructs, and a basic program to get a hang of different constructs used with MPI.
We will also display the details of the processor in the system.
A program to find the average of a few numbers using the Scatter and Gather
constructs of MPI
.
A program to find the average of a few numbers using the Scatter and Reduce
constructs of MPI
.
A program to send and recieve integers between two processes.
A program to send and recieve string messages between two processes. Note : This program has not been written by me, but instead the author has been credited in the code.
A program to send and recieve string messages between two processes with probing using MPI_Probe
and MPI_Get_count
constructs.
A program to send and recieve arrays of integers between two processes.
A program to broadcast messages from one process to all other processes. This is mainly used for data synchronization among the processes and is achieved through the MPI_Bcast
construct.
A program which will cause a message to bounce back and forth between two processes till a condition is met.
A program which will arrange multiple processes in the form of a ring and make a message float through them. The message passes from say Process 1
through all other processes and returns back to Process 1
.