Ignore:
Timestamp:
02/17/17 17:55:37 (7 years ago)
Author:
yushan
Message:

ep_lib namespace specified when netcdf involved

Location:
XIOS/dev/branch_yushan/extern
Files:
35 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_yushan/extern/remap/src/mapper.cpp

    r923 r1053  
    1212 
    1313#include "mapper.hpp" 
     14 
    1415 
    1516namespace sphereRemap { 
  • XIOS/dev/branch_yushan/extern/remap/src/mapper.hpp

    r844 r1053  
    33#include "parallel_tree.hpp" 
    44#include "mpi.hpp" 
     5 
     6#ifdef _usingEP 
     7#include "ep_declaration.hpp" 
     8#endif 
    59 
    610namespace sphereRemap { 
     
    1822{ 
    1923public: 
    20        Mapper(MPI_Comm comm=MPI_COMM_WORLD) : communicator(comm), verbose(SILENT), neighbourElements(NULL), sstree(comm) {} 
     24       Mapper(ep_lib::MPI_Comm comm=MPI_COMM_WORLD) : communicator(comm), verbose(SILENT), neighbourElements(NULL), sstree(comm) {} 
    2125       ~Mapper(); 
    2226       void setVerbosity(verbosity v) {verbose=v ;} 
     
    6771 
    6872       CParallelTree sstree; 
    69        MPI_Comm communicator ; 
     73       ep_lib::MPI_Comm communicator ; 
    7074       std::vector<Elt>  sourceElements ; 
    7175       std::vector<Node> sourceMesh ; 
  • XIOS/dev/branch_yushan/extern/remap/src/mpi_routing.cpp

    r694 r1053  
    55#include "timerRemap.hpp" 
    66#include <iostream> 
     7#ifdef _usingEP 
     8#include "ep_declaration.hpp" 
     9#endif 
    710 
    811namespace sphereRemap { 
     
    122125        CTimer::get("CMPIRouting::init(reduce_scatter)").print(); 
    123126 
    124         MPI_Alloc_mem(nbTarget *sizeof(int), MPI_INFO_NULL, &targetRank); 
    125         MPI_Alloc_mem(nbSource *sizeof(int), MPI_INFO_NULL, &sourceRank); 
     127        MPI_Info info_null; 
     128 
     129        MPI_Alloc_mem(nbTarget *sizeof(int), info_null, &targetRank); 
     130        MPI_Alloc_mem(nbSource *sizeof(int), info_null, &sourceRank); 
    126131 
    127132        targetRankToIndex = new int[mpiSize]; 
  • XIOS/dev/branch_yushan/extern/remap/src/parallel_tree.hpp

    r694 r1053  
    66#include "mpi_cascade.hpp" 
    77#include "mpi.hpp" 
     8#ifdef _usingEP 
     9#include "ep_declaration.hpp" 
     10#endif 
    811 
    912namespace sphereRemap { 
     
    1215{ 
    1316public: 
    14         CParallelTree(MPI_Comm comm); 
     17        CParallelTree(ep_lib::MPI_Comm comm); 
    1518        ~CParallelTree(); 
    1619 
     
    3437        vector<CSampleTree> treeCascade; // first for sample tree, then for routing tree 
    3538        CMPICascade cascade; 
    36   MPI_Comm communicator ; 
     39  ep_lib::MPI_Comm communicator ; 
    3740 
    3841}; 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_alltoall.cpp

    r1037 r1053  
    1111  { 
    1212    ::MPI_Aint typesize, llb; 
    13     ::MPI_Type_get_extent(sendtype, &llb, &typesize); 
     13    ::MPI_Type_get_extent(static_cast< ::MPI_Datatype>(sendtype), &llb, &typesize); 
    1414 
    1515    for(int i=0; i<comm.ep_comm_ptr->size_rank_info[0].second; i++) 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_declaration.cpp

    r1037 r1053  
    2121#undef MPI_COMM_NULL 
    2222 
     23#undef MPI_STATUS_IGNORE 
     24//#undef MPI_INFO_NULL 
     25#undef MPI_REQUEST_NULL 
     26 
     27#ifdef _openmpi 
     28//#undef MPI_Fint 
     29#endif 
     30 
    2331// _STD defined in ep_type.cpp 
    2432 
     
    3846extern ::MPI_Comm MPI_COMM_NULL_STD; 
    3947 
     48extern ::MPI_Status MPI_STATUS_IGNORE_STD; 
     49//extern ::MPI_Info MPI_INFO_NULL_STD; 
     50extern ::MPI_Request MPI_REQUEST_NULL_STD; 
     51 
    4052ep_lib::MPI_Datatype MPI_INT = MPI_INT_STD; 
    4153ep_lib::MPI_Datatype MPI_FLOAT = MPI_FLOAT_STD; 
     
    5365ep_lib::MPI_Comm MPI_COMM_NULL(MPI_COMM_NULL_STD); 
    5466 
     67//ep_lib::MPI_Info MPI_INFO_NULL(MPI_INFO_NULL_STD); 
     68ep_lib::MPI_Request MPI_REQUEST_NULL(MPI_REQUEST_NULL_STD); 
     69 
     70//ep_lib::MPI_Status MPI_STATUS_IGNORE_STD = MPI_STATUS_IGNORE_STD; 
     71 
    5572//ep_lib::MPI_Comm EP_COMM_WORLD; 
    5673//ep_lib::MPI_Comm EP_COMM_NULL; 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_declaration.hpp

    r1037 r1053  
    1717extern ::MPI_Comm MPI_COMM_NULL_STD; 
    1818 
     19extern ::MPI_Status MPI_STATUS_IGNORE_STD; 
     20//extern ::MPI_Info MPI_INFO_NULL_STD; 
     21extern ::MPI_Request MPI_REQUEST_NULL_STD; 
     22 
    1923#undef MPI_INT 
    2024#undef MPI_FLOAT 
     
    3135#undef MPI_COMM_WORLD 
    3236#undef MPI_COMM_NULL 
     37 
     38//#undef MPI_INFO_NULL 
     39#undef MPI_REQUEST_NULL 
     40 
     41#ifdef _openmpi 
     42//#undef MPI_Fint 
     43#endif 
     44 
     45#undef MPI_STATUS_IGNORE 
    3346 
    3447extern ep_lib::MPI_Datatype MPI_INT; 
     
    4760extern ep_lib::MPI_Comm MPI_COMM_NULL; 
    4861 
    49  
    50  
     62extern ep_lib::MPI_Status MPI_STATUS_IGNORE; 
     63//extern ep_lib::MPI_Info MPI_INFO_NULL; 
     64extern ep_lib::MPI_Request MPI_REQUEST_NULL; 
    5165 
    5266#endif // EP_DECLARATION_HPP_INCLUDED 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_exscan.cpp

    r1037 r1053  
    435435    if(!comm.is_ep) 
    436436    { 
    437       ::MPI_Exscan(sendbuf, recvbuf, count, static_cast< ::MPI_Datatype>(datatype), 
     437      ::MPI_Exscan(const_cast<void*>(sendbuf), recvbuf, count, static_cast< ::MPI_Datatype>(datatype), 
    438438                   static_cast< ::MPI_Op>(op), static_cast< ::MPI_Comm>(comm.mpi_comm)); 
    439439      return 0; 
     
    481481    if(ep_rank_loc == 0) 
    482482    { 
    483       #ifdef _serialized 
    484       #pragma omp critical (_mpi_call) 
    485       #endif // _serialized 
    486483      ::MPI_Exscan(local_sum, mpi_scan_recvbuf, count, static_cast< ::MPI_Datatype>(datatype), static_cast< ::MPI_Op>(op), static_cast< ::MPI_Comm>(comm.mpi_comm)); 
    487484    } 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_finalize.cpp

    r1037 r1053  
    1515    if(id == 0) 
    1616    { 
    17       #ifdef _serialized 
    18       #pragma omp critical (_mpi_call) 
    19       #endif // _serialized 
    2017      ::MPI_Finalize(); 
    2118    } 
     
    3027    { 
    3128      ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm >(comm.mpi_comm); 
    32  
    33       #ifdef _serialized 
    34       #pragma omp critical (_mpi_call) 
    35       #endif // _serialized 
    3629      ::MPI_Abort(mpi_comm, errorcode); 
    3730    } 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_fortran.cpp

    r1037 r1053  
    44#include <map> 
    55#include <utility> 
     6 
     7#ifdef _intelmpi 
    68#undef MPI_Comm_f2c(comm) 
    79#undef MPI_Comm_c2f(comm) 
     10#endif 
    811 
     12#ifdef _openmpi 
     13//#undef MPI_Fint 
     14#endif 
    915 
    1016namespace ep_lib 
    1117{ 
    1218 
     19  int EP_Comm_c2f(MPI_Comm comm) 
     20  { 
     21    Debug("MPI_Comm_c2f"); 
     22    int fint; 
     23    #ifdef _intelmpi 
     24    fint = (::MPI_Fint)(comm.mpi_comm); 
     25    #elif _openmpi 
     26    fint = ::MPI_Comm_c2f(static_cast< ::MPI_Comm>(comm.mpi_comm)); 
     27    #endif 
     28    std::map<std::pair<int, int>, MPI_Comm  > ::iterator it; 
     29     
     30    it = fc_comm_map.find(std::make_pair(fint, omp_get_thread_num())); 
     31    if(it == fc_comm_map.end()) 
     32    { 
     33      fc_comm_map.insert(std::make_pair( std::make_pair( fint, omp_get_thread_num()) , comm)); 
     34      printf("MAP insert: %d, %d, %p\n", fint, omp_get_thread_num(), &comm); 
     35    } 
     36     
     37     
     38    return fint; 
     39     
     40  } 
     41 
     42  MPI_Comm EP_Comm_f2c(int comm) 
     43  { 
     44    Debug("MPI_Comm_f2c"); 
     45     
     46     
     47    std::map<std::pair<int, int>, MPI_Comm  > ::iterator it; 
     48     
     49    it = fc_comm_map.find(std::make_pair(comm, omp_get_thread_num())); 
     50    if(it != fc_comm_map.end()) 
     51    { 
     52      MPI_Comm comm_ptr; 
     53      comm_ptr =  it->second; 
     54      printf("MAP find: %d, %d, %p\n", it->first.first, it->first.second, &comm_ptr); 
     55      return  comm_ptr; 
     56    } 
     57    else 
     58    {       
     59      MPI_Comm return_comm; 
     60      return_comm.mpi_comm = ::MPI_Comm_f2c(comm); 
     61      return return_comm; 
     62    } 
     63  } 
     64 
     65  #ifdef _intelmpi 
    1366 
    1467  MPI_Fint MPI_Comm_c2f(MPI_Comm comm) 
     
    3285     
    3386  } 
     87 
     88   
    3489 
    3590 
     
    57112  } 
    58113 
     114   
     115 
     116  #elif _openmpi 
     117   
     118  int MPI_Comm_c2f(MPI_Comm comm) 
     119  { 
     120    Debug("MPI_Comm_c2f"); 
     121    int fint; 
     122    fint = ::MPI_Comm_c2f(static_cast< ::MPI_Comm>(comm.mpi_comm)); 
     123     
     124    std::map<std::pair<int, int>, MPI_Comm  > ::iterator it; 
     125     
     126    it = fc_comm_map.find(std::make_pair(fint, omp_get_thread_num())); 
     127    if(it == fc_comm_map.end()) 
     128    { 
     129      fc_comm_map.insert(std::make_pair( std::make_pair( fint, omp_get_thread_num()) , comm)); 
     130      printf("MAP insert: %d, %d, %p\n", fint, omp_get_thread_num(), &comm); 
     131    } 
     132     
     133    return fint; 
     134     
     135  } 
     136 
     137  ep_lib::MPI_Comm MPI_Comm_f2c(MPI_Fint comm) 
     138  { 
     139    Debug("MPI_Comm_f2c"); 
     140     
     141     
     142    std::map<std::pair<int, int>, MPI_Comm  > ::iterator it; 
     143     
     144    it = fc_comm_map.find(std::make_pair(comm, omp_get_thread_num())); 
     145    if(it != fc_comm_map.end()) 
     146    { 
     147      MPI_Comm comm_ptr; 
     148      comm_ptr =  it->second; 
     149      printf("MAP find: %d, %d, %p\n", it->first.first, it->first.second, &comm_ptr); 
     150      return  comm_ptr; 
     151    } 
     152    else 
     153    {       
     154      MPI_Comm return_comm; 
     155      return_comm.mpi_comm = (::MPI_Comm)(comm); 
     156      return return_comm; 
     157    } 
     158  } 
     159  #endif 
     160 
    59161} 
    60162 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_free.cpp

    r1037 r1053  
    1010  int MPI_Comm_free(MPI_Comm *comm) 
    1111  { 
    12     //return 0; 
    13      
    14     if(comm == NULL) return 0; 
     12    //if(comm == NULL) return 0; 
    1513 
    1614    MPI_Barrier(*comm); 
     
    1917    if(! comm->is_ep) 
    2018    { 
    21       if(comm->mpi_comm) 
     19      if(comm->mpi_comm != MPI_COMM_NULL_STD) 
    2220      { 
    2321        ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm>(comm->mpi_comm); 
     
    3129    else 
    3230    { 
    33       if(! comm->mpi_comm) return 0; 
     31      if(comm->mpi_comm == MPI_COMM_NULL_STD ) return 0; 
    3432 
    3533      int ep_rank, ep_rank_loc, mpi_rank; 
     
    4745 
    4846      #pragma omp critical (memory_free) 
    49       if(comm->is_intercomm && comm->ep_comm_ptr->intercomm) 
     47      if(comm->is_intercomm && comm->ep_comm_ptr->intercomm != NULL) 
    5048      { 
    5149        if(comm->ep_comm_ptr->intercomm->local_rank_map) comm->ep_comm_ptr->intercomm->local_rank_map->clear(); 
     
    6260 
    6361/* 
    64         if(comm->my_buffer) 
     62        if(comm->my_buffer != NULL) 
    6563        { 
    66           if(comm->my_buffer->buf_int) delete[] comm->my_buffer->buf_int; Debug("buf_int freed\n"); 
    67           if(comm->my_buffer->buf_float) delete[] comm->my_buffer->buf_float; Debug("buf_float freed\n"); 
    68           if(comm->my_buffer->buf_double) delete[] comm->my_buffer->buf_double; Debug("buf_double freed\n"); 
    69           if(comm->my_buffer->buf_long) delete[] comm->my_buffer->buf_long; Debug("buf_long freed\n"); 
    70           if(comm->my_buffer->buf_ulong) delete[] comm->my_buffer->buf_ulong; Debug("buf_ulong freed\n"); 
    71           if(comm->my_buffer->buf_char) delete[] comm->my_buffer->buf_char; Debug("buf_char freed\n"); 
     64          if(comm->my_buffer->buf_int != NULL) delete[] comm->my_buffer->buf_int; Debug("buf_int freed\n"); 
     65          if(comm->my_buffer->buf_float != NULL) delete[] comm->my_buffer->buf_float; Debug("buf_float freed\n"); 
     66          if(comm->my_buffer->buf_double != NULL) delete[] comm->my_buffer->buf_double; Debug("buf_double freed\n"); 
     67          if(comm->my_buffer->buf_long != NULL) delete[] comm->my_buffer->buf_long; Debug("buf_long freed\n"); 
     68          if(comm->my_buffer->buf_ulong != NULL) delete[] comm->my_buffer->buf_ulong; Debug("buf_ulong freed\n"); 
     69          if(comm->my_buffer->buf_char != NULL) delete[] comm->my_buffer->buf_char; Debug("buf_char freed\n"); 
    7270        } 
    7371*/ 
    74         if(comm->ep_barrier) 
     72        if(comm->ep_barrier != NULL) 
    7573        { 
    7674          comm->ep_barrier->~OMPbarrier(); 
     
    7977 
    8078 
    81         if(comm->rank_map) 
     79        if(comm->rank_map != NULL) 
    8280        { 
    8381          comm->rank_map->clear(); 
     
    8684 
    8785 
    88         if(comm->is_intercomm && comm->ep_comm_ptr->intercomm->mpi_inter_comm) 
     86        if(comm->is_intercomm && comm->ep_comm_ptr->intercomm->mpi_inter_comm != MPI_COMM_NULL_STD) 
    8987        { 
    9088          ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm>(comm->ep_comm_ptr->intercomm->mpi_inter_comm); 
    9189 
    9290          ::MPI_Comm_free(&mpi_comm); 
    93           comm->ep_comm_ptr->intercomm->mpi_inter_comm = NULL; 
     91          //comm->ep_comm_ptr->intercomm->mpi_inter_comm = NULL; 
    9492          Debug("mpi_intercomm freed\n"); 
    9593        } 
     
    9997        for(int i=0; i<num_ep; i++) 
    10098        { 
    101           if(comm->ep_comm_ptr->comm_list[i].ep_comm_ptr->message_queue) 
     99          if(comm->ep_comm_ptr->comm_list[i].ep_comm_ptr->message_queue != NULL) 
    102100          { 
    103101            comm->ep_comm_ptr->comm_list[i].ep_comm_ptr->message_queue->clear(); 
     
    105103          } 
    106104 
    107           if(comm->ep_comm_ptr->comm_list[i].ep_comm_ptr) 
     105          if(comm->ep_comm_ptr->comm_list[i].ep_comm_ptr != NULL) 
    108106          { 
    109107            delete comm->ep_comm_ptr->comm_list[i].ep_comm_ptr; 
     
    112110        } 
    113111 
    114         if(comm->mpi_comm) 
     112        if(comm->mpi_comm != MPI_COMM_NULL_STD) 
    115113        { 
    116114          ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm>(comm->mpi_comm); 
    117           #ifdef _serialized 
    118           #pragma omp critical (_mpi_call) 
    119           #endif // _serialized 
    120115          ::MPI_Comm_free(&mpi_comm); 
    121           comm->mpi_comm = NULL; 
     116          //comm->mpi_comm = NULL; 
    122117//          printf("label = %d, mpi_comm freed\n", comm->ep_comm_ptr->comm_label); 
    123118        } 
    124119 
    125        if(comm) {delete[] comm->ep_comm_ptr->comm_list; Debug("comm freed\n");} 
     120       if(comm != NULL) {delete[] comm->ep_comm_ptr->comm_list; Debug("comm freed\n");} 
    126121 
    127122      } 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_gather.cpp

    r1037 r1053  
    320320    if(!comm.is_ep && comm.mpi_comm) 
    321321    { 
    322       #ifdef _serialized 
    323       #pragma omp critical (_mpi_call) 
    324       #endif // _serialized 
    325       ::MPI_Gather(sendbuf, sendcount, static_cast< ::MPI_Datatype>(sendtype), recvbuf, recvcount, static_cast< ::MPI_Datatype>(recvtype), 
     322      ::MPI_Gather(const_cast<void*>(sendbuf), sendcount, static_cast< ::MPI_Datatype>(sendtype), recvbuf, recvcount, static_cast< ::MPI_Datatype>(recvtype), 
    326323                   root, static_cast< ::MPI_Comm>(comm.mpi_comm)); 
    327324      return 0; 
     
    351348 
    352349    ::MPI_Aint datasize, lb; 
    353     #ifdef _serialized 
    354     #pragma omp critical (_mpi_call) 
    355     #endif // _serialized 
     350 
    356351    ::MPI_Type_get_extent(static_cast< ::MPI_Datatype>(datatype), &lb, &datasize); 
    357352 
     
    377372      gatherv_displs = new int[mpi_size]; 
    378373 
    379       #ifdef _serialized 
    380       #pragma omp critical (_mpi_call) 
    381       #endif // _serialized 
     374 
    382375      ::MPI_Allgather(&gatherv_cnt, 1, MPI_INT_STD, gatherv_recvcnt, 1, MPI_INT_STD, static_cast< ::MPI_Comm>(comm.mpi_comm)); 
    383376 
     
    388381      } 
    389382 
    390       #ifdef _serialized 
    391       #pragma omp critical (_mpi_call) 
    392       #endif // _serialized 
     383 
    393384      ::MPI_Gatherv(local_gather_recvbuf, count*num_ep, static_cast< ::MPI_Datatype>(datatype), recvbuf, gatherv_recvcnt, 
    394385                    gatherv_displs, static_cast< ::MPI_Datatype>(datatype), root_mpi_rank, static_cast< ::MPI_Comm>(comm.mpi_comm)); 
     
    442433    if(!comm.is_ep && comm.mpi_comm) 
    443434    { 
    444       #ifdef _serialized 
    445       #pragma omp critical (_mpi_call) 
    446       #endif // _serialized 
    447       ::MPI_Allgather(sendbuf, sendcount, static_cast< ::MPI_Datatype>(sendtype), recvbuf, recvcount, static_cast< ::MPI_Datatype>(recvtype), 
     435      ::MPI_Allgather(const_cast<void*>(sendbuf), sendcount, static_cast< ::MPI_Datatype>(sendtype), recvbuf, recvcount, static_cast< ::MPI_Datatype>(recvtype), 
    448436                      static_cast< ::MPI_Comm>(comm.mpi_comm)); 
    449437      return 0; 
     
    469457 
    470458    ::MPI_Aint datasize, lb; 
    471     #ifdef _serialized 
    472     #pragma omp critical (_mpi_call) 
    473     #endif // _serialized 
     459 
    474460    ::MPI_Type_get_extent(static_cast< ::MPI_Datatype>(datatype), &lb, &datasize); 
    475461 
     
    495481      gatherv_displs = new int[mpi_size]; 
    496482 
    497       #ifdef _serialized 
    498       #pragma omp critical (_mpi_call) 
    499       #endif // _serialized 
    500483      ::MPI_Allgather(&gatherv_cnt, 1, MPI_INT_STD, gatherv_recvcnt, 1, MPI_INT_STD, static_cast< ::MPI_Comm>(comm.mpi_comm)); 
    501484 
     
    506489      } 
    507490 
    508       #ifdef _serialized 
    509       #pragma omp critical (_mpi_call) 
    510       #endif // _serialized 
    511491      ::MPI_Allgatherv(local_gather_recvbuf, count*num_ep, static_cast< ::MPI_Datatype>(datatype), recvbuf, gatherv_recvcnt, 
    512492                    gatherv_displs, static_cast< ::MPI_Datatype>(datatype), static_cast< ::MPI_Comm>(comm.mpi_comm)); 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_gatherv.cpp

    r1037 r1053  
    328328    if(!comm.is_ep && comm.mpi_comm) 
    329329    { 
    330       #ifdef _serialized 
    331       #pragma omp critical (_mpi_call) 
    332       #endif // _serialized 
    333       ::MPI_Gatherv(sendbuf, sendcount, static_cast< ::MPI_Datatype>(sendtype), recvbuf, recvcounts, displs, 
     330      ::MPI_Gatherv(const_cast<void*>(sendbuf), sendcount, static_cast< ::MPI_Datatype>(sendtype), recvbuf, const_cast<int*>(recvcounts), const_cast<int*>(displs), 
    334331                    static_cast< ::MPI_Datatype>(recvtype), root, static_cast< ::MPI_Comm>(comm.mpi_comm)); 
    335332      return 0; 
     
    362359 
    363360    ::MPI_Aint datasize, lb; 
    364     #ifdef _serialized 
    365     #pragma omp critical (_mpi_call) 
    366     #endif // _serialized 
     361 
    367362    ::MPI_Type_get_extent(static_cast< ::MPI_Datatype>(datatype), &lb, &datasize); 
    368363 
     
    395390      //gatherv_displs = new int[mpi_size]; 
    396391 
    397       #ifdef _serialized 
    398       #pragma omp critical (_mpi_call) 
    399       #endif // _serialized 
     392 
    400393      ::MPI_Allgather(&gatherv_cnt, 1, MPI_INT_STD, gatherv_recvcnt, 1, MPI_INT_STD, static_cast< ::MPI_Comm>(comm.mpi_comm)); 
    401394 
     
    406399      } 
    407400 
    408       #ifdef _serialized 
    409       #pragma omp critical (_mpi_call) 
    410       #endif // _serialized 
     401 
    411402      ::MPI_Gatherv(local_gather_recvbuf, gatherv_cnt, static_cast< ::MPI_Datatype>(datatype), recvbuf, gatherv_recvcnt, 
    412403                    gatherv_displs, static_cast< ::MPI_Datatype>(datatype), root_mpi_rank, static_cast< ::MPI_Comm>(comm.mpi_comm)); 
     
    462453    if(!comm.is_ep && comm.mpi_comm) 
    463454    { 
    464       #ifdef _serialized 
    465       #pragma omp critical (_mpi_call) 
    466       #endif // _serialized 
    467455      ::MPI_Allgatherv(sendbuf, sendcount, static_cast< ::MPI_Datatype>(sendtype), recvbuf, recvcounts, displs, 
    468456                       static_cast< ::MPI_Datatype>(recvtype), static_cast< ::MPI_Comm>(comm.mpi_comm)); 
     
    493481 
    494482    ::MPI_Aint datasize, lb; 
    495     #ifdef _serialized 
    496     #pragma omp critical (_mpi_call) 
    497     #endif // _serialized 
     483 
    498484    ::MPI_Type_get_extent(static_cast< ::MPI_Datatype>(datatype), &lb, &datasize); 
    499485 
     
    525511      gatherv_displs = new int[mpi_size]; 
    526512 
    527       #ifdef _serialized 
    528       #pragma omp critical (_mpi_call) 
    529       #endif // _serialized 
    530513      ::MPI_Allgather(&gatherv_cnt, 1, MPI_INT_STD, gatherv_recvcnt, 1, MPI_INT_STD, static_cast< ::MPI_Comm>(comm.mpi_comm)); 
    531514      gatherv_displs[0] = displs[0]; 
     
    534517        gatherv_displs[i] = gatherv_recvcnt[i-1] + gatherv_displs[i-1]; 
    535518      } 
    536       #ifdef _serialized 
    537       #pragma omp critical (_mpi_call) 
    538       #endif // _serialized 
     519 
    539520      ::MPI_Allgatherv(local_gather_recvbuf, gatherv_cnt, static_cast< ::MPI_Datatype>(datatype), recvbuf, gatherv_recvcnt, 
    540521                    gatherv_displs, static_cast< ::MPI_Datatype>(datatype), static_cast< ::MPI_Comm>(comm.mpi_comm)); 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_init.cpp

    r1037 r1053  
    1111  int MPI_Init_thread(int *argc, char*** argv, int required, int*provided) 
    1212  { 
    13     printf("MPI_Init_thread\n"); 
     13    //printf("MPI_Init_thread\n"); 
    1414 
    1515    int id = omp_get_thread_num(); 
     
    2424  int MPI_Init(int *argc, char ***argv) 
    2525  { 
    26     printf("MPI_init called\n"); 
     26    //printf("MPI_init called\n"); 
    2727    int id = omp_get_thread_num(); 
    2828 
     
    3636  int MPI_Initialized(int *flag) 
    3737  { 
    38     printf("MPI_initialized called\n"); 
     38    //printf("MPI_initialized called\n"); 
    3939 
    4040    ::MPI_Initialized(flag); 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_intercomm.cpp

    r1037 r1053  
    143143        if(ep_rank == new_local_leader) 
    144144        { 
    145           #ifdef _serialized 
    146           #pragma omp critical (_mpi_call) 
    147           #endif // _serialized 
    148145          ::MPI_Comm_rank(MPI_COMM_WORLD_STD, &leader_in_world[0]); 
    149146        } 
     
    190187  int MPI_Comm_test_inter(MPI_Comm comm, int *flag) 
    191188  { 
     189    *flag = false; 
    192190    if(comm.is_ep) 
    193191    { 
     
    195193      return 0; 
    196194    }  
    197     else 
     195    else if(comm.mpi_comm != MPI_COMM_NULL_STD) 
    198196    { 
    199197      ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm> (comm.mpi_comm); 
    200       #ifdef _serialized 
    201       #pragma omp critical (_mpi_call) 
    202       #endif 
     198       
    203199      ::MPI_Comm_test_inter(mpi_comm, flag); 
    204200      return 0;   
    205201    } 
     202    return 0; 
    206203  } 
    207204 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_intercomm_kernel.cpp

    r1037 r1053  
    3535    ::MPI_Comm local_mpi_comm = static_cast< ::MPI_Comm>(local_comm.mpi_comm); 
    3636 
    37     #ifdef _serialized 
    38     #pragma omp critical (_mpi_call) 
    39     #endif // _serialized 
    40     { 
    41       ::MPI_Comm_rank(MPI_COMM_WORLD_STD, &rank_in_world); 
    42       ::MPI_Comm_rank(static_cast< ::MPI_Comm>(local_comm.mpi_comm), &rank_in_local_parent); 
    43     } 
     37     
     38    ::MPI_Comm_rank(MPI_COMM_WORLD_STD, &rank_in_world); 
     39    ::MPI_Comm_rank(static_cast< ::MPI_Comm>(local_comm.mpi_comm), &rank_in_local_parent); 
     40     
    4441 
    4542    bool is_proc_master = false; 
     
    8380      send_buf[2] = num_ep; 
    8481 
    85       #ifdef _serialized 
    86       #pragma omp critical (_mpi_call) 
    87       #endif // _serialized 
    8882      ::MPI_Allgather(send_buf.data(), 3, MPI_INT_STD, recv_buf.data(), 3, MPI_INT_STD, local_mpi_comm); 
    8983 
     
    10094        leader_info[1] = remote_leader; 
    10195 
    102         #ifdef _serialized 
    103         #pragma omp critical (_mpi_call) 
    104         #endif // _serialized 
    10596        ::MPI_Comm_rank(static_cast< ::MPI_Comm>(peer_comm.mpi_comm), &rank_in_peer_mpi[0]); 
    10697 
     
    126117      send_buf[4] = rank_in_peer_mpi[1]; 
    127118 
    128       #ifdef _serialized 
    129       #pragma omp critical (_mpi_call) 
    130       #endif // _serialized 
    131119      ::MPI_Bcast(send_buf.data(), 5, MPI_INT_STD, local_comm.rank_map->at(local_leader).second, local_mpi_comm); 
    132120 
     
    156144        MPI_Send(send_buf.data(), 3*size_info[0], MPI_INT_STD, remote_leader, tag, peer_comm); 
    157145        MPI_Recv(recv_buf.data(), 3*size_info[1], MPI_INT_STD, remote_leader, tag, peer_comm, &status); 
    158  
    159       } 
    160  
    161       #ifdef _serialized 
    162       #pragma omp critical (_mpi_call) 
    163       #endif // _serialized 
     146      } 
     147 
    164148      ::MPI_Bcast(recv_buf.data(), 3*size_info[1], MPI_INT_STD, local_comm.rank_map->at(local_leader).second, local_mpi_comm); 
    165149 
     
    283267      } 
    284268 
    285       #ifdef _serialized 
    286       #pragma omp critical (_mpi_call) 
    287       #endif // _serialized 
    288269      ::MPI_Bcast(&size_info[2], 2, MPI_INT_STD, local_comm.rank_map->at(local_leader).second, local_mpi_comm); 
    289270 
     
    307288      } 
    308289 
    309  
    310       #ifdef _serialized 
    311       #pragma omp critical (_mpi_call) 
    312       #endif // _serialized 
    313290      ::MPI_Bcast(recv_buf.data(),   3*size_info[3], MPI_INT_STD, local_comm.rank_map->at(local_leader).second, local_mpi_comm); 
    314291 
     
    330307      ::MPI_Comm intercomm; 
    331308 
    332       #ifdef _serialized 
    333       #pragma omp critical (_mpi_call) 
    334       #endif // _serialized 
    335309      ::MPI_Comm_group(local_mpi_comm, &local_group); 
    336310 
    337       #ifdef _serialized 
    338       #pragma omp critical (_mpi_call) 
    339       #endif // _serialized 
    340311      ::MPI_Group_incl(local_group, size_info[2], new_rank_info[1].data(), &new_group); 
    341312 
    342       #ifdef _serialized 
    343       #pragma omp critical (_mpi_call) 
    344       #endif // _serialized 
    345313      ::MPI_Comm_create(local_mpi_comm, new_group, &new_comm); 
    346314 
     
    349317      if(is_local_leader) 
    350318      { 
    351         #ifdef _serialized 
    352         #pragma omp critical (_mpi_call) 
    353         #endif // _serialized 
    354319        ::MPI_Comm_rank(new_comm, &leader_info[2]); 
    355320      } 
    356321 
    357       #ifdef _serialized 
    358       #pragma omp critical (_mpi_call) 
    359       #endif // _serialized 
    360322      ::MPI_Bcast(&leader_info[2], 1, MPI_INT_STD, local_comm.rank_map->at(local_leader).second, local_mpi_comm); 
    361323 
     
    363325      { 
    364326 
    365         #ifdef _serialized 
    366         #pragma omp critical (_mpi_call) 
    367         #endif // _serialized 
    368327        ::MPI_Barrier(new_comm); 
    369328 
    370         #ifdef _serialized 
    371         #pragma omp critical (_mpi_call) 
    372         #endif // _serialized 
    373329        ::MPI_Intercomm_create(new_comm, leader_info[2], static_cast< ::MPI_Comm>(peer_comm.mpi_comm), rank_in_peer_mpi[1], tag, &intercomm); 
    374330 
    375331        int id; 
    376         #ifdef _serialized 
    377         #pragma omp critical (_mpi_call) 
    378         #endif // _serialized 
     332 
    379333        ::MPI_Comm_rank(new_comm, &id); 
    380334        int my_num_ep = new_ep_info[0][id]; 
     
    604558    int rank_in_peer_mpi[2]; 
    605559 
    606     #ifdef _serialized 
    607     #pragma omp critical (_mpi_call) 
    608     #endif // _serialized 
    609560    ::MPI_Comm_rank(MPI_COMM_WORLD_STD, &rank_in_world); 
    610561 
     
    663614      { 
    664615        ::MPI_Comm mpi_dup; 
    665  
    666         #ifdef _serialized 
    667         #pragma omp critical (_mpi_call) 
    668         #endif // _serialized 
     616         
    669617        ::MPI_Comm_dup(static_cast< ::MPI_Comm>(local_comm.mpi_comm), &mpi_dup); 
    670618 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_intercomm_world.cpp

    r1037 r1053  
    281281        std::copy ( new_ep_info[0].data(),   new_ep_info[0].data()   + size_info[0], send_buf.begin() + 2*size_info[2] ); 
    282282 
    283         MPI_Send(send_buf.data(), 3*size_info[2], MPI_INT_STD, mpi_remote_leader, tag, peer_comm); 
    284         MPI_Recv(recv_buf.data(), 3*size_info[3], MPI_INT_STD, mpi_remote_leader, tag, peer_comm, &mpi_status); 
     283        ::MPI_Send(send_buf.data(), 3*size_info[2], MPI_INT_STD, mpi_remote_leader, tag, peer_comm); 
     284        ::MPI_Recv(recv_buf.data(), 3*size_info[3], MPI_INT_STD, mpi_remote_leader, tag, peer_comm, &mpi_status); 
    285285 
    286286      } 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_lib.hpp

    r1037 r1053  
    2020#endif 
    2121 
     22#ifdef _intelmpi 
    2223  #define MPI_ANY_SOURCE -2  
    2324  #define MPI_ANY_TAG -1  
     25#elif _openmpi 
     26  #define MPI_ANY_SOURCE -1  
     27  #define MPI_ANY_TAG -1  
     28#endif 
    2429 
    2530  int MPI_Init_thread(int* argc, char*** argv, int required, int*provided); 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_lib_fortran.hpp

    r1037 r1053  
    77{ 
    88   
     9  #ifdef _intelmpi 
     10   
     11  MPI_Fint MPI_Comm_c2f(MPI_Comm comm); 
     12  MPI_Comm MPI_Comm_f2c(MPI_Fint comm); 
     13   
     14  #elif _openmpi 
     15   
     16  int MPI_Comm_c2f(MPI_Comm comm); 
     17  ep_lib::MPI_Comm MPI_Comm_f2c(MPI_Fint comm); 
     18   
     19  #endif 
    920 
    10   MPI_Fint MPI_Comm_c2f(MPI_Comm comm); 
    11   //int MPI_Comm_c2f(MPI_Comm comm); 
    12  
    13  
    14   MPI_Comm MPI_Comm_f2c(MPI_Fint comm); 
    15   //void MPI_Comm_f2c(MPI_Fint comm); 
    16  
     21  int EP_Comm_c2f(MPI_Comm comm); 
     22  MPI_Comm EP_Comm_f2c(int comm); 
    1723} 
    1824 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_memory.cpp

    r1037 r1053  
    1010  int MPI_Alloc_mem(MPI_Aint size, MPI_Info info, void *baseptr) 
    1111  { 
    12     #ifdef _serialized 
    13     #pragma omp critical (_mpi_call) 
    14     #endif // _serialized 
    15     ::MPI_Alloc_mem(size.mpi_aint, info.mpi_info, baseptr); 
     12    ::MPI_Alloc_mem(size.mpi_aint, static_cast< ::MPI_Info>(info.mpi_info), baseptr); 
    1613    return 0; 
    1714   } 
     
    1916  int MPI_Alloc_mem(unsigned long size, MPI_Info info, void *baseptr) 
    2017  { 
    21     #ifdef _serialized 
    22     #pragma omp critical (_mpi_call) 
    23     #endif // _serialized 
    24     ::MPI_Alloc_mem(size, info.mpi_info, baseptr); 
     18    ::MPI_Alloc_mem(size, static_cast< ::MPI_Info>(info.mpi_info), baseptr); 
    2519    return 0; 
    26    } 
     20  } 
    2721 
    2822 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_merge.cpp

    r1037 r1053  
    3939    local_mpi_size = inter_comm.ep_comm_ptr->intercomm->local_comm->ep_comm_ptr->size_rank_info[2].second; 
    4040 
     41 
     42    if(local_ep_rank == 0) 
     43    { 
     44      MPI_Status status; 
     45      MPI_Request req_s, req_r; 
     46      MPI_Isend(&local_high, 1, MPI_INT, 0, inter_comm.ep_comm_ptr->intercomm->intercomm_tag, inter_comm, &req_s); 
     47      MPI_Irecv(&remote_high, 1, MPI_INT, 0, inter_comm.ep_comm_ptr->intercomm->intercomm_tag, inter_comm, &req_r); 
     48 
     49      MPI_Wait(&req_s, &status); 
     50      MPI_Wait(&req_r, &status); 
     51    } 
     52 
     53 
     54    MPI_Bcast(&remote_high, 1, MPI_INT, 0, *(inter_comm.ep_comm_ptr->intercomm->local_comm)); 
     55 
     56//    printf("%d, %d, %d, %d\n", local_ep_size, remote_ep_size, local_high, remote_high); 
     57 
     58 
     59    MPI_Comm_dup(inter_comm, newintracomm); 
     60 
     61    int my_ep_rank = local_high<remote_high? local_ep_rank: local_ep_rank+remote_ep_size; 
     62 
     63 
     64    int intra_ep_rank, intra_ep_rank_loc, intra_mpi_rank; 
     65    int intra_ep_size, intra_num_ep, intra_mpi_size; 
     66 
     67    intra_ep_rank = newintracomm->ep_comm_ptr->size_rank_info[0].first; 
     68    intra_ep_rank_loc = newintracomm->ep_comm_ptr->size_rank_info[1].first; 
     69    intra_mpi_rank = newintracomm->ep_comm_ptr->size_rank_info[2].first; 
     70    intra_ep_size = newintracomm->ep_comm_ptr->size_rank_info[0].second; 
     71    intra_num_ep = newintracomm->ep_comm_ptr->size_rank_info[1].second; 
     72    intra_mpi_size = newintracomm->ep_comm_ptr->size_rank_info[2].second; 
     73 
     74 
     75    MPI_Barrier_local(*newintracomm); 
     76 
     77 
     78    int *reorder; 
     79    if(intra_ep_rank_loc == 0) 
     80    { 
     81      reorder = new int[intra_ep_size]; 
     82    } 
     83 
     84 
     85    MPI_Gather(&my_ep_rank, 1, MPI_INT, reorder, 1, MPI_INT, 0, *newintracomm); 
     86    if(intra_ep_rank_loc == 0) 
     87    { 
     88      ::MPI_Bcast(reorder, intra_ep_size, MPI_INT_STD, 0, static_cast< ::MPI_Comm>(newintracomm->mpi_comm)); 
     89 
     90      vector< pair<int, int> > tmp_rank_map(intra_ep_size); 
     91 
     92 
     93      for(int i=0; i<intra_ep_size; i++) 
     94      { 
     95        tmp_rank_map[reorder[i]] = newintracomm->rank_map->at(i) ; 
     96      } 
     97 
     98      newintracomm->rank_map->swap(tmp_rank_map); 
     99 
     100      tmp_rank_map.clear(); 
     101    } 
     102 
     103    MPI_Barrier_local(*newintracomm); 
     104 
     105    (*newintracomm).ep_comm_ptr->size_rank_info[0].first = my_ep_rank; 
     106 
     107    if(intra_ep_rank_loc == 0) 
     108    { 
     109      delete[] reorder; 
     110    } 
     111 
     112    return MPI_SUCCESS; 
     113  } 
     114 
     115 
     116 
     117 
     118 
     119  int MPI_Intercomm_merge(MPI_Comm inter_comm, bool high, MPI_Comm *newintracomm) 
     120  { 
     121 
     122    assert(inter_comm.is_intercomm); 
     123 
     124    if(inter_comm.ep_comm_ptr->intercomm->local_comm->ep_comm_ptr->comm_label == -99) 
     125    { 
     126        return MPI_Intercomm_merge_unique_leader(inter_comm, high, newintracomm); 
     127    } 
     128 
     129 
     130    Debug("intercomm_merge kernel\n"); 
     131 
     132    int ep_rank, ep_rank_loc, mpi_rank; 
     133    int ep_size, num_ep, mpi_size; 
     134 
     135    ep_rank = inter_comm.ep_comm_ptr->size_rank_info[0].first; 
     136    ep_rank_loc = inter_comm.ep_comm_ptr->size_rank_info[1].first; 
     137    mpi_rank = inter_comm.ep_comm_ptr->size_rank_info[2].first; 
     138    ep_size = inter_comm.ep_comm_ptr->size_rank_info[0].second; 
     139    num_ep = inter_comm.ep_comm_ptr->size_rank_info[1].second; 
     140    mpi_size = inter_comm.ep_comm_ptr->size_rank_info[2].second; 
     141 
     142 
     143    int local_ep_rank, local_ep_rank_loc, local_mpi_rank; 
     144    int local_ep_size, local_num_ep, local_mpi_size; 
     145 
     146 
     147    local_ep_rank = inter_comm.ep_comm_ptr->intercomm->local_comm->ep_comm_ptr->size_rank_info[0].first; 
     148    local_ep_rank_loc = inter_comm.ep_comm_ptr->intercomm->local_comm->ep_comm_ptr->size_rank_info[1].first; 
     149    local_mpi_rank = inter_comm.ep_comm_ptr->intercomm->local_comm->ep_comm_ptr->size_rank_info[2].first; 
     150    local_ep_size = inter_comm.ep_comm_ptr->intercomm->local_comm->ep_comm_ptr->size_rank_info[0].second; 
     151    local_num_ep = inter_comm.ep_comm_ptr->intercomm->local_comm->ep_comm_ptr->size_rank_info[1].second; 
     152    local_mpi_size = inter_comm.ep_comm_ptr->intercomm->local_comm->ep_comm_ptr->size_rank_info[2].second; 
     153 
     154    int remote_ep_size = inter_comm.ep_comm_ptr->intercomm->remote_rank_map->size(); 
     155 
     156    int local_high = high; 
     157    int remote_high; 
     158 
     159    MPI_Barrier(inter_comm); 
    41160 
    42161//    if(local_ep_rank == 0 && high == false) 
     
    65184    } 
    66185 
    67  
    68186    MPI_Bcast(&remote_high, 1, MPI_INT, 0, *(inter_comm.ep_comm_ptr->intercomm->local_comm)); 
    69187 
    70 //    printf("%d, %d, %d, %d\n", local_ep_size, remote_ep_size, local_high, remote_high); 
    71  
    72  
    73     MPI_Comm_dup(inter_comm, newintracomm); 
     188    int intercomm_high; 
     189    if(ep_rank == 0) intercomm_high = local_high; 
     190    MPI_Bcast(&intercomm_high, 1, MPI_INT, 0, inter_comm); 
     191 
     192    //printf("remote_ep_size = %d, local_high = %d, remote_high = %d, intercomm_high = %d\n", remote_ep_size, local_high, remote_high, intercomm_high); 
     193 
     194 
     195    ::MPI_Comm mpi_intracomm; 
     196    MPI_Comm *ep_intracomm; 
     197 
     198    if(ep_rank_loc == 0) 
     199    { 
     200 
     201      ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm>(inter_comm.ep_comm_ptr->intercomm->mpi_inter_comm); 
     202 
     203      ::MPI_Intercomm_merge(mpi_comm, intercomm_high, &mpi_intracomm); 
     204      MPI_Info info; 
     205      MPI_Comm_create_endpoints(mpi_intracomm, num_ep, info, ep_intracomm); 
     206 
     207      inter_comm.ep_comm_ptr->comm_list->mem_bridge = ep_intracomm; 
     208 
     209    } 
     210 
     211 
     212 
     213    MPI_Barrier_local(inter_comm); 
     214 
     215    *newintracomm = inter_comm.ep_comm_ptr->comm_list->mem_bridge[ep_rank_loc]; 
    74216 
    75217    int my_ep_rank = local_high<remote_high? local_ep_rank: local_ep_rank+remote_ep_size; 
    76  
    77218 
    78219    int intra_ep_rank, intra_ep_rank_loc, intra_mpi_rank; 
     
    87228 
    88229 
     230 
    89231    MPI_Barrier_local(*newintracomm); 
    90232 
     
    97239 
    98240 
     241 
    99242    MPI_Gather(&my_ep_rank, 1, MPI_INT, reorder, 1, MPI_INT, 0, *newintracomm); 
    100243    if(intra_ep_rank_loc == 0) 
    101244    { 
    102       #ifdef _serialized 
    103       #pragma omp critical (_mpi_call) 
    104       #endif // _serialized 
     245 
    105246      ::MPI_Bcast(reorder, intra_ep_size, MPI_INT_STD, 0, static_cast< ::MPI_Comm>(newintracomm->mpi_comm)); 
    106247 
     
    122263    (*newintracomm).ep_comm_ptr->size_rank_info[0].first = my_ep_rank; 
    123264 
    124     if(intra_ep_rank_loc == 0) 
    125     { 
    126       delete[] reorder; 
    127     } 
    128  
    129     return MPI_SUCCESS; 
    130   } 
    131  
    132  
    133  
    134  
    135  
    136   int MPI_Intercomm_merge(MPI_Comm inter_comm, bool high, MPI_Comm *newintracomm) 
    137   { 
    138  
    139     assert(inter_comm.is_intercomm); 
    140  
    141     if(inter_comm.ep_comm_ptr->intercomm->local_comm->ep_comm_ptr->comm_label == -99) 
    142     { 
    143         return MPI_Intercomm_merge_unique_leader(inter_comm, high, newintracomm); 
    144     } 
    145  
    146  
    147     Debug("intercomm_merge kernel\n"); 
    148  
    149     int ep_rank, ep_rank_loc, mpi_rank; 
    150     int ep_size, num_ep, mpi_size; 
    151  
    152     ep_rank = inter_comm.ep_comm_ptr->size_rank_info[0].first; 
    153     ep_rank_loc = inter_comm.ep_comm_ptr->size_rank_info[1].first; 
    154     mpi_rank = inter_comm.ep_comm_ptr->size_rank_info[2].first; 
    155     ep_size = inter_comm.ep_comm_ptr->size_rank_info[0].second; 
    156     num_ep = inter_comm.ep_comm_ptr->size_rank_info[1].second; 
    157     mpi_size = inter_comm.ep_comm_ptr->size_rank_info[2].second; 
    158  
    159  
    160     int local_ep_rank, local_ep_rank_loc, local_mpi_rank; 
    161     int local_ep_size, local_num_ep, local_mpi_size; 
    162  
    163  
    164     local_ep_rank = inter_comm.ep_comm_ptr->intercomm->local_comm->ep_comm_ptr->size_rank_info[0].first; 
    165     local_ep_rank_loc = inter_comm.ep_comm_ptr->intercomm->local_comm->ep_comm_ptr->size_rank_info[1].first; 
    166     local_mpi_rank = inter_comm.ep_comm_ptr->intercomm->local_comm->ep_comm_ptr->size_rank_info[2].first; 
    167     local_ep_size = inter_comm.ep_comm_ptr->intercomm->local_comm->ep_comm_ptr->size_rank_info[0].second; 
    168     local_num_ep = inter_comm.ep_comm_ptr->intercomm->local_comm->ep_comm_ptr->size_rank_info[1].second; 
    169     local_mpi_size = inter_comm.ep_comm_ptr->intercomm->local_comm->ep_comm_ptr->size_rank_info[2].second; 
    170  
    171     int remote_ep_size = inter_comm.ep_comm_ptr->intercomm->remote_rank_map->size(); 
    172  
    173     int local_high = high; 
    174     int remote_high; 
    175  
    176     MPI_Barrier(inter_comm); 
    177  
    178 //    if(local_ep_rank == 0 && high == false) 
    179 //    { 
    180 //      MPI_Status status; 
    181 //      MPI_Send(&local_high, 1, MPI_INT, 0, inter_comm.ep_comm_ptr->intercomm->intercomm_tag, inter_comm); 
    182 //      MPI_Recv(&remote_high, 1, MPI_INT, 0, inter_comm.ep_comm_ptr->intercomm->intercomm_tag, inter_comm, &status); 
    183 //    } 
    184 // 
    185 //    if(local_ep_rank == 0 && high == true) 
    186 //    { 
    187 //      MPI_Status status; 
    188 //      MPI_Recv(&remote_high, 1, MPI_INT, 0, inter_comm.ep_comm_ptr->intercomm->intercomm_tag, inter_comm, &status); 
    189 //      MPI_Send(&local_high, 1, MPI_INT, 0, inter_comm.ep_comm_ptr->intercomm->intercomm_tag, inter_comm); 
    190 //    } 
    191  
    192     if(local_ep_rank == 0) 
    193     { 
    194       MPI_Status status; 
    195       MPI_Request req_s, req_r; 
    196       MPI_Isend(&local_high, 1, MPI_INT, 0, inter_comm.ep_comm_ptr->intercomm->intercomm_tag, inter_comm, &req_s); 
    197       MPI_Irecv(&remote_high, 1, MPI_INT, 0, inter_comm.ep_comm_ptr->intercomm->intercomm_tag, inter_comm, &req_r); 
    198  
    199       MPI_Wait(&req_s, &status); 
    200       MPI_Wait(&req_r, &status); 
    201     } 
    202  
    203     MPI_Bcast(&remote_high, 1, MPI_INT, 0, *(inter_comm.ep_comm_ptr->intercomm->local_comm)); 
    204  
    205     int intercomm_high; 
    206     if(ep_rank == 0) intercomm_high = local_high; 
    207     MPI_Bcast(&intercomm_high, 1, MPI_INT, 0, inter_comm); 
    208  
    209     //printf("remote_ep_size = %d, local_high = %d, remote_high = %d, intercomm_high = %d\n", remote_ep_size, local_high, remote_high, intercomm_high); 
    210  
    211  
    212     ::MPI_Comm mpi_intracomm; 
    213     MPI_Comm *ep_intracomm; 
    214  
    215     if(ep_rank_loc == 0) 
    216     { 
    217  
    218       ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm>(inter_comm.ep_comm_ptr->intercomm->mpi_inter_comm); 
    219       #ifdef _serialized 
    220       #pragma omp critical (_mpi_call) 
    221       #endif // _serialized 
    222       ::MPI_Intercomm_merge(mpi_comm, intercomm_high, &mpi_intracomm); 
    223       MPI_Info info; 
    224       MPI_Comm_create_endpoints(mpi_intracomm, num_ep, info, ep_intracomm); 
    225  
    226       inter_comm.ep_comm_ptr->comm_list->mem_bridge = ep_intracomm; 
    227  
    228     } 
    229  
    230  
    231  
    232     MPI_Barrier_local(inter_comm); 
    233  
    234     *newintracomm = inter_comm.ep_comm_ptr->comm_list->mem_bridge[ep_rank_loc]; 
    235  
    236     int my_ep_rank = local_high<remote_high? local_ep_rank: local_ep_rank+remote_ep_size; 
    237  
    238     int intra_ep_rank, intra_ep_rank_loc, intra_mpi_rank; 
    239     int intra_ep_size, intra_num_ep, intra_mpi_size; 
    240  
    241     intra_ep_rank = newintracomm->ep_comm_ptr->size_rank_info[0].first; 
    242     intra_ep_rank_loc = newintracomm->ep_comm_ptr->size_rank_info[1].first; 
    243     intra_mpi_rank = newintracomm->ep_comm_ptr->size_rank_info[2].first; 
    244     intra_ep_size = newintracomm->ep_comm_ptr->size_rank_info[0].second; 
    245     intra_num_ep = newintracomm->ep_comm_ptr->size_rank_info[1].second; 
    246     intra_mpi_size = newintracomm->ep_comm_ptr->size_rank_info[2].second; 
    247  
    248  
    249  
    250     MPI_Barrier_local(*newintracomm); 
    251  
    252  
    253     int *reorder; 
    254     if(intra_ep_rank_loc == 0) 
    255     { 
    256       reorder = new int[intra_ep_size]; 
    257     } 
    258  
    259  
    260  
    261     MPI_Gather(&my_ep_rank, 1, MPI_INT, reorder, 1, MPI_INT, 0, *newintracomm); 
    262     if(intra_ep_rank_loc == 0) 
    263     { 
    264       #ifdef _serialized 
    265       #pragma omp critical (_mpi_call) 
    266       #endif // _serialized 
    267       ::MPI_Bcast(reorder, intra_ep_size, MPI_INT_STD, 0, static_cast< ::MPI_Comm>(newintracomm->mpi_comm)); 
    268  
    269       vector< pair<int, int> > tmp_rank_map(intra_ep_size); 
    270  
    271  
    272       for(int i=0; i<intra_ep_size; i++) 
    273       { 
    274         tmp_rank_map[reorder[i]] = newintracomm->rank_map->at(i) ; 
    275       } 
    276  
    277       newintracomm->rank_map->swap(tmp_rank_map); 
    278  
    279       tmp_rank_map.clear(); 
    280     } 
    281  
    282     MPI_Barrier_local(*newintracomm); 
    283  
    284     (*newintracomm).ep_comm_ptr->size_rank_info[0].first = my_ep_rank; 
    285  
    286265 
    287266    if(intra_ep_rank_loc == 0) 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_probe.cpp

    r1037 r1053  
    3434 
    3535    #pragma omp flush 
    36     #pragma critical (_query) 
     36 
     37    #pragma omp critical (_query) 
    3738    if(comm.ep_comm_ptr->message_queue->size() > 0) 
    3839    { 
     
    104105 
    105106    #pragma omp flush 
    106     #pragma critical (_query) 
     107 
     108    #pragma omp critical (_query) 
    107109    if(comm.ep_comm_ptr->message_queue->size() > 0) 
    108110    { 
     
    127129          message->ep_src = it->ep_src; 
    128130 
    129           #pragma omp critical (_query) 
     131          #pragma omp critical (_query2) 
    130132          {               
    131133            //printf("local message erased. src = %d, dest = %d, tag = %d\n", it->ep_src, it->ep_dest, it->ep_tag);      
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_rank.cpp

    r1037 r1053  
    2828 
    2929 
    30     if(comm.mpi_comm) 
     30    if(comm != MPI_COMM_NULL) 
    3131    { 
    3232      ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm > (comm.mpi_comm); 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_recv.cpp

    r1037 r1053  
    6868                 
    6969 
    70                 request->mpi_request = NULL; 
     70                request->mpi_request = MPI_REQUEST_NULL_STD; 
    7171                request->buf = buf; 
    7272    request->comm = comm; 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_reduce.cpp

    r1037 r1053  
    447447    if(!comm.is_ep && comm.mpi_comm) 
    448448    { 
    449       #ifdef _serialized 
    450       #pragma omp critical (_mpi_call) 
    451       #endif // _serialized 
    452449      ::MPI_Reduce(sendbuf, recvbuf, count, static_cast< ::MPI_Datatype>(datatype), static_cast< ::MPI_Op>(op), root, 
    453450                   static_cast< ::MPI_Comm>(comm.mpi_comm)); 
     
    473470 
    474471    ::MPI_Aint recvsize, lb; 
    475     #ifdef _serialized 
    476     #pragma omp critical (_mpi_call) 
    477     #endif // _serialized 
     472 
    478473    ::MPI_Type_get_extent(static_cast< ::MPI_Datatype>(datatype), &lb, &recvsize); 
    479474 
     
    489484    if(ep_rank_loc==0) 
    490485    { 
    491       #ifdef _serialized 
    492       #pragma omp critical (_mpi_call) 
    493       #endif // _serialized 
    494486      ::MPI_Reduce(local_recvbuf, recvbuf, count, static_cast< ::MPI_Datatype>(datatype), static_cast< ::MPI_Op>(op), root_mpi_rank, static_cast< ::MPI_Comm>(comm.mpi_comm)); 
    495487    } 
     
    522514    if(!comm.is_ep && comm.mpi_comm) 
    523515    { 
    524       #ifdef _serialized 
    525       #pragma omp critical (_mpi_call) 
    526       #endif // _serialized 
    527516      ::MPI_Allreduce(sendbuf, recvbuf, count, static_cast< ::MPI_Datatype>(datatype), static_cast< ::MPI_Op>(op), 
    528517                      static_cast< ::MPI_Comm>(comm.mpi_comm)); 
     
    545534 
    546535    ::MPI_Aint recvsize, lb; 
    547     #ifdef _serialized 
    548     #pragma omp critical (_mpi_call) 
    549     #endif // _serialized 
     536 
    550537    ::MPI_Type_get_extent(static_cast< ::MPI_Datatype>(datatype), &lb, &recvsize); 
    551538 
     
    561548    if(ep_rank_loc==0) 
    562549    { 
    563       #ifdef _serialized 
    564       #pragma omp critical (_mpi_call) 
    565       #endif // _serialized 
    566550      ::MPI_Allreduce(local_recvbuf, recvbuf, count, static_cast< ::MPI_Datatype>(datatype), static_cast< ::MPI_Op>(op), static_cast< ::MPI_Comm>(comm.mpi_comm)); 
    567551    } 
     
    590574    if(!comm.is_ep && comm.mpi_comm) 
    591575    { 
    592       #ifdef _serialized 
    593       #pragma omp critical (_mpi_call) 
    594       #endif // _serialized 
    595576      ::MPI_Reduce_scatter(sendbuf, recvbuf, recvcounts, static_cast< ::MPI_Datatype>(datatype), static_cast< ::MPI_Op>(op), 
    596577                           static_cast< ::MPI_Comm>(comm.mpi_comm)); 
     
    616597 
    617598    ::MPI_Aint datasize, lb; 
    618     #ifdef _serialized 
    619     #pragma omp critical (_mpi_call) 
    620     #endif // _serialized 
     599 
    621600    ::MPI_Type_get_extent(static_cast< ::MPI_Datatype>(datatype), &lb, &datasize); 
    622601 
     
    636615        local_recvcnt[i] = accumulate(recvcounts+ep_rank, recvcounts+ep_rank+num_ep, 0); 
    637616      } 
    638       #ifdef _serialized 
    639       #pragma omp critical (_mpi_call) 
    640       #endif // _serialized 
     617 
    641618      ::MPI_Reduce_scatter(local_buf, local_buf2, local_recvcnt, static_cast< ::MPI_Datatype>(datatype), 
    642619                         static_cast< ::MPI_Op>(op), static_cast< ::MPI_Comm>(comm.mpi_comm)); 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_scan.cpp

    r1037 r1053  
    432432    if(!comm.is_ep) 
    433433    { 
    434       #ifdef _serialized 
    435       #pragma omp critical (_mpi_call) 
    436       #endif // _serialized 
     434 
    437435      ::MPI_Scan(sendbuf, recvbuf, count, static_cast< ::MPI_Datatype>(datatype), 
    438436                 static_cast< ::MPI_Op>(op), static_cast< ::MPI_Comm>(comm.mpi_comm)); 
     
    455453 
    456454    ::MPI_Aint datasize, lb; 
    457     #ifdef _serialized 
    458     #pragma omp critical (_mpi_call) 
    459     #endif // _serialized 
     455 
    460456    ::MPI_Type_get_extent(static_cast< ::MPI_Datatype>(datatype), &lb, &datasize); 
    461457 
     
    484480    if(ep_rank_loc == 0) 
    485481    { 
    486       #ifdef _serialized 
    487       #pragma omp critical (_mpi_call) 
    488       #endif // _serialized 
    489482      ::MPI_Exscan(local_sum, mpi_scan_recvbuf, count, static_cast< ::MPI_Datatype>(datatype), static_cast< ::MPI_Op>(op), static_cast< ::MPI_Comm>(comm.mpi_comm)); 
    490483    } 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_scatter.cpp

    r1037 r1053  
    287287    if(!comm.is_ep) 
    288288    { 
    289       #ifdef _serialized 
    290       #pragma omp critical (_mpi_call) 
    291       #endif // _serialized 
    292289      ::MPI_Scatter(sendbuf, sendcount, static_cast< ::MPI_Datatype>(sendtype), recvbuf, recvcount, static_cast< ::MPI_Datatype>(recvtype), 
    293290                    root, static_cast< ::MPI_Comm>(comm.mpi_comm)); 
     
    317314 
    318315    ::MPI_Aint datasize, lb; 
    319     #ifdef _serialized 
    320     #pragma omp critical (_mpi_call) 
    321     #endif // _serialized 
     316 
    322317    ::MPI_Type_get_extent(static_cast< ::MPI_Datatype>(datatype), &lb, &datasize); 
    323318 
     
    343338      local_recvbuf = new void*[datasize*mpi_sendcnt]; 
    344339 
    345       #ifdef _serialized 
    346       #pragma omp critical (_mpi_call) 
    347       #endif // _serialized 
    348340      ::MPI_Gather(&mpi_sendcnt, 1, MPI_INT_STD, mpi_scatterv_sendcnt, 1, MPI_INT_STD, root_mpi_rank, static_cast< ::MPI_Comm>(comm.mpi_comm)); 
    349341 
     
    355347      if(root_ep_loc!=0) 
    356348      { 
    357         #ifdef _serialized 
    358         #pragma omp critical (_mpi_call) 
    359         #endif // _serialized 
    360349        ::MPI_Scatterv(master_sendbuf, mpi_scatterv_sendcnt, displs, static_cast< ::MPI_Datatype>(datatype), 
    361350                     local_recvbuf, mpi_sendcnt, static_cast< ::MPI_Datatype>(datatype), root_mpi_rank, static_cast< ::MPI_Comm>(comm.mpi_comm)); 
     
    363352      else 
    364353      { 
    365         #ifdef _serialized 
    366         #pragma omp critical (_mpi_call) 
    367         #endif // _serialized 
    368354        ::MPI_Scatterv(sendbuf, mpi_scatterv_sendcnt, displs, static_cast< ::MPI_Datatype>(datatype), 
    369355                     local_recvbuf, mpi_sendcnt, static_cast< ::MPI_Datatype>(datatype), root_mpi_rank, static_cast< ::MPI_Comm>(comm.mpi_comm)); 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_scatterv.cpp

    r1037 r1053  
    296296    if(!comm.is_ep) 
    297297    { 
    298       #ifdef _serialized 
    299       #pragma omp critical (_mpi_call) 
    300       #endif // _serialized 
    301298      ::MPI_Scatterv(sendbuf, sendcounts, displs, static_cast< ::MPI_Datatype>(sendtype), recvbuf, recvcount, 
    302299                     static_cast< ::MPI_Datatype>(recvtype), root, static_cast< ::MPI_Comm>(comm.mpi_comm)); 
     
    329326 
    330327    ::MPI_Aint datasize, lb; 
    331     #ifdef _serialized 
    332     #pragma omp critical (_mpi_call) 
    333     #endif // _serialized 
     328 
    334329    ::MPI_Type_get_extent(static_cast< ::MPI_Datatype>(datatype), &lb, &datasize); 
    335330 
     
    358353      local_recvbuf = new void*[datasize*mpi_sendcnt]; 
    359354 
    360       #ifdef _serialized 
    361       #pragma omp critical (_mpi_call) 
    362       #endif // _serialized 
    363355      ::MPI_Gather(&mpi_sendcnt, 1, MPI_INT_STD, mpi_scatterv_sendcnt, 1, MPI_INT_STD, root_mpi_rank, static_cast< ::MPI_Comm>(comm.mpi_comm)); 
    364356 
     
    370362      if(root_ep_loc!=0) 
    371363      { 
    372         #ifdef _serialized 
    373         #pragma omp critical (_mpi_call) 
    374         #endif // _serialized 
    375364        ::MPI_Scatterv(master_sendbuf, mpi_scatterv_sendcnt, mpi_displs, static_cast< ::MPI_Datatype>(datatype), 
    376365                     local_recvbuf, mpi_sendcnt, static_cast< ::MPI_Datatype>(datatype), root_mpi_rank, static_cast< ::MPI_Comm>(comm.mpi_comm)); 
     
    378367      else 
    379368      { 
    380         #ifdef _serialized 
    381         #pragma omp critical (_mpi_call) 
    382         #endif // _serialized 
    383369        ::MPI_Scatterv(sendbuf, mpi_scatterv_sendcnt, mpi_displs, static_cast< ::MPI_Datatype>(datatype), 
    384370                     local_recvbuf, mpi_sendcnt, static_cast< ::MPI_Datatype>(datatype), root_mpi_rank, static_cast< ::MPI_Comm>(comm.mpi_comm)); 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_send.cpp

    r1037 r1053  
    8282    // EP intracomm 
    8383 
    84     check_sum_send(buf, count, datatype, dest, tag, comm, 1); 
     84    //check_sum_send(buf, count, datatype, dest, tag, comm, 1); 
    8585 
    8686    int ep_src_loc = comm.ep_comm_ptr->size_rank_info[1].first; 
     
    139139    // EP intracomm 
    140140 
    141     check_sum_send(buf, count, datatype, dest, tag, comm, 1); 
     141    //check_sum_send(buf, count, datatype, dest, tag, comm, 1); 
    142142 
    143143    int ep_src_loc = comm.ep_comm_ptr->size_rank_info[1].first; 
     
    171171    Debug("MPI_Isend with intercomm\n"); 
    172172 
    173     check_sum_send(buf, count, datatype, dest, tag, comm, 1); 
     173    //check_sum_send(buf, count, datatype, dest, tag, comm, 1); 
    174174 
    175175    int dest_remote_ep_rank    = comm.ep_comm_ptr->intercomm->remote_rank_map->at(dest).first; 
     
    244244    Debug("MPI_Issend with intercomm\n"); 
    245245 
    246     check_sum_send(buf, count, datatype, dest, tag, comm, 1); 
     246    //check_sum_send(buf, count, datatype, dest, tag, comm, 1); 
    247247 
    248248    int dest_remote_ep_rank    = comm.ep_comm_ptr->intercomm->remote_rank_map->at(dest).first; 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_size.cpp

    r1037 r1053  
    3131    Debug("Calling EP_Comm_size\n"); 
    3232 
    33     if(comm.mpi_comm) 
     33    if(comm.mpi_comm != MPI_COMM_NULL_STD) 
    3434    { 
    3535      ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm > (comm.mpi_comm);  
     
    5454    if(!comm.is_ep) 
    5555    { 
    56       if(comm.mpi_comm) 
     56      if(comm.mpi_comm != MPI_COMM_NULL_STD) 
    5757      { 
    5858        ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm > (comm.mpi_comm);  
    59         #ifdef _serialized 
    60         #pragma omp critical (_mpi_call) 
    61         #endif // _serialized 
    6259        ::MPI_Comm_remote_size(mpi_comm, size); 
    6360        return 0; 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_split.cpp

    r1037 r1053  
    144144        int master_color = 1; 
    145145        if(matched_number_loc[j] == 0) master_color = MPI_UNDEFINED; 
    146         #ifdef _serialized 
    147         #pragma omp critical (_mpi_call) 
    148         #endif // _serialized 
     146 
    149147        ::MPI_Comm_split(static_cast< ::MPI_Comm>(comm.mpi_comm), master_color, mpi_rank, &split_mpi_comm[j]); 
    150148         
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_test.cpp

    r1037 r1053  
    6363        status->mpi_status = new ::MPI_Status(mpi_status); 
    6464        status->ep_src = request->ep_src; 
    65       status->ep_tag = request->ep_tag; 
    66       status->ep_datatype = request->ep_datatype; 
     65        status->ep_tag = request->ep_tag; 
     66        status->ep_datatype = request->ep_datatype; 
    6767        int count; 
    6868        MPI_Get_count(status, request->ep_datatype, &count); 
    69         check_sum_recv(request->buf, count, request->ep_datatype, request->ep_src, request->ep_tag, request->comm, 2); 
     69        //check_sum_recv(request->buf, count, request->ep_datatype, request->ep_src, request->ep_tag, request->comm, 2); 
    7070      } 
    7171 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_type.cpp

    r1037 r1053  
    66 
    77::MPI_Comm MPI_COMM_WORLD_STD = MPI_COMM_WORLD; 
    8 //#undef MPI_COMM_WORLD 
     8#undef MPI_COMM_WORLD 
    99 
    1010 
    1111::MPI_Comm MPI_COMM_NULL_STD = MPI_COMM_NULL; 
    12 //#undef MPI_COMM_NULL 
     12#undef MPI_COMM_NULL 
    1313 
     14//::MPI_Info MPI_INFO_NULL_STD = MPI_INFO_NULL; 
     15//#undef MPI_INFO_NULL 
     16 
     17::MPI_Request MPI_REQUEST_NULL_STD = MPI_REQUEST_NULL; 
     18#undef MPI_REQUEST_NULL 
    1419 
    1520::MPI_Datatype MPI_INT_STD = MPI_INT; 
     
    3035 
    3136 
    32 //ep_lib::MPI_Datatype MPI_INT = MPI_INT_STD; 
    33 //ep_lib::MPI_Datatype MPI_FLOAT = MPI_FLOAT_STD; 
    34 //ep_lib::MPI_Datatype MPI_DOUBLE = MPI_DOUBLE_STD; 
    35 //ep_lib::MPI_Datatype MPI_LONG = MPI_LONG_STD; 
    36 //ep_lib::MPI_Datatype MPI_CHAR = MPI_CHAR_STD; 
    37 //ep_lib::MPI_Datatype MPI_UNSIGNED_LONG = MPI_UNSIGNED_LONG_STD; 
    38  
    39  
    40  
    41  
    4237::MPI_Op MPI_SUM_STD = MPI_SUM; 
    4338::MPI_Op MPI_MAX_STD = MPI_MAX; 
     
    4843#undef MPI_MIN 
    4944 
    50 //ep_lib::MPI_Op MPI_SUM = MPI_SUM_STD; 
    51 //ep_lib::MPI_Op MPI_MAX = MPI_MAX_STD; 
    52 //ep_lib::MPI_Op MPI_MIN = MPI_MIN_STD; 
    53  
    54 //  ep_lib::MPI_Comm::MPI_Comm(const MPI_Comm & comm) 
    55 //  { 
    56 //    printf("calling MPI_Comm copy constructor\n"); 
    57 //    is_ep = comm.is_ep; 
    58 //    is_intercomm = comm.is_intercomm; 
    59  
    60 //    int my_rank = comm.ep_comm_ptr->size_rank_info[1].first; 
    61 //    int num_ep  = comm.ep_comm_ptr->size_rank_info[1].second; 
    62  
    63  
    64 //    if(0 == my_rank) 
    65 //    { 
    66 //      MPI_Info info; 
    67 //      MPI_Comm *out_comm; 
    68 //      ::MPI_Comm mpi_dup; 
    69  
    70 //      ::MPI_Comm in_comm = static_cast< ::MPI_Comm>(comm.mpi_comm); 
    71  
    72 //      ::MPI_Comm_dup(in_comm, &mpi_dup); 
    73  
    74 //      MPI_Comm_create_endpoints(mpi_dup, num_ep, info, out_comm); 
    75 //      comm.ep_comm_ptr->comm_list->mem_bridge = out_comm; 
    76 //    } 
    77  
    78 //    MPI_Barrier(comm); 
    79  
    80 //    *this = (comm.ep_comm_ptr->comm_list->mem_bridge[my_rank]); 
    81 // //       // my_buffer = NULL; 
    82 // //       // ep_barrier = NULL; 
    83 // //       // rank_map = NULL; 
    84 // //       // ep_comm_ptr = NULL; 
    85 // //       // mem_bridge = NULL; 
    86 // //       // mpi_bridge = NULL; 
    87 // //       // mpi_comm = comm; 
    88 // } 
     45#ifdef _openmpi 
     46//#undef MPI_Fint 
     47#endif 
    8948 
    9049 
     
    9756 
    9857 
     58 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_type.hpp

    r1037 r1053  
    1212#include <numeric> 
    1313#include <bitset> 
    14 #include <memory.h> 
     14//#include <memory.h> 
    1515#include <algorithm> 
    1616#include <assert.h> 
     
    4242{ 
    4343  #define MPI_UNDEFINED -32766 
    44   #define MPI_STATUS_IGNORE NULL 
    45   #define MPI_INFO_NULL MPI_Info() 
     44  //#define MPI_STATUS_IGNORE NULL 
     45  //#define MPI_INFO_NULL MPI_Info(MPI_INFO_NULL_STD) 
    4646 
    4747  class ep_communicator; 
     
    8484      void* mpi_status; 
    8585 
    86       MPI_Message() 
    87       { 
    88         mpi_message = 0; 
    89         mpi_status = 0; 
    90       } 
     86      MPI_Message() {} 
     87      #ifdef _intelmpi 
     88      MPI_Message(int message): mpi_message(message) {} 
     89      #elif _openmpi 
     90      MPI_Message(void* message): mpi_message(message) {} 
     91      #endif 
    9192  }; 
    9293 
     
    289290      mem_bridge = NULL; 
    290291      mpi_bridge = NULL; 
    291       mpi_comm = 0; 
    292     } 
    293  
     292    } 
     293 
     294    #ifdef _intelmpi 
    294295    MPI_Comm(int comm) 
    295296    { 
     
    305306    } 
    306307 
    307     //MPI_Comm(const MPI_Comm &comm); 
     308    #elif _openmpi 
     309 
     310    MPI_Comm(void* comm) 
     311    { 
     312      is_ep = false; 
     313      is_intercomm = false; 
     314      my_buffer = NULL; 
     315      ep_barrier = NULL; 
     316      rank_map = NULL; 
     317      ep_comm_ptr = NULL; 
     318      mem_bridge = NULL; 
     319      mpi_bridge = NULL; 
     320      mpi_comm = comm; 
     321    } 
     322    #endif 
    308323 
    309324 
     
    338353      #endif 
    339354 
    340       MPI_Info() 
    341       { 
    342         mpi_info = 0; 
    343       } 
     355      MPI_Info() {} 
     356       
     357      #ifdef _intelmpi 
     358      MPI_Info(int info): mpi_info(info) {} 
     359      #elif _openmpi 
     360      MPI_Info(void* info): mpi_info(info) {} 
     361      #endif 
    344362  }; 
    345363 
     
    368386      MPI_Comm comm;    //! EP communicator related to the communication 
    369387 
    370       MPI_Request() 
    371       { 
    372         mpi_request = 0; 
    373       } 
     388      MPI_Request() {} 
     389 
     390      #ifdef _intelmpi 
     391      MPI_Request(int request): mpi_request(request) {} 
     392      #elif _openmpi 
     393      MPI_Request(void* request): mpi_request(request) {} 
     394      #endif 
     395  }; 
     396 
     397   
     398  class MPI_Aint 
     399  { 
     400    public: 
     401 
     402    unsigned long mpi_aint; 
     403 
     404    MPI_Aint() {} 
     405    MPI_Aint(int a): mpi_aint(a) {} 
    374406  }; 
    375407 
     
    379411 
    380412    int mpi_fint; 
    381   }; 
    382  
    383   class MPI_Aint 
    384   { 
    385     public: 
    386  
    387     unsigned long mpi_aint; 
     413 
     414    MPI_Fint() {} 
     415    MPI_Fint(int f): mpi_fint(f) {} 
     416     
    388417  }; 
    389418 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_wait.cpp

    r1037 r1053  
    5252      status->ep_datatype = request->ep_datatype; 
    5353 
    54       check_sum_recv(request->buf, count, request->ep_datatype, request->ep_src, request->ep_tag, request->comm, 2); 
     54      //check_sum_recv(request->buf, count, request->ep_datatype, request->ep_src, request->ep_tag, request->comm, 2); 
    5555 
    5656      return 0; 
     
    7070      int count; 
    7171      MPI_Get_count(status, request->ep_datatype, &count); 
    72       check_sum_recv(request->buf, count, request->ep_datatype, request->ep_src, request->ep_tag, request->comm, 2); 
     72      //check_sum_recv(request->buf, count, request->ep_datatype, request->ep_src, request->ep_tag, request->comm, 2); 
    7373    } 
    7474          return MPI_SUCCESS; 
     
    106106              int check_count; 
    107107              MPI_Get_count(&array_of_statuses[i], array_of_requests[i].ep_datatype, &check_count); 
    108               check_sum_recv(array_of_requests[i].buf, count, array_of_requests[i].ep_datatype, array_of_requests[i].ep_src, array_of_requests[i].ep_tag, array_of_requests[i].comm, 2); 
     108              //check_sum_recv(array_of_requests[i].buf, count, array_of_requests[i].ep_datatype, array_of_requests[i].ep_src, array_of_requests[i].ep_tag, array_of_requests[i].comm, 2); 
    109109            } 
    110110            finished++; 
     
    124124              MPI_Get_count(&array_of_statuses[i], array_of_requests[i].ep_datatype, &recv_count); 
    125125              MPI_Mrecv(array_of_requests[i].buf, recv_count, array_of_requests[i].ep_datatype, &message, &array_of_statuses[i]); 
    126               check_sum_recv(array_of_requests[i].buf, recv_count, array_of_requests[i].ep_datatype, array_of_requests[i].ep_src, array_of_requests[i].ep_tag, array_of_requests[i].comm, 2); 
     126              //check_sum_recv(array_of_requests[i].buf, recv_count, array_of_requests[i].ep_datatype, array_of_requests[i].ep_src, array_of_requests[i].ep_tag, array_of_requests[i].comm, 2); 
    127127 
    128128              finished++; 
Note: See TracChangeset for help on using the changeset viewer.