Revision [6959]

This is an old revision of Mpi made by ToBo on 2008-12-08 02:19:53.

 

MPI


1. Implementierungen


nicht zu verwechseln mit OpenMP


2. Informationsmaterial

3. 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


4. MPD setup


4.1Parameter für mpd


echo gibt Informationen aus, wie z.B. die Portnummer
mpd --echo



4.2mpd-Ring auf mehreren Rechnern

5. Beispiele


Eigene Beispiele
Beispiele aus MPICH2
  • shared/examples_graphics/cpi_anim
  • shared/examples_graphics/cxgraphics


6. 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)



7. Installation


7.1unter Linux (Debian)


für OpenMPI mit aptitude
aptitude install openmpi-dev openmpi-dbg

für MPICH2 mit aptitude
aptitude install mpich-bin libmpich1.0-dev openmpi-dev openmpi-dbg mpich-mpd-bin mpich-mpd-bin libmpich-mpd1.0-dev

oder herunterladen und kompiieren von MPICH2
wget http://www.mcs.anl.gov/research/projects/mpich2/downloads/tarballs/1.0.8/mpich2-1.0.8.tar.gz
tar xzf mpich2-1.0.8.tar.gz
./configure --prefix=/opt/mpi
make
make install


~/bash_profile erweitern um
PATH=/opt/mpi/bin:"${PATH}"
LD_LIBRARY_PATH=/opt/mpi/lib



7.2 unter Windows


unter Windows
MPI 1.0.8
.NET 2.0. SP1
gcc MINGW 32
  • .Net framework 2.0 installieren, falls nicht vorhanden (der MPICh installer startet nicht, wenn .net 2.0 fehlt): dotnetfx.exe herunterladen und ausführen
  • .Net 2.0 Service pack 1 installieren: NetFx20_SP1_x86 herunterladen und ausführen
  • MPICH2 installieren: MPICH2 für Windows 32bit herunterladen, ausführen
  • Gcc aus MingW installieren, falls kein anderer C-Compiler vorhanden. Die Installation der neuen Version 1.08 habe ich nur mit Gcc getestet. VisualC++ oder Borland sollten auch funktionieren
  • SMPD als Dienst installieren (smpd -h listet die Optionen): smpd -install und smpd -register_spn
  • Suchpfad ergänzen (<MINGW_ROOT>/bin und <MPICH2_ROOT>/bin hinzufügen)
  • Das fertige Beispiel testen: cd <MPICH2_ROOT>/examples und mpirun -n 4 cpi


8. Vorbereitung


~/.mpich2
export PATH=/local/mpich2/bin:$PATH
export LD_LIBRARY_PATH=/local/mpich2/lib:$LD_LIBRARY_PATH


source ~/.mpich2


Kompiliren
mpicc cpi.c


~/.mpd.conf erstellen
echo "MPD_SECRETWORD=..." > ~/.mpd.conf


Rechte setzen
chmod 600 ~/.mpd.conf


HPC-Server starten
mpd &


Test
mpiexec -n 4 ~/mpi_ex/simple/spi



9. Fehlerbehandlung


9.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


9.2mpd bereinigen


Bei Experimentieren kann das löschen aller Überreste von mpd interessant sein.

Auf jeder Maschine ausführen
mpdallexit; mpdcleanup




CategoryStudiumSE
Siehe auch
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki