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

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

bug fixed in MPI_Gather(v)

File size: 705 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
20    for(int i=0; i<ep_size; i++)
21    {
22      ep_lib::MPI_Gather(sendbuf+i*sendcount*typesize, sendcount, sendtype, recvbuf, recvcount, recvtype, i, comm);
23    }
24   
25
26    return 0;
27  }
28
29}
30
31
Note: See TracBrowser for help on using the repository browser.