Anmerkungen zu mpi

LAM/MPI

Numerisches Praktikum, linux/dec-Cluster, Bildverarbeitung

mpiCH

Numerisches Praktikum, Cluster von Mac-Rechnern mit debian (S. Wolf)

openMPI

Anmerkungen zu Pegasus:
SUSE Linux Enterprise Server 11 (x86_64)
Linux pegasus 2.6.27.19-5-default #1 SMP 2009-02-28 04:40:21 +0100 x86_64 x86_64 x86_64 GNU/Linux

openmpi-1.2.8-3.15
openmpi-devel-1.2.8-3.15
/usr/lib64/mpi/gcc/openmpi/include/
/usr/lib64/mpi/gcc/openmpi/lib64/
/usr/lib64/mpi/gcc/openmpi/bin/mpif90
/usr/lib64/mpi/gcc/openmpi/bin/mpirun

ries@pegasus:~/mpi> cat hallo.f90
PROGRAM meinmpi
IMPLICIT NONE
INCLUDE 'mpif.h'

INTEGER  :: fehler, taskID, anzahl, laenge
CHARACTER*20 :: namen
   CALL MPI_INIT( fehler )
   CALL MPI_COMM_SIZE(MPI_COMM_WORLD, anzahl, fehler )
   CALL MPI_COMM_RANK(MPI_COMM_WORLD, taskID, fehler )
   PRINT *, "Ich bin task ", taskID, " (von insgesamt ", anzahl, " )"
   CALL MPI_GET_PROCESSOR_NAME(namen, laenge, fehler)
   PRINT *, namen
   CALL MPI_FINALIZE( fehler )
END PROGRAM meinmpi


mpif90 -o hallo hallo.f90
mpirun -n 7  hallo

ries@pegasus:~/mpi> mpirun -n 7 hallo
 Ich bin task            0  (von insgesamt            7  )
 pegasus
 Ich bin task            1  (von insgesamt            7  )
 pegasus
 Ich bin task            2  (von insgesamt            7  )
 pegasus
 Ich bin task            3  (von insgesamt            7  )
 pegasus
 Ich bin task            4  (von insgesamt            7  )
 pegasus
 Ich bin task            5  (von insgesamt            7  )
 pegasus
 Ich bin task            6  (von insgesamt            7  )
 pegasus


mpirun -machinefile meine_rechner -n 3 hallo2
(dann aber 
ssh-keygen -t dsa
id_dsa.pub  >> .ssh/autorized_keys auf den Client-Rechnern
ssh-agent bash
ssh-add
)

Dasselbe in c

ries@pegasus:~/mpi> cat hallo.c
#include 
#include 

int main(int argc, char *argv[]) {
  int anzahl, taskID, laenge;
  char namen[MPI_MAX_PROCESSOR_NAME];

 /* printf("Maximale Namenslaenge: %d\n",MPI_MAX_PROCESSOR_NAME);*/
  MPI_Init(&argc, &argv);
  MPI_Comm_size(MPI_COMM_WORLD, &anzahl);
  MPI_Comm_rank(MPI_COMM_WORLD, &taskID);
  printf("Ich bin task %d ( von insgesamt %d )\n", taskID, anzahl);
  MPI_Get_processor_name(namen, &laenge);
  printf("%s \n", namen);
  MPI_Finalize();
  return(0);
}


mpicc -o hallo hallo.c 

ries@pegasus:~/mpi> mpirun -n 7 hallo
Ich bin task 0 ( von insgesamt 7 )
pegasus
Ich bin task 1 ( von insgesamt 7 )
pegasus
Ich bin task 3 ( von insgesamt 7 )
pegasus
Ich bin task 4 ( von insgesamt 7 )
pegasus
Ich bin task 5 ( von insgesamt 7 )
pegasus
Ich bin task 6 ( von insgesamt 7 )
pegasus
Ich bin task 2 ( von insgesamt 7 )
pegasus