1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
#include "mpi.h" + tous les autres #include
#define ROOT 0 /* le noeud maitre est le 0 */
/**********************************************
* *
* MPI environment *
* *
***********************************************/
int rank; /* rank of process */
int nbprocs; /* number of process */
int sender; /* rank of sender */
int dest; /* rank of receiver */
int namelen; /* variable for the processor name */
char processor_name[MPI_MAX_PROCESSOR_NAME]; /* processor name */
MPI_Status status; /* return status for receive */
int tag; /* tag for message */
/* initialize the MPI execution environment */
int mpiinit=MPI_Init(&argc,&argv);
if(mpiinit!=MPI_SUCCESS) ERROR("Initialisation of MPI");
/* determine the rank of the calling process in the communicator */
MPI_Comm_rank(MPI_COMM_WORLD,&rank);
/* determine the size of the group associated with a communicator */
MPI_Comm_size(MPI_COMM_WORLD,&nbprocs);
if(nbprocs<1) ERROR("number of processors must be greather or equal to 1");
/* determine the processor name */
MPI_Get_processor_name(processor_name,&namelen); |
Partager