Intro to MPI
- Message Passing Interface
- This is a library definition.
- It is language independent
- C, C++, FORTRAN
- Javascript?, python, java
- But interfaces for other languages as well.
- Early draft for MPI1 in 1992, official release 1994.
- MPI is a communication protocol
- For parallel computers.
- Consider Bridges-2
- 488 nodes
- 2x 64 core CPUs
- 256 GB of memory each.
- 3.7 TB SSD
-
- 16 more of these with (Memory Nodes)
- 4 more with
- 4x 24 core cpu
- 4 TB main memory
- 7TB SSD
- 34 GPU nodes
- 24 with 8 Nvidia Tesla
- 9 with 8 Nvidia V100
- 1 with 16 Nvidial Volta
- With various configurations
- This machine supports MPI
- Let's quickly check out the Top 500 list
- What is a Flop/s ?
- What is a TFlop?
- What is an EFlop ? Note the current performance record is 7.84 EFlops/s
- MPI has been through a number of revisions. Currently MPI-3
- There are several MPI implimentations
- mpich is from Argonne National Lab and Mississippi State.
- Fronteer runs Cray MPI, a version of MPICH
- OPEN MPI is the merger of several MPI projects.
- I spent way too much time looking at the above.
- For me
- I am using mpich.
- Just pop this open in another window"
- We are in Argonne's "zone".
- And The Ohio State University
- I may go to one of the C++ interfaces, but I still sort of know the C interface.
- I will start with c.
- It has been a while, so I have stolen these first two examples.
- Also note, I might be a bit old-fashion in my usage.
- A MPI Implementation gives you
- A set of header files (/usr/include/mpich-x86_64/)
- A set of libraries (/usr/lib64/mpich/lib/)
- A bunch of executables (/usr/lib64/mpich/bin)
- Compilers
- mpicc
- mpic++
- mpif77, mpif90, ...
- Other utilities
- Man Pages (/usr/lib64/mpich/share/man)
- Look at my Makefile.
- I add some flags (but I don't think this is necessary, but I want to show it)
- I change the default compiler. (This is necessary)
- To run the process
- I need all machines upon which I wish to run this computatin configured.
- Running the MPI daemon
- Probably Private/Public or better key exchanges done.
- Or possibly on a completely trusted network.
- I might need to submit to a batch job runner
- Or I need to run with
-
mpiexec args executable pgmargs [ : args executable pgmargs ... ]
-
mpiexec -n 10 hello
- Let's take a look at hello.cpp
-
int MPI_Init(int *argc, char ***argv)
- ARG, a triple pointer reference.
- These can be nullptr.
- You should do as little as possible before you do this.
- This was designed in the heyday of POSIX stuff so the error is similar.
- The call returns an integer which indicates
- Success: MPI_SUCCESS
- otherwise.
-
int MPI_Error_string(int errorcode, char *string, int *resultlen)
-
int MPI_Comm_size(MPI_Comm comm, int *size)
- This returns the number of proceses in this group.
- Think of the group as a Orginizational unit.
- For now MPI_COMM_WORLD is the collection of all processes.
- We may build other groups later.
- This will tell us the number of processes in the computation.
-
int MPI_Comm_rank(MPI_Comm comm, int *rank)
- Each process has a unique "id" or rank in each of its communication groups.
- This is used for many things.
-
int MPI_Get_processor_name(char *name, int *resultlen)
-
MPI_Finalize(void)
- Look at first.cpp
-
int MPI_Send(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)
-
int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status)
- MPI_ANY_SOURCE
- MPI_ANY_TAG
- The tag is sort of like the name on an evelope.
- It was sent to this address but why.
- This will possibly allow me to customize when I receive a message.