Professional Documents
Culture Documents
Using MPI
Nick Maclaren
Computing Service
May 2008
Interfaces/Fortran
Interfaces/C
Interfaces/C++
USE double
USE mpi
IMPLICIT NONE
USE double
USE mpi
IMPLICIT NONE
INTEGER :: error
#include "mpi.h"
USE double
USE mpi
IMPLICIT NONE
#include "mpi.h"
Fortran example:
C++ example:
int started , stopped ;
started = MPI::Is---initialized ( ) ;
stopped = MPI::Is---finalized ( ) ;
Fortran example:
C++ example:
int nprocs , myrank ;
nprocs = MPI::COMM---WORLD.Get---size ( ) ;
myrank = MPI::COMM---WORLD.Get---rank ( ) ;
Fortran example:
C++ example:
char procname [ MPI::MAX---PROCESSOR---NAME ] ;
int namelen ;
MPI::Get---processor---name ( procname , namelen ) ;
C:
double now ;
now = MPI---Wtime ( ) ;
C++:
double now ;
now = MPI::Wtime ( ) ;
C example:
int error ;
error = MPI---Barrier ( MPI---COMM---WORLD ) ;
C++ example:
MPI::COMM---WORLD.Barrier ( ) ;
C:
int error ;
error = MPI---Abort ( MPI---COMM---WORLD ,
<failure code> ) ;
C++:
MPI::COMM---WORLD.Abort ( <failure code> ) ;
C++:
/usr/local/OPENMPI/include/openmpi/ompi/mpi/cxx/comm---inln.h:...
warning: unused parameter ’...’
Regrettably, there are quite a lot of these
C:
/usr/local/OPENMPI/include/mpi.h:220: warning:
ISO C90 does not support ’long long’