TJ CSL
Search…
MPI
We don't really use MPI for any day-to-day tasks in the CSL, but it's important to know how it works to support some of the high-powered Senior Research projects going on The Cluster and Parallel Computing labs.

Example MPI Program

Copied from a tutorial somewhere.
1
// hello_mpi_world.c
2
#include <mpi.h>
3
#include <stdio.h>
4
5
int main(int argc, char** argv) {
6
// Initialize the MPI environment
7
MPI_Init(NULL, NULL);
8
9
// Get the number of processes
10
int world_size;
11
MPI_Comm_size(MPI_COMM_WORLD, &world_size);
12
13
// Get the rank of the process
14
int world_rank;
15
MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);
16
17
// Get the name of the processor
18
char processor_name[MPI_MAX_PROCESSOR_NAME];
19
int name_len;
20
MPI_Get_processor_name(processor_name, &name_len);
21
22
// Print off a hello world message
23
printf("Hello world from processor %s, rank %d out of %d processors\n",
24
processor_name, world_rank, world_size);
25
26
// Finalize the MPI environment.
27
MPI_Finalize();
28
}
Copied!
Then, compile with mpicc --std=c99 hello_mpi_world.c -o hello_mpi_world And run with Slurm using srun -N4 ./hello_mpi_world (Or locally using mpirun -n4 ./hello_mpi_world)

What MPI software we use

    PMIX 2.2.2
    OpenMPI 3.1.3
See the relevant Ansible plays in Cluster Administration for more details on how it is installed.
Last modified 2yr ago