Changeset 1369 for XIOS/dev


Ignore:
Timestamp:
12/08/17 14:16:16 (6 years ago)
Author:
yushan
Message:

unify type : MPI_Fint

Location:
XIOS/dev/branch_openmp
Files:
7 edited

Legend:

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

    r1368 r1369  
    1  
    2  
    31#include "ep_lib.hpp" 
    42 
     
    4543 
    4644 
    47 #undef MPI_INT 
     45/*#undef MPI_INT 
    4846#undef MPI_FLOAT 
    4947#undef MPI_DOUBLE 
     
    6361#undef MPI_REQUEST_NULL 
    6462#undef MPI_INFO_NULL 
    65  
     63*/ 
    6664 
    6765 
  • XIOS/dev/branch_openmp/extern/src_ep_dev/ep_declaration.hpp

    r1287 r1369  
    11#ifndef EP_DECLARATION_HPP_INCLUDED 
    22#define EP_DECLARATION_HPP_INCLUDED 
    3 /* 
    4 extern ::MPI_Datatype MPI_INT_STD; 
    5 extern ::MPI_Datatype MPI_FLOAT_STD; 
    6 extern ::MPI_Datatype MPI_DOUBLE_STD; 
    7 extern ::MPI_Datatype MPI_LONG_STD; 
    8 extern ::MPI_Datatype MPI_CHAR_STD; 
    9 extern ::MPI_Datatype MPI_UNSIGNED_LONG_STD; 
    10 extern ::MPI_Datatype MPI_UNSIGNED_CHAR_STD; 
    113 
    12 extern ::MPI_Op MPI_SUM_STD; 
    13 extern ::MPI_Op MPI_MAX_STD; 
    14 extern ::MPI_Op MPI_MIN_STD; 
    15  
    16 extern ::MPI_Comm MPI_COMM_WORLD_STD; 
    17 extern ::MPI_Comm MPI_COMM_NULL_STD; 
    18  
    19 extern ::MPI_Status MPI_STATUS_IGNORE_STD; 
    20 extern ::MPI_Request MPI_REQUEST_NULL_STD; 
    21 extern ::MPI_Info MPI_INFO_NULL_STD; 
    22 */ 
    234#undef MPI_INT 
    245#undef MPI_FLOAT 
  • XIOS/dev/branch_openmp/extern/src_ep_dev/ep_fortran.cpp

    r1355 r1369  
    77#include "ep_mpi.hpp" 
    88 
    9 // #ifdef _openmpi 
    10 // //#undef MPI_Fint 
    11 // #endif 
    129 
    1310namespace ep_lib 
    1411{ 
    1512 
    16   int EP_Comm_c2f(MPI_Comm comm) 
     13  void* EP_Comm_c2f(MPI_Comm comm) 
    1714  { 
    1815    Debug("MPI_Comm_c2f"); 
    19     int fint; 
    20     //#ifdef _intelmpi 
    21     fint = (::MPI_Fint)(to_mpi_comm(comm.mpi_comm)); 
    22     //#elif _openmpi 
    23     //fint = ::MPI_Comm_c2f(to_mpi_comm(comm.mpi_comm)); 
    24     //#endif 
     16    void* fint = new ::MPI_Fint; 
     17    #ifdef _intelmpi 
     18    *static_cast< ::MPI_Fint*>(fint) = (::MPI_Fint)(to_mpi_comm(comm.mpi_comm)); 
     19    #elif _openmpi 
     20    *static_cast< ::MPI_Fint*>(fint) = MPI_Comm_c2f(to_mpi_comm(comm.mpi_comm)); 
     21    #endif 
    2522     
    26     std::map<std::pair<int, int>, MPI_Comm > ::iterator it; 
     23    std::map<std::pair< ::MPI_Fint, int>, MPI_Comm > ::iterator it; 
    2724     
    2825    #pragma omp critical (fc_comm_map) 
    2926    { 
    30       it = fc_comm_map.find(std::make_pair(fint, omp_get_thread_num())); 
     27      it = fc_comm_map.find(std::make_pair(*static_cast< ::MPI_Fint*>(fint), omp_get_thread_num())); 
    3128      if(it == fc_comm_map.end()) 
    3229      { 
    33         fc_comm_map.insert(std::make_pair( std::make_pair( fint, omp_get_thread_num()) , comm)); 
    34         printf("EP_Comm_c2f : MAP %p insert: %d, %d, %p\n", &fc_comm_map, fint, omp_get_thread_num(), comm.ep_comm_ptr); 
     30        fc_comm_map.insert(std::make_pair( std::make_pair( *static_cast< ::MPI_Fint*>(fint), omp_get_thread_num()) , comm)); 
     31        printf("EP_Comm_c2f : MAP %p insert: %d, %d, %p\n", &fc_comm_map, *static_cast< ::MPI_Fint*>(fint), omp_get_thread_num(), comm.ep_comm_ptr); 
    3532      } 
    3633    } 
     
    4138  } 
    4239 
    43   MPI_Comm EP_Comm_f2c(int comm) 
     40  MPI_Comm EP_Comm_f2c(void* comm) 
    4441  { 
    4542    Debug("MPI_Comm_f2c"); 
    4643     
    4744     
    48     std::map<std::pair<int, int>, MPI_Comm > ::iterator it; 
     45    std::map<std::pair< ::MPI_Fint, int>, MPI_Comm > ::iterator it; 
    4946     
    5047    #pragma omp critical (fc_comm_map) 
    51     it = fc_comm_map.find(std::make_pair(comm, omp_get_thread_num())); 
     48    it = fc_comm_map.find(std::make_pair(*static_cast< ::MPI_Fint*>(comm), omp_get_thread_num())); 
    5249     
    5350    if(it != fc_comm_map.end()) 
     
    6057        
    6158       
    62     //#ifdef _openmpi 
    63     //::MPI_Comm base_comm = ::MPI_Comm_f2c(comm); 
    64     //#elif _intelmpi 
     59     
     60    #ifdef _intelmpi 
    6561    ::MPI_Comm *base_comm = new ::MPI_Comm; 
    66     *base_comm = (::MPI_Comm)(comm); 
    67     //#endif 
     62    *base_comm = (::MPI_Comm)(*static_cast< ::MPI_Fint*>(comm)); 
     63    #elif _openmpi 
     64    ::MPI_Comm *base_comm = ::MPI_Comm_f2c(*static_cast< ::MPI_Fint*>(comm)); 
     65    #endif 
    6866 
    6967    if(*base_comm != to_mpi_comm(MPI_COMM_NULL.mpi_comm)) 
  • XIOS/dev/branch_openmp/extern/src_ep_dev/ep_lib_fortran.hpp

    r1295 r1369  
    77{ 
    88 
    9   int EP_Comm_c2f(MPI_Comm comm); 
    10   MPI_Comm EP_Comm_f2c(int comm); 
     9  void* EP_Comm_c2f(MPI_Comm comm); 
     10  MPI_Comm EP_Comm_f2c(void* comm); 
    1111} 
    1212 
  • XIOS/dev/branch_openmp/extern/src_ep_dev/ep_type.cpp

    r1366 r1369  
    7676    mpi_aint = new ::MPI_Aint; 
    7777    *(static_cast< ::MPI_Aint*>(mpi_aint)) = *(static_cast< ::MPI_Aint*>(aint)); 
     78  } 
     79   
     80  MPI_Fint::MPI_Fint(void* fint) 
     81  { 
     82    mpi_fint = new ::MPI_Fint; 
     83    *(static_cast< ::MPI_Fint*>(mpi_fint)) = *(static_cast< ::MPI_Fint*>(fint)); 
    7884  } 
    7985 
  • XIOS/dev/branch_openmp/extern/src_ep_dev/ep_type.hpp

    r1366 r1369  
    263263    public: 
    264264 
    265     int mpi_fint; 
     265    void* mpi_fint; 
    266266 
    267267    MPI_Fint() {} 
    268     MPI_Fint(int f): mpi_fint(f) {} 
     268    MPI_Fint(void* fint); 
     269    //MPI_Fint(int f): mpi_fint(f) {} 
    269270     
    270271  }; 
     
    279280  static std::map<std::pair<int, int>, MPI_Comm >  fc_comm_map; 
    280281 
    281   static std::map<std::pair<int, int>, MPI_Comm >  *fc_comm_map_ptr; 
    282   #pragma omp threadprivate(fc_comm_map_ptr) 
    283             //    <MPI_Fint,thread_num>   EP_Comm 
     282//  static std::map<std::pair<int, int>, MPI_Comm >  *fc_comm_map_ptr; 
     283//  #pragma omp threadprivate(fc_comm_map_ptr) 
     284//            //    <MPI_Fint,thread_num>   EP_Comm 
    284285 
    285286} 
  • XIOS/dev/branch_openmp/src/interface/c/icdata.cpp

    r1334 r1369  
    5656      ep_lib::MPI_Comm return_comm; 
    5757       
    58       //ep_lib::fc_comm_map.clear(); 
    5958 
    6059      if (!cstr2string(client_id, len_client_id, str)) return; 
     
    6766      #elif _usingEP 
    6867      ep_lib::fc_comm_map.clear(); 
    69       if (initialized) local_comm=ep_lib::EP_Comm_f2c(static_cast<int>(*f_local_comm)); 
     68      if (initialized) local_comm=ep_lib::EP_Comm_f2c((f_local_comm)); 
    7069      else local_comm=MPI_COMM_NULL; 
    7170      #endif 
     
    7776      *f_return_comm=MPI_Comm_c2f(return_comm); 
    7877      #elif _usingEP 
    79       *f_return_comm=ep_lib::EP_Comm_c2f(return_comm); 
     78      *f_return_comm=*static_cast<MPI_Fint*>(ep_lib::EP_Comm_c2f(return_comm)); 
    8079      #endif 
    8180      CTimer::get("XIOS init").suspend(); 
     
    9493     comm=MPI_Comm_f2c(*f_comm); 
    9594     #elif _usingEP 
    96      comm = ep_lib::EP_Comm_f2c(static_cast< int >(*f_comm)); 
     95     comm = ep_lib::EP_Comm_f2c(f_comm); 
    9796     #endif 
    9897     CClient::registerContext(str, comm); 
Note: See TracChangeset for help on using the changeset viewer.