Given two
and, a naive approach to implement such an operation in the programming language C
(in which multidimensional arrays are stored row-major order), is the following:
for(i = 0; i < n; i++)
for(j = 0; j < n; j++)
for(k = 0; k < n; k++)
C[i][j] += A[i][k] + B[k][j];
which is an example of a serial code.
Here, my goal is to implement a parallel code in C
to perform such an operation given any number
Important note: the code has been written to compile and run on the Marconi100 cluster at CINECA. To compile and run the Spectum_MPI
, the cuda
and the openablas
modules must be loaded.
To compile it is possible to use the command
make [version]
where [version]
can be either blank, dgemm
or cuda
. This will produce the [version]multiplication.x
executable (the name will depend on which version it has been compiled).
The executable will generate two mpirun -np 3 ./[version]multiplication.x 16
or to use
make [version]run prc=3 dim=16
where [version]
can be either blank, dgemm
or cuda
. This will produce the [version]multiplication.x
executable (the name will depend on how it has been compiled) and run it.
To test it is possible to pass the debug=yes
flag to the Makefile
make [version] debug=yes
and then run the [version]debug_multiplication.x
executable using mpirun
. It is also supported the command:
make [version]run debug=yes
where [version]
can be either blank, dgemm
or cuda
. This will compile (if necessary) and run immediately after.
These are the things done or to be done:
- Implement a working code using only MPI
- Implement a working code when
$n$ multiple of$m$ - Add some testing
- Implement a working code when
$n$ generic - Measure performances
- Include a version using
cblas_dgemm
instead of the serial multiplication done by each MPI process
- Make it work
- Make some plots to compare performances with serial version
- Port on GPU
- Include a version using
cublasDgemm
instead of the serial multiplication done by each MPI process - Make some plots to compare performances with serial and
cblas_dgemm
versions