188
K. Tsugane et al.
Figures 5 and 6 show the particle data movement using MPI and the corresponding the coarray notation in GTC-P, respectively. In the exchange of coarray
notation for particle data movement, it communicates the number of particles and
the particle data, i.e., nsendright and sendright, with the adjacent process
on the neighbor to the right. In addition, Figs. 7 and 8 show the exchange of grid
points using MPI and the corresponding coarray notation in GTC-P, respectively. In
the example of the coarray notation for the exchange of grid points, after copying
a value to a one-dimensional array, i.e., sendr or Xsendr, it communicates with
the adjacent process on the neighbor to the right. Because the coarray notation is
non-blocking communication, xmp_sync_image on the sixth line of Fig. 6 and
the seventh line of Fig. 8 are required to guarantee that communication has been
completed between two processes, in this case, the neighboring (right_pe) and
current processes.
1 /* send # of particles to right neighbor and recv from left neighbor */
2 MPI_Sendrecv(&nsendright, 1, MPI_INT, right_pe, sendtag,
3
&nrecvleft, 1, MPI_INT, left_pe, recvtag, comm, &status);
4 /* send particles to right neighbor and recv from left neighbor */
5 MPI_Sendrecv(sendright, nsendright, MPI_DOUBLE, right_pe, sendtag,
6
recvleft, nrecvleft, MPI_DOUBLE, left_pe, recvtag, comm, status);
Fig. 5 Particle data movement using MPI point-to-point communication in GTC-P
1 /* send # of particles to right neighbor */
2 nrecvleft:[right_pe] = nsendright;
3 /* send particles to right neighbor */
4 recvleft[0:nsendright]:[right_pe] = sendright[0:nsendright];
5 /* synchronization */
6 xmp_sync_image(right_pe, NULL);
Fig. 6 Particle data movement using the coarray notation in GTC-P
1 double *sendr, *recvl;
2
3 for(i=0;i
4 sendr[i]=phitmp[i*(mzeta+1)+mzeta];
5
6 MPI_Sendrecv(sendr,nloc_over,MPI_DOUBLE,right_pe,
7
isendtag,recvl,nloc_over,MPI_DOUBLE,left_pe,
8
irecvtag,toroidal_comm,&istatus);
Fig. 7 Exchange of grid points using MPI point-to-point communication in GTC-P
K. Tsugane et al.
Figures 5 and 6 show the particle data movement using MPI and the corresponding the coarray notation in GTC-P, respectively. In the exchange of coarray
notation for particle data movement, it communicates the number of particles and
the particle data, i.e., nsendright and sendright, with the adjacent process
on the neighbor to the right. In addition, Figs. 7 and 8 show the exchange of grid
points using MPI and the corresponding coarray notation in GTC-P, respectively. In
the example of the coarray notation for the exchange of grid points, after copying
a value to a one-dimensional array, i.e., sendr or Xsendr, it communicates with
the adjacent process on the neighbor to the right. Because the coarray notation is
non-blocking communication, xmp_sync_image on the sixth line of Fig. 6 and
the seventh line of Fig. 8 are required to guarantee that communication has been
completed between two processes, in this case, the neighboring (right_pe) and
current processes.
1 /* send # of particles to right neighbor and recv from left neighbor */
2 MPI_Sendrecv(&nsendright, 1, MPI_INT, right_pe, sendtag,
3
&nrecvleft, 1, MPI_INT, left_pe, recvtag, comm, &status);
4 /* send particles to right neighbor and recv from left neighbor */
5 MPI_Sendrecv(sendright, nsendright, MPI_DOUBLE, right_pe, sendtag,
6
recvleft, nrecvleft, MPI_DOUBLE, left_pe, recvtag, comm, status);
Fig. 5 Particle data movement using MPI point-to-point communication in GTC-P
1 /* send # of particles to right neighbor */
2 nrecvleft:[right_pe] = nsendright;
3 /* send particles to right neighbor */
4 recvleft[0:nsendright]:[right_pe] = sendright[0:nsendright];
5 /* synchronization */
6 xmp_sync_image(right_pe, NULL);
Fig. 6 Particle data movement using the coarray notation in GTC-P
1 double *sendr, *recvl;
2
3 for(i=0;i
5
6 MPI_Sendrecv(sendr,nloc_over,MPI_DOUBLE,right_pe,
7
isendtag,recvl,nloc_over,MPI_DOUBLE,left_pe,
8
irecvtag,toroidal_comm,&istatus);
Fig. 7 Exchange of grid points using MPI point-to-point communication in GTC-P
