Changeset 1365


Ignore:
Timestamp:
12/07/17 16:56:23 (4 years ago)
Author:
yushan
Message:

unify type : MPI_Datatype MPI_Aint

Location:
XIOS/dev/branch_openmp
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_openmp/extern/src_ep_dev/ep_declaration.cpp

    r1362 r1365  
    8787extern ::MPI_Info MPI_INFO_NULL_STD; 
    8888 
    89 ep_lib::MPI_Datatype MPI_INT = MPI_INT_STD; 
    90 ep_lib::MPI_Datatype MPI_FLOAT = MPI_FLOAT_STD; 
    91 ep_lib::MPI_Datatype MPI_DOUBLE = MPI_DOUBLE_STD; 
    92 ep_lib::MPI_Datatype MPI_CHAR = MPI_CHAR_STD; 
    93 ep_lib::MPI_Datatype MPI_LONG = MPI_LONG_STD; 
    94 ep_lib::MPI_Datatype MPI_UNSIGNED_LONG = MPI_UNSIGNED_LONG_STD; 
    95 ep_lib::MPI_Datatype MPI_UNSIGNED_CHAR = MPI_UNSIGNED_CHAR_STD; 
     89ep_lib::MPI_Datatype MPI_INT = &MPI_INT_STD; 
     90ep_lib::MPI_Datatype MPI_FLOAT = &MPI_FLOAT_STD; 
     91ep_lib::MPI_Datatype MPI_DOUBLE = &MPI_DOUBLE_STD; 
     92ep_lib::MPI_Datatype MPI_CHAR = &MPI_CHAR_STD; 
     93ep_lib::MPI_Datatype MPI_LONG = &MPI_LONG_STD; 
     94ep_lib::MPI_Datatype MPI_UNSIGNED_LONG = &MPI_UNSIGNED_LONG_STD; 
     95ep_lib::MPI_Datatype MPI_UNSIGNED_CHAR = &MPI_UNSIGNED_CHAR_STD; 
    9696 
    9797ep_lib::MPI_Op MPI_SUM = MPI_SUM_STD; 
  • XIOS/dev/branch_openmp/extern/src_ep_dev/ep_gather.cpp

    r1295 r1365  
    9696        displs[i] = displs[i-1] + recvcounts[i-1]; 
    9797 
    98       ::MPI_Gatherv(local_recvbuf, sendcount*num_ep, sendtype, tmp_recvbuf, recvcounts.data(), displs.data(), recvtype, root_mpi_rank, to_mpi_comm(comm.mpi_comm)); 
     98      ::MPI_Gatherv(local_recvbuf, sendcount*num_ep, to_mpi_type(sendtype), tmp_recvbuf, recvcounts.data(), displs.data(), to_mpi_type(recvtype), root_mpi_rank, to_mpi_comm(comm.mpi_comm)); 
    9999    }    
    100100 
  • XIOS/dev/branch_openmp/extern/src_ep_dev/ep_gatherv.cpp

    r1354 r1365  
    133133 
    134134 
    135       ::MPI_Gatherv(local_recvbuf, sendcount*num_ep, sendtype, tmp_recvbuf, mpi_recvcounts.data(), mpi_displs.data(), recvtype, root_mpi_rank, to_mpi_comm(comm.mpi_comm)); 
     135      ::MPI_Gatherv(local_recvbuf, sendcount*num_ep, to_mpi_type(sendtype), tmp_recvbuf, mpi_recvcounts.data(), mpi_displs.data(), to_mpi_type(recvtype), root_mpi_rank, to_mpi_comm(comm.mpi_comm)); 
    136136    }    
    137137 
  • XIOS/dev/branch_openmp/extern/src_ep_dev/ep_intercomm_kernel.cpp

    r1354 r1365  
    157157      } 
    158158 
    159       ::MPI_Bcast(recv_buf.data(), 3*size_info[1], MPI_INT, local_comm.rank_map->at(local_leader).second, local_mpi_comm); 
     159      ::MPI_Bcast(recv_buf.data(), 3*size_info[1], to_mpi_type(MPI_INT), local_comm.rank_map->at(local_leader).second, local_mpi_comm); 
    160160 
    161161      std::copy ( recv_buf.data(), recv_buf.data() + size_info[1], rank_info[2].begin() ); 
     
    281281      } 
    282282 
    283       ::MPI_Bcast(&size_info[2], 2, MPI_INT, local_comm.rank_map->at(local_leader).second, local_mpi_comm); 
     283      ::MPI_Bcast(&size_info[2], 2, to_mpi_type(MPI_INT), local_comm.rank_map->at(local_leader).second, local_mpi_comm); 
    284284 
    285285      new_rank_info[2].resize(size_info[3]); 
  • XIOS/dev/branch_openmp/extern/src_ep_dev/ep_lib.cpp

    r1362 r1365  
    7676 
    7777    ::MPI_Status *mpi_status = static_cast< ::MPI_Status* >(status->mpi_status); 
    78     ::MPI_Datatype mpi_datatype = static_cast< ::MPI_Datatype >(datatype); 
    79  
    80     ::MPI_Get_count(mpi_status, mpi_datatype, count); 
     78    ::MPI_Datatype *mpi_datatype = static_cast< ::MPI_Datatype*>(datatype); 
     79 
     80    ::MPI_Get_count(mpi_status, *mpi_datatype, count); 
    8181  } 
    8282 
     
    9393    ::MPI_Aint datasize, intsize, charsize, lb; 
    9494     
    95     ::MPI_Type_get_extent(static_cast< ::MPI_Datatype>(datatype), &lb, &datasize); 
    96     ::MPI_Type_get_extent(static_cast< ::MPI_Datatype> (MPI_CHAR), &lb, &intsize); 
     95    ::MPI_Type_get_extent(*(static_cast< ::MPI_Datatype*>(datatype)), &lb, &datasize); 
     96    ::MPI_Type_get_extent(*(static_cast< ::MPI_Datatype*>(MPI_CHAR)), &lb, &intsize); 
    9797 
    9898    int_count = count * datasize / intsize ; 
     
    125125    ::MPI_Aint datasize, intsize, charsize, lb; 
    126126     
    127     ::MPI_Type_get_extent(static_cast< ::MPI_Datatype>(datatype), &lb, &datasize); 
    128     ::MPI_Type_get_extent(static_cast< ::MPI_Datatype> (MPI_CHAR), &lb, &intsize); 
     127    ::MPI_Type_get_extent(*(static_cast< ::MPI_Datatype*>(datatype)), &lb, &datasize); 
     128    ::MPI_Type_get_extent(*(static_cast< ::MPI_Datatype*>(MPI_CHAR)), &lb, &intsize); 
    129129 
    130130    int_count = count * datasize / intsize ; 
     
    238238MPI_Datatype to_mpi_type(ep_lib::MPI_Datatype type) 
    239239{ 
    240   return static_cast< MPI_Datatype >(type); 
     240  return *static_cast< MPI_Datatype* >(type); 
    241241} 
    242242 
  • XIOS/dev/branch_openmp/extern/src_ep_dev/ep_lib.hpp

    r1356 r1365  
    1212{ 
    1313//#ifdef _intelmpi 
    14   typedef int MPI_Datatype; 
     14  typedef void* MPI_Datatype; 
    1515  typedef int MPI_Op; 
    1616//  #define EP_ANY_SOURCE -2  
  • XIOS/dev/branch_openmp/extern/src_ep_dev/ep_lib_collective.hpp

    r1295 r1365  
    55{ 
    66  #ifdef _intelmpi 
    7   typedef int MPI_Datatype; 
     7  typedef void* MPI_Datatype; 
    88  typedef int MPI_Op; 
    99  #elif _openmpi 
  • XIOS/dev/branch_openmp/extern/src_ep_dev/ep_lib_intercomm.hpp

    r1356 r1365  
    55{ 
    66  #ifdef _intelmpi 
    7   typedef int MPI_Datatype; 
     7  typedef void* MPI_Datatype; 
    88  typedef int MPI_Op; 
    99  #elif _openmpi 
  • XIOS/dev/branch_openmp/extern/src_ep_dev/ep_lib_local.hpp

    r1295 r1365  
    55{ 
    66  #ifdef _intelmpi 
    7   typedef int MPI_Datatype; 
     7  typedef void* MPI_Datatype; 
    88  typedef int MPI_Op; 
    99  #elif _openmpi 
  • XIOS/dev/branch_openmp/extern/src_ep_dev/ep_memory.cpp

    r1362 r1365  
    1010  int MPI_Alloc_mem(MPI_Aint size, MPI_Info info, void *baseptr) 
    1111  { 
    12     ::MPI_Alloc_mem(size.mpi_aint, *(static_cast< ::MPI_Info*>(info.mpi_info)), baseptr); 
     12    ::MPI_Alloc_mem(*(static_cast< ::MPI_Aint*>(size.mpi_aint)), *(static_cast< ::MPI_Info*>(info.mpi_info)), baseptr); 
    1313    //::MPI_Alloc_mem(size.mpi_aint, MPI_INFO_NULL_STD, baseptr); 
    1414    return 0; 
  • XIOS/dev/branch_openmp/extern/src_ep_dev/ep_reduce.cpp

    r1295 r1365  
    241241    ::MPI_Aint datasize, lb; 
    242242 
    243     ::MPI_Type_get_extent(static_cast< ::MPI_Datatype>(datatype), &lb, &datasize); 
     243    ::MPI_Type_get_extent(*(static_cast< ::MPI_Datatype*>(datatype)), &lb, &datasize); 
    244244 
    245245    bool is_master = (ep_rank_loc==0 && mpi_rank != root_mpi_rank ) || ep_rank == root; 
  • XIOS/dev/branch_openmp/extern/src_ep_dev/ep_reduce_scatter.cpp

    r1287 r1365  
    3535    ::MPI_Aint datasize, lb; 
    3636 
    37     ::MPI_Type_get_extent(static_cast< ::MPI_Datatype>(datatype), &lb, &datasize); 
     37    ::MPI_Type_get_extent(*(static_cast< ::MPI_Datatype*>(datatype)), &lb, &datasize); 
    3838 
    3939    bool is_master = ep_rank_loc==0; 
  • XIOS/dev/branch_openmp/extern/src_ep_dev/ep_scatter.cpp

    r1295 r1365  
    9393        displs[i] = displs[i-1] + recvcounts[i-1]; 
    9494 
    95       ::MPI_Gatherv(local_ranks.data(), num_ep, MPI_INT, ranks.data(), recvcounts.data(), displs.data(), MPI_INT, root_mpi_rank, to_mpi_comm(comm.mpi_comm)); 
     95      ::MPI_Gatherv(local_ranks.data(), num_ep, to_mpi_type(MPI_INT), ranks.data(), recvcounts.data(), displs.data(), to_mpi_type(MPI_INT), root_mpi_rank, to_mpi_comm(comm.mpi_comm)); 
    9696    } 
    9797 
  • XIOS/dev/branch_openmp/extern/src_ep_dev/ep_scatterv.cpp

    r1295 r1365  
    9696        my_displs[i] = my_displs[i-1] + recvcounts[i-1]; 
    9797 
    98       ::MPI_Gatherv(local_ranks.data(), num_ep, MPI_INT, ranks.data(), recvcounts.data(), my_displs.data(), MPI_INT, root_mpi_rank, to_mpi_comm(comm.mpi_comm)); 
     98      ::MPI_Gatherv(local_ranks.data(), num_ep, to_mpi_type(MPI_INT), ranks.data(), recvcounts.data(), my_displs.data(), to_mpi_type(MPI_INT), root_mpi_rank, to_mpi_comm(comm.mpi_comm)); 
    9999    } 
    100100 
  • XIOS/dev/branch_openmp/extern/src_ep_dev/ep_type.cpp

    r1362 r1365  
    6666//    *(static_cast< ::MPI_Request*>(mpi_request)) = *(static_cast< ::MPI_Request*>(request)); 
    6767//  } 
    68  
     68  MPI_Aint::MPI_Aint(void* aint) 
     69  { 
     70    mpi_aint = new ::MPI_Aint; 
     71    *(static_cast< ::MPI_Aint*>(mpi_aint)) = *(static_cast< ::MPI_Aint*>(aint)); 
     72  } 
    6973 
    7074  bool ep_communicator::operator == (ep_communicator right) 
  • XIOS/dev/branch_openmp/extern/src_ep_dev/ep_type.hpp

    r1362 r1365  
    5757    public: 
    5858 
    59       int ep_datatype; 
     59      void* ep_datatype; 
    6060      int ep_src; 
    6161      int ep_tag; 
     
    237237      int ep_src; 
    238238      int ep_tag; 
    239       int ep_datatype; 
     239      void* ep_datatype; 
    240240 
    241241      MPI_Comm comm;    //! EP communicator related to the communication 
     
    252252    public: 
    253253 
    254     unsigned long mpi_aint; 
     254    void* mpi_aint; 
    255255 
    256256    MPI_Aint() {} 
    257     MPI_Aint(int a): mpi_aint(a) {} 
     257    MPI_Aint(void* aint); 
     258    //MPI_Aint(int a): mpi_aint(a) {} 
    258259  }; 
    259260 
  • XIOS/dev/branch_openmp/src/client_server_mapping.cpp

    r1328 r1365  
    88 */ 
    99#include "client_server_mapping.hpp" 
     10 
    1011using namespace ep_lib; 
    1112 
  • XIOS/dev/branch_openmp/src/event_scheduler.cpp

    r1328 r1365  
    22#include "xios_spl.hpp" 
    33#include "mpi.hpp" 
     4 
    45using namespace ep_lib; 
    56 
  • XIOS/dev/branch_openmp/src/interface/c/oasis_cinterface.cpp

    r1328 r1365  
    2626     
    2727    fxios_oasis_get_localcomm(&f_comm) ; 
    28     comm=EP_Comm_f2c(f_comm.mpi_fint) ; 
     28    //comm=EP_Comm_f2c(f_comm.mpi_fint) ; 
    2929  } 
    3030  
     
    3434     
    3535    fxios_oasis_get_intracomm(&f_comm,server_id.data(),server_id.size()) ; 
    36     comm_client_server=EP_Comm_f2c(f_comm.mpi_fint) ; 
     36    //comm_client_server=EP_Comm_f2c(f_comm.mpi_fint) ; 
    3737  } 
    3838  
     
    4242     
    4343    fxios_oasis_get_intercomm(&f_comm,server_id.data(),server_id.size()) ; 
    44     comm_client_server=EP_Comm_f2c(f_comm.mpi_fint) ; 
     44    //comm_client_server=EP_Comm_f2c(f_comm.mpi_fint) ; 
    4545  } 
    4646} 
Note: See TracChangeset for help on using the changeset viewer.