source: XIOS/dev/branch_yushan_merged/extern/src_ep_dev/ep_alltoall.cpp @ 1146

Last change on this file since 1146 was 1146, checked in by yushan, 7 years ago

save modif

File size: 687 bytes
Line 
1#include "ep_lib.hpp"
2#include <mpi.h>
3//#include "ep_declaration.hpp"
4
5namespace ep_lib
6{
7
8
9
10  int MPI_Alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm)
11  {
12    assert(static_cast< ::MPI_Datatype>(sendtype) == static_cast< ::MPI_Datatype>(recvtype));
13    ::MPI_Aint typesize, llb;
14    ::MPI_Type_get_extent(static_cast< ::MPI_Datatype>(sendtype), &llb, &typesize);
15   
16    int ep_size;
17    MPI_Comm_size(comm, &ep_size);
18
19    for(int i=0; i<ep_size; i++)
20    {
21      MPI_Gather(sendbuf+i*sendcount*typesize, sendcount, sendtype, recvbuf, recvcount, recvtype, i, comm);
22    }
23
24    return 0;
25  }
26
27}
28
29
Note: See TracBrowser for help on using the repository browser.