I'm new to mpi and I'm testing out MPI_Scatterv to use in a different program. My test code for MPI_Scatterv is:
#include <stdio.h>
#include "mpi.h"
int main(int argc,char *argv[])
{
int a[8]={1,2,3,4,5,6,7,8};
int rcounts[4]={2,2,2,2};
int disp[4]={0,2,4,6};
int b[8]={0,0,0,0,0,0,0,0};
int procid;
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD,&procid);
MPI_Scatterv(&a, &rcounts, 0, MPI_INT, &b, 100, MPI_INT, 0, MPI_COMM_WORLD);
printf("%d",b[0]);
MPI_Finalize();
return 0;
}
I'm getting the following warnings when compiling:
./examples/Scatterv.c: In function ‘main’:
./examples/Scatterv.c:15:2: warning: passing argument 2 of ‘MPI_Scatterv’ from
incompatible pointer type [enabled by default]
/home/tarek/mpich-install/include/mpi.h:941:5: note: expected ‘const int *’ but
argument is of type ‘int (*)[4]’
I'm getting the following error when running:
./examples/Scatterv.c: In function ‘main’:
./examples/Scatterv.c:15:2: warning: passing argument 2 of ‘MPI_Scatterv’ from
incompatible pointer type [enabled by default]
/home/tarek/mpich-install/include/mpi.h:941:5: note: expected ‘const int *’ but
argument is of type ‘int (*)[4]’
Any idea what's the problem?