40 if (mpi->
rank && xg) {
41 fprintf(stderr,
"Error in MPIGatherArray1D(): global array exists on non-root processors (rank %d).\n",
45 if ((!mpi->
rank) && (!xg)) {
46 fprintf(stderr,
"Error in MPIGatherArray1D(): global array is not allocated on root processor.\n");
51 double *buffer = (
double*) calloc (N_local,
sizeof(
double));
59 for (proc = 0; proc < mpi->
nproc; proc++) {
64 MPI_Recv(&is,1,MPI_INT,proc,1442,mpi->
world,&status);
65 MPI_Recv(&ie,1,MPI_INT,proc,1443,mpi->
world,&status);
67 }
else { is = istart; ie = iend; }
71 double *recvbuf = (
double*) calloc (size,
sizeof(
double));
72 MPI_Recv(recvbuf,size,MPI_DOUBLE,proc,1916,mpi->
world,&status);
82 MPI_Send(&istart,1 ,MPI_INT ,0,1442,mpi->
world);
83 MPI_Send(&iend ,1 ,MPI_INT ,0,1443,mpi->
world);
84 MPI_Send(buffer ,N_local,MPI_DOUBLE,0,1916,mpi->
world);
MPI related function definitions.
Some basic definitions and macros.
int MPIGatherArray1D(void *m, double *xg, double *x, int istart, int iend, int N_local, int ghosts)
Structure of MPI-related variables.
#define _ArrayCopy1D_(x, y, size)
Contains macros and function definitions for common array operations.