Revision [7014]
This is an old revision of Mpi made by ToBo on 2008-12-10 00:36:43.
MPI
1. Eigenschaften
- Architektur und Hardware unabhängig
- geeignet für Rechner mit mehreren CPUs und für Cluster mit mehreren Rechnern (auch für Cluster mit Multicorerechnern)
- sichere Datenübertragung
- Entwicklung von parallelen Algorithmen, Anwendungen und Bibliotheken
2. Implementierungen
- MPICH2 ist eine MPI-1- und MPI-2-Implementierung
- OpenMPI ist eine MPI-2-Implementierung eines Konsortiums von Partnern aus der akademischen Einrichtungen, Forschungseinrichtungen und der Industrie.
- LAM/MPI
- mpiJava
nicht zu verwechseln mit OpenMP
3. Informationsmaterial
- Spezifikation
- Debian Clusters for Education and Research
- http://wiki.freepascal.org/MPICH
- MpiInstallation Installation
4. Programme bei MPICH2
mpicc compiles and links MPI programs written in C
mpicxx compiles and links MPI programs written in C++
mpiexec runs an MPI program
mpd process mager
mpdallexit shutdown all process magers (mpd)
mpdcleanup removes the Unix socket on local (the default) and remote machines in case the mpd crashed badly and did not remove it
mpdtrace Llsts hostname of each of the mpds in the ring
mpdringtest measures the time a single message going around the ring of mpds <num> times (default once): mpdringtest 100
5. MPD einstellen
5.1Einen einzelnen mpd zum testen starten
mpd -d
5.2mpd auf einem Rechner mit 4 Cpus einrichten
mpd --daemon --ncpus=4
5.3mpd-Ring auf mehreren Rechnern einrichten
5.4Weitere Parameter für mpd
echo gibt Informationen aus, wie z.B. die Portnummer
mpd --echo
--listenport=4991
6. Beispiele
Eigene Beispiele
- MpiBeispiel01 Beispiel 1
- MpiBeispielRing Nachricht in einem Ring weiterleiten (ring.c)
- MpiBeispielCpi Berechnung von PI (cpi.c)
Beispiele aus MPICH2
- shared/examples_graphics/cpi_anim
- shared/examples_graphics/cxgraphics
7. Funktionen in C
MPICH
int MPI_Send (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)
int MPI_Isend (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request)
int MPI_Irecv (void* buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Request* request)
int MPI_Test (MPI_Request* request, int* flag, MPI_Status* status)
int MPI_Wait (MPI_Request* request, MPI_Status* status)
int MPI_Comm_group (MPI_Comm comm, MPI_Group* group)
int MPI_Group_union (MPI_Group group1, MPI_Group group2, MPI_Group* new_group)
int MPI_Group_intersection (MPI_Group group1, MPI_Group group2, MPI_Group* new_group)
int MPI_Group_difference (MPI_Group group1, MPI_Group group2, MPI_Group* new_group)
int MPI_Bcast (void *buffer, int count, MPI_Datatype type, int root, MPI_Comm comm)
int MPI_Gather (void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)
int MPI_Gatherv (void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int *recvcounts, int *displs, MPI_Datatype recvtype, int root, MPI_Comm comm)
int MPI_Scatter (void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)
int MPI_Scatterv (void *sendbuf, int *sendcounts, int *displs, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)
int MPI_Reduce (void *sendbuf, void *recvbuf, int count, MPI_Datatype type, MPI_Op op, int root, MPI_Comm comm)
int MPI_Recv (void* buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status* status)
int MPI_Isend (void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request)
int MPI_Irecv (void* buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Request* request)
int MPI_Test (MPI_Request* request, int* flag, MPI_Status* status)
int MPI_Wait (MPI_Request* request, MPI_Status* status)
int MPI_Comm_group (MPI_Comm comm, MPI_Group* group)
int MPI_Group_union (MPI_Group group1, MPI_Group group2, MPI_Group* new_group)
int MPI_Group_intersection (MPI_Group group1, MPI_Group group2, MPI_Group* new_group)
int MPI_Group_difference (MPI_Group group1, MPI_Group group2, MPI_Group* new_group)
int MPI_Bcast (void *buffer, int count, MPI_Datatype type, int root, MPI_Comm comm)
int MPI_Gather (void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)
int MPI_Gatherv (void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int *recvcounts, int *displs, MPI_Datatype recvtype, int root, MPI_Comm comm)
int MPI_Scatter (void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)
int MPI_Scatterv (void *sendbuf, int *sendcounts, int *displs, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)
int MPI_Reduce (void *sendbuf, void *recvbuf, int count, MPI_Datatype type, MPI_Op op, int root, MPI_Comm comm)
8. Fehlerbehandlung
8.1Fehlermeldung von mpd oder mpdboot
mpd HOST1 (handle_mpd_output 392): failed to handshake with mpd on HOST2; recvd output={}
/etc/hosts
127.0.0.1 localhost.localdomain localhost 10.3.6.1 HOST1 10.3.6.2 HOST2
8.2mpd bereinigen
Bei Experimentieren kann das löschen aller Überreste von mpd interessant sein.
Auf jeder Maschine ausführen
mpdallexit; mpdcleanup
8.3mpd beschäftigt
mpiexec_amygdala (mpiexec 392): no msg recvd from mpd when expecting ack of request
1 Minute abwarten und nochmal versuchen
CategoryStudiumSE
Siehe auch • • • • •