Revision [6904]
This is an old revision of Mpi made by ToBo on 2008-12-07 19:15:10.
MPI
1. 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.
- mpiJava
2. Informationsmaterial
http://debianclusters.cs.uni.edu/index.php/MPICH:_Pick_Your_Paradigm
http://packages.debian.org/sid/mpich-bin
http://wiki.freepascal.org/MPICH
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
4. Beispiele
5. 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)
6. Installation
6.1unter Linux
unter Linux
Quellen herunterladen
./com
make
make install
smpd -install
oder speziell unter Debian
für OpenMPI
aptitude install openmpi-dev openmpi-dbg
und MPICH2
aptitude install mpich-bin libmpich1.0-dev
aptitude install mpi-doc
aptitude remove --purge mpich-bin libmpich1.0-dev openmpi-dev openmpi-dbg
./configure --prefix=/opt
make
sudo make install
make
sudo make install
6.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
7. Vorbereitung
/.mpich2
export PATH=/local/mpich2/bin:$PATH
export LD_LIBRARY_PATH=/local/mpich2/lib:$LD_LIBRARY_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
%%
Siehe auch • • • • •