I defined an array of size 8 and type MPI_INTEGER in C, using the code below:
/*=================================================================
C example
=================================================================*/
#include <stdio.h>
#include "mpi.h"
int main(int argc, char** argv){
MPI_FLOAT itype[8];
int nproc;
int iproc;
MPI_Comm icomm;
MPI_Request req;
MPI_Status status;
MPI_Init(&argc,&argv);
icomm = MPI_COMM_WORLD;
MPI_Comm_rank(icomm,&iproc);
MPI_Comm_size(icomm,&nproc);
itype[0] = MPI_FLOAT;
itype[1] = MPI_FLOAT;
itype[2] = MPI_FLOAT;
itype[3] = MPI_FLOAT;
itype[4] = MPI_FLOAT;
itype[5] = MPI_FLOAT;
itype[6] = MPI_FLOAT;
itype[7] = MPI_UB;
MPI_Finalize();
}
and I received the following errors:
type_derived_struct.c(18): error: expected a ";"
MPI_FLOAT itype[8];
^
type_derived_struct.c(93): error: identifier "itype" is undefined
itype[0] = MPI_FLOAT;
I am using intel openmpi. Thank you!
You want
MPI_Datatypeis the type ofMPI_FLOAT(andMPI_INT, etc.)