Changeset 1068


Ignore:
Timestamp:
03/09/17 12:19:33 (7 years ago)
Author:
yushan
Message:

minor modification for using intelmpi

Location:
XIOS/dev/branch_yushan
Files:
14 edited

Legend:

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

    r1053 r1068  
    44 
    55#include <mpi.h> 
    6 //#include "ep_declaration.hpp" 
    76 
    87#undef MPI_INT 
     
    2221 
    2322#undef MPI_STATUS_IGNORE 
    24 //#undef MPI_INFO_NULL 
    2523#undef MPI_REQUEST_NULL 
     24#undef MPI_INFO_NULL 
    2625 
    27 #ifdef _openmpi 
    28 //#undef MPI_Fint 
    29 #endif 
     26 
    3027 
    3128// _STD defined in ep_type.cpp 
     
    4744 
    4845extern ::MPI_Status MPI_STATUS_IGNORE_STD; 
    49 //extern ::MPI_Info MPI_INFO_NULL_STD; 
    5046extern ::MPI_Request MPI_REQUEST_NULL_STD; 
     47extern ::MPI_Info MPI_INFO_NULL_STD; 
    5148 
    5249ep_lib::MPI_Datatype MPI_INT = MPI_INT_STD; 
     
    6562ep_lib::MPI_Comm MPI_COMM_NULL(MPI_COMM_NULL_STD); 
    6663 
    67 //ep_lib::MPI_Info MPI_INFO_NULL(MPI_INFO_NULL_STD); 
    6864ep_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  
    72 //ep_lib::MPI_Comm EP_COMM_WORLD; 
    73 //ep_lib::MPI_Comm EP_COMM_NULL; 
     65ep_lib::MPI_Info MPI_INFO_NULL(MPI_INFO_NULL_STD); 
    7466 
    7567 
    7668 
     69 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_declaration.hpp

    r1053 r1068  
    1818 
    1919extern ::MPI_Status MPI_STATUS_IGNORE_STD; 
    20 //extern ::MPI_Info MPI_INFO_NULL_STD; 
    2120extern ::MPI_Request MPI_REQUEST_NULL_STD; 
     21extern ::MPI_Info MPI_INFO_NULL_STD; 
    2222 
    2323#undef MPI_INT 
     
    3636#undef MPI_COMM_NULL 
    3737 
    38 //#undef MPI_INFO_NULL 
    3938#undef MPI_REQUEST_NULL 
    4039 
    41 #ifdef _openmpi 
    42 //#undef MPI_Fint 
    43 #endif 
     40 
    4441 
    4542#undef MPI_STATUS_IGNORE 
     
    6158 
    6259extern ep_lib::MPI_Status MPI_STATUS_IGNORE; 
     60extern ep_lib::MPI_Request MPI_REQUEST_NULL; 
    6361//extern ep_lib::MPI_Info MPI_INFO_NULL; 
    64 extern ep_lib::MPI_Request MPI_REQUEST_NULL; 
    6562 
    6663#endif // EP_DECLARATION_HPP_INCLUDED 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_fortran.cpp

    r1067 r1068  
    66#include "ep_declaration.hpp" 
    77 
    8 #ifdef _intelmpi 
    9 #undef MPI_Comm_f2c(comm) 
    10 #undef MPI_Comm_c2f(comm) 
    11 #endif 
    12  
    13 #ifdef _openmpi 
    14 //#undef MPI_Fint 
    15 #endif 
    168 
    179namespace ep_lib 
     
    6153      if(omp_get_thread_num() == 0) 
    6254      { 
     55        #ifdef _openmpi 
    6356        ::MPI_Comm base_comm = ::MPI_Comm_f2c(comm); 
     57        #elif _intelmpi 
     58        ::MPI_Comm base_comm = (::MPI_Comm)(comm); 
     59        #endif 
     60 
    6461        if(base_comm != MPI_COMM_NULL_STD) 
    6562        { 
     
    7875  } 
    7976 
    80   #ifdef _intelmpi 
     77  // #ifdef _intelmpi 
    8178 
    82   MPI_Fint MPI_Comm_c2f(MPI_Comm comm) 
    83   { 
    84     Debug("MPI_Comm_c2f"); 
    85     int fint; 
    86     fint = (::MPI_Fint)(comm.mpi_comm); 
     79  // MPI_Fint MPI_Comm_c2f(MPI_Comm comm) 
     80  // { 
     81  //   Debug("MPI_Comm_c2f"); 
     82  //   int fint; 
     83  //   fint = (::MPI_Fint)(comm.mpi_comm); 
    8784     
    88     std::map<std::pair<int, int>, MPI_Comm  > ::iterator it; 
     85  //   std::map<std::pair<int, int>, MPI_Comm  > ::iterator it; 
    8986     
    90     it = fc_comm_map.find(std::make_pair(fint, omp_get_thread_num())); 
    91     if(it == fc_comm_map.end()) 
    92     { 
    93       fc_comm_map.insert(std::make_pair( std::make_pair( fint, omp_get_thread_num()) , comm)); 
    94       printf("MAP insert: %d, %d, %p\n", fint, omp_get_thread_num(), &comm); 
    95     } 
     87  //   it = fc_comm_map.find(std::make_pair(fint, omp_get_thread_num())); 
     88  //   if(it == fc_comm_map.end()) 
     89  //   { 
     90  //     fc_comm_map.insert(std::make_pair( std::make_pair( fint, omp_get_thread_num()) , comm)); 
     91  //     printf("MAP insert: %d, %d, %p\n", fint, omp_get_thread_num(), &comm); 
     92  //   } 
    9693     
    97     MPI_Fint Fint; 
    98     Fint.mpi_fint = fint; 
    99     return Fint; 
     94  //   MPI_Fint Fint; 
     95  //   Fint.mpi_fint = fint; 
     96  //   return Fint; 
    10097     
    101   } 
     98  // } 
    10299 
    103100   
    104101 
    105102 
    106   MPI_Comm MPI_Comm_f2c(MPI_Fint comm) 
    107   { 
    108     Debug("MPI_Comm_f2c"); 
     103  // MPI_Comm MPI_Comm_f2c(MPI_Fint comm) 
     104  // { 
     105  //   Debug("MPI_Comm_f2c"); 
    109106     
    110107     
    111     std::map<std::pair<int, int>, MPI_Comm  > ::iterator it; 
     108  //   std::map<std::pair<int, int>, MPI_Comm  > ::iterator it; 
    112109     
    113     it = fc_comm_map.find(std::make_pair(comm.mpi_fint, omp_get_thread_num())); 
    114     if(it != fc_comm_map.end()) 
    115     { 
    116       MPI_Comm comm_ptr; 
    117       comm_ptr =  it->second; 
    118       printf("MAP find: %d, %d, %p\n", it->first.first, it->first.second, &comm_ptr); 
    119       return  comm_ptr; 
    120     } 
    121     else 
    122     {       
    123       MPI_Comm return_comm; 
    124       return_comm.mpi_comm = (::MPI_Comm)(comm.mpi_fint); 
    125       return return_comm; 
    126     } 
    127   } 
     110  //   it = fc_comm_map.find(std::make_pair(comm.mpi_fint, omp_get_thread_num())); 
     111  //   if(it != fc_comm_map.end()) 
     112  //   { 
     113  //     MPI_Comm comm_ptr; 
     114  //     comm_ptr =  it->second; 
     115  //     printf("MAP find: %d, %d, %p\n", it->first.first, it->first.second, &comm_ptr); 
     116  //     return  comm_ptr; 
     117  //   } 
     118  //   else 
     119  //   {       
     120  //     MPI_Comm return_comm; 
     121  //     return_comm.mpi_comm = (::MPI_Comm)(comm.mpi_fint); 
     122  //     return return_comm; 
     123  //   } 
     124  // } 
    128125 
    129126   
    130127 
    131   #elif _openmpi 
     128  // #elif _openmpi 
    132129   
    133   int MPI_Comm_c2f(MPI_Comm comm) 
    134   { 
    135     Debug("MPI_Comm_c2f"); 
    136     int fint; 
    137     fint = ::MPI_Comm_c2f(static_cast< ::MPI_Comm>(comm.mpi_comm)); 
     130  // int MPI_Comm_c2f(MPI_Comm comm) 
     131  // { 
     132  //   Debug("MPI_Comm_c2f"); 
     133  //   int fint; 
     134  //   fint = ::MPI_Comm_c2f(static_cast< ::MPI_Comm>(comm.mpi_comm)); 
    138135     
    139     std::map<std::pair<int, int>, MPI_Comm > ::iterator it; 
     136  //   std::map<std::pair<int, int>, MPI_Comm > ::iterator it; 
    140137     
    141     it = fc_comm_map.find(std::make_pair(fint, omp_get_thread_num())); 
    142     if(it == fc_comm_map.end()) 
    143     { 
    144       fc_comm_map.insert(std::make_pair( std::make_pair( fint, omp_get_thread_num()) , comm)); 
    145       printf("MAP insert: %d, %d, %p\n", fint, omp_get_thread_num(), &comm); 
    146     } 
     138  //   it = fc_comm_map.find(std::make_pair(fint, omp_get_thread_num())); 
     139  //   if(it == fc_comm_map.end()) 
     140  //   { 
     141  //     fc_comm_map.insert(std::make_pair( std::make_pair( fint, omp_get_thread_num()) , comm)); 
     142  //     printf("MAP insert: %d, %d, %p\n", fint, omp_get_thread_num(), &comm); 
     143  //   } 
    147144     
    148     return fint; 
     145  //   return fint; 
    149146     
    150   } 
     147  // } 
    151148 
    152   ep_lib::MPI_Comm MPI_Comm_f2c(MPI_Fint comm) 
    153   { 
    154     Debug("MPI_Comm_f2c"); 
     149  // ep_lib::MPI_Comm MPI_Comm_f2c(MPI_Fint comm) 
     150  // { 
     151  //   Debug("MPI_Comm_f2c"); 
    155152     
    156153     
    157     std::map<std::pair<int, int>, MPI_Comm > ::iterator it; 
     154  //   std::map<std::pair<int, int>, MPI_Comm > ::iterator it; 
    158155     
    159     it = fc_comm_map.find(std::make_pair(comm, omp_get_thread_num())); 
    160     if(it != fc_comm_map.end()) 
    161     { 
    162       MPI_Comm comm_ptr; 
    163       comm_ptr =  it->second; 
    164       printf("MAP find: %d, %d, %p\n", it->first.first, it->first.second, comm_ptr); 
    165       return  comm_ptr; 
    166     } 
    167     else 
    168     {       
    169       MPI_Comm return_comm; 
    170       return_comm.mpi_comm = (::MPI_Comm)(comm); 
    171       return return_comm; 
    172     } 
    173   } 
    174   #endif 
     156  //   it = fc_comm_map.find(std::make_pair(comm, omp_get_thread_num())); 
     157  //   if(it != fc_comm_map.end()) 
     158  //   { 
     159  //     MPI_Comm comm_ptr; 
     160  //     comm_ptr =  it->second; 
     161  //     printf("MAP find: %d, %d, %p\n", it->first.first, it->first.second, &comm_ptr); 
     162  //     return  comm_ptr; 
     163  //   } 
     164  //   else 
     165  //   {       
     166  //     MPI_Comm return_comm; 
     167  //     return_comm.mpi_comm = (::MPI_Comm)(comm); 
     168  //     return return_comm; 
     169  //   } 
     170  // } 
     171  // #endif 
    175172 
    176173} 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_intercomm_kernel.cpp

    r1067 r1068  
    351351        #pragma omp critical (write_to_tag_list) 
    352352        tag_list.push_back(make_pair( make_pair(tag, min(leader_info[0], leader_info[1])) , ep_intercomm)); 
    353         printf("tag_list size = %lu\n", tag_list.size()); 
     353        //printf("tag_list size = %lu\n", tag_list.size()); 
    354354      } 
    355355 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_lib.hpp

    r1053 r1068  
    1515  typedef int MPI_Datatype; 
    1616  typedef int MPI_Op; 
     17  #define MPI_ANY_SOURCE -2  
     18  #define MPI_ANY_TAG -1  
    1719#elif _openmpi 
    1820  typedef void* MPI_Datatype; 
    1921  typedef void* MPI_Op; 
    20 #endif 
    21  
    22 #ifdef _intelmpi 
    23   #define MPI_ANY_SOURCE -2  
    24   #define MPI_ANY_TAG -1  
    25 #elif _openmpi 
    2622  #define MPI_ANY_SOURCE -1  
    2723  #define MPI_ANY_TAG -1  
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_lib_fortran.hpp

    r1053 r1068  
    77{ 
    88   
    9   #ifdef _intelmpi 
     9  // #ifdef _intelmpi 
    1010   
    11   MPI_Fint MPI_Comm_c2f(MPI_Comm comm); 
    12   MPI_Comm MPI_Comm_f2c(MPI_Fint comm); 
     11  // MPI_Fint MPI_Comm_c2f(MPI_Comm comm); 
     12  // MPI_Comm MPI_Comm_f2c(MPI_Fint comm); 
    1313   
    14   #elif _openmpi 
     14  // #elif _openmpi 
    1515   
    16   int MPI_Comm_c2f(MPI_Comm comm); 
    17   ep_lib::MPI_Comm MPI_Comm_f2c(MPI_Fint comm); 
     16  // int MPI_Comm_c2f(MPI_Comm comm); 
     17  // ep_lib::MPI_Comm MPI_Comm_f2c(MPI_Fint comm); 
    1818   
    19   #endif 
     19  // #endif 
    2020 
    2121  int EP_Comm_c2f(MPI_Comm comm); 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_message.cpp

    r1067 r1068  
    2020    MPI_Comm_rank(comm, &myRank); 
    2121 
    22     //printf("myRank = %d, comm.is_ep = %d, comm.is_intercomm = %d\n", myRank, comm.is_ep, comm.is_intercomm); 
    2322    if(!comm.is_ep) return 0; 
    2423 
     
    5352      //::MPI_Improbe(MPI_ANY_SOURCE, MPI_ANY_TAG, mpi_comm, &flag, &message, &status);  
    5453      ::MPI_Improbe(-2, -1, mpi_comm, &flag, &message, &status);  
    55       //printf("myRank = %d, ::MPI_Improbe flag = %d\n", myRank, flag);      
    5654      #endif 
    5755 
     
    159157          #pragma omp flush 
    160158          ptr_comm_target->ep_comm_ptr->message_queue->push_back(*msg_block); 
    161           //printf("probed one message, ep_src = %d, ep_dest = %d, tag = %d, queue = %p, message = %d\n", msg_block->ep_src, msg_block->ep_dest, msg_block->ep_tag, ptr_comm_target->ep_comm_ptr->message_queue, msg_block->mpi_message); 
    162159          #pragma omp flush 
    163160        } 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_type.cpp

    r1053 r1068  
    1212#undef MPI_COMM_NULL 
    1313 
    14 //::MPI_Info MPI_INFO_NULL_STD = MPI_INFO_NULL; 
    15 //#undef MPI_INFO_NULL 
    1614 
    1715::MPI_Request MPI_REQUEST_NULL_STD = MPI_REQUEST_NULL; 
    1816#undef MPI_REQUEST_NULL 
     17 
     18::MPI_Info MPI_INFO_NULL_STD = MPI_INFO_NULL; 
     19#undef MPI_INFO_NULL 
    1920 
    2021::MPI_Datatype MPI_INT_STD = MPI_INT; 
     
    4344#undef MPI_MIN 
    4445 
    45 #ifdef _openmpi 
    46 //#undef MPI_Fint 
    47 #endif 
    4846 
    4947 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_type.hpp

    r1067 r1068  
    4242{ 
    4343  #define MPI_UNDEFINED -32766 
    44   //#define MPI_STATUS_IGNORE NULL 
    45   //#define MPI_INFO_NULL MPI_Info(MPI_INFO_NULL_STD) 
    4644 
    4745  class ep_communicator; 
     
    8583 
    8684      MPI_Message() {} 
     85 
    8786      #ifdef _intelmpi 
    8887      MPI_Message(int message): mpi_message(message) {} 
     
    354353      #endif 
    355354 
    356       MPI_Info() {} 
     355      MPI_Info(){ } 
    357356       
    358357      #ifdef _intelmpi 
  • XIOS/dev/branch_yushan/src/client.cpp

    r1067 r1068  
    230230      MPI_Comm_rank(intraComm,&rank) ; 
    231231       
    232       printf("CClient::finalize called isServer = %d\n", CXios::isServer); 
     232      //printf("CClient::finalize called isServer = %d\n", CXios::isServer); 
    233233  
    234234      if (!CXios::isServer) 
     
    238238        { 
    239239          MPI_Send(&msg,1,MPI_INT,0,0,interComm) ; 
    240           printf(" CClient : send finalize sign to server 0\n"); 
     240          //printf(" CClient : send finalize sign to server 0\n"); 
    241241        } 
    242242      } 
  • XIOS/dev/branch_yushan/src/cxios.cpp

    r1060 r1068  
    7777    MPI_Info info; 
    7878    MPI_Comm *ep_comm; 
    79     MPI_Comm_create_endpoints(MPI_COMM_WORLD, num_ep, info, ep_comm);  // servers should reach here too. 
    80        
    81     globalComm = ep_comm[0]; 
     79    if(omp_get_thread_num()==0) 
     80    { 
     81      MPI_Comm_create_endpoints(MPI_COMM_WORLD, num_ep, info, ep_comm);  // servers should reach here too. 
     82      passage = ep_comm;   
     83    } 
     84     
     85    #pragma omp barrier 
     86       
     87    globalComm = passage[omp_get_thread_num()]; 
    8288     
    8389    int tmp_size; 
  • XIOS/dev/branch_yushan/src/interface/c/icdata.cpp

    r1067 r1068  
    6464      MPI_Initialized(&initialized); 
    6565 
     66      #ifdef _usingEP 
    6667      if (initialized) local_comm = ep_lib::EP_Comm_f2c(static_cast< int >(*f_local_comm)); 
    6768      else local_comm = MPI_COMM_NULL; 
    68        
     69      #else 
     70      if (initialized) local_comm=MPI_Comm_f2c(*f_local_comm); 
     71      else local_comm = MPI_COMM_NULL; 
     72      #endif 
    6973      
    7074 
    7175      CXios::initClientSide(str, local_comm, return_comm); 
    7276 
     77      #ifdef _usingEP 
    7378      *f_return_comm = ep_lib::EP_Comm_c2f(return_comm); 
    74  
    75       //printf("in icdata.cpp, f_return_comm = %d\n", *f_return_comm); 
     79      #else 
     80      *f_return_comm = MPI_Comm_c2f(return_comm); 
     81      #endif 
    7682 
    7783      CTimer::get("XIOS init").suspend(); 
     
    8995     comm = ep_lib::EP_Comm_f2c(static_cast< int >(*f_comm)); 
    9096 
    91      //ep_lib::MPI_Comm ctx_comm; 
    92      //ep_lib::MPI_Comm_dup(comm, &ctx_comm); 
    9397     
    9498     CClient::registerContext(str,comm); 
    9599      
    96      printf("icdata.cpp: client register context %s : %p\n", context_id, &comm); 
     100     //printf("icdata.cpp: client register context %s : %p\n", context_id, &comm); 
    97101      
    98102     CTimer::get("XIOS init context").suspend(); 
  • XIOS/dev/branch_yushan/src/interface/c/oasis_cinterface.cpp

    r1053 r1068  
    2626     
    2727    fxios_oasis_get_localcomm(&f_comm) ; 
    28     //comm=MPI_Comm_f2c(f_comm) ; 
     28    #ifdef _usingEP 
     29    comm=EP_Comm_f2c(f_comm.mpi_fint) ; 
     30    #else 
     31    comm=MPI_Comm_f2c(f_comm) ; 
     32    #endif 
    2933  } 
    3034  
     
    3438     
    3539    fxios_oasis_get_intracomm(&f_comm,server_id.data(),server_id.size()) ; 
    36     //comm_client_server=MPI_Comm_f2c(f_comm) ; 
     40    #ifdef _usingEP 
     41    comm_client_server=EP_Comm_f2c(f_comm.mpi_fint) ; 
     42    #else 
     43    comm_client_server=MPI_Comm_f2c(f_comm) ; 
     44    #endif 
    3745  } 
    3846  
     
    4250     
    4351    fxios_oasis_get_intercomm(&f_comm,server_id.data(),server_id.size()) ; 
    44     //comm_client_server=MPI_Comm_f2c(f_comm) ; 
     52    #ifdef _usingEP 
     53    comm_client_server=EP_Comm_f2c(f_comm.mpi_fint) ; 
     54    #else 
     55    comm_client_server=MPI_Comm_f2c(f_comm) ; 
     56    #endif 
    4557  } 
    4658} 
  • XIOS/dev/branch_yushan/src/io/onetcdf4.cpp

    r1063 r1068  
    4747         wmpi = comm && !multifile; 
    4848          
    49          ep_lib::MPI_Info info_null; 
     49         //ep_lib::MPI_Info info_null; 
    5050 
    5151         if (wmpi) 
     
    5757            if (wmpi) 
    5858            { 
    59                CNetCdfInterface::createPar(filename, mode, static_cast<MPI_Comm>(comm->mpi_comm), static_cast<MPI_Info>(info_null.mpi_info), this->ncidp); 
    60                printf("creating file with createPar\n"); 
     59               // printf("start creating file with createPar\n"); 
     60               //CNetCdfInterface::createPar(filename, mode, static_cast<MPI_Comm>(comm->mpi_comm), static_cast<MPI_Info>(info_null.mpi_info), this->ncidp); 
     61               CNetCdfInterface::createPar(filename, mode, static_cast<MPI_Comm>(comm->mpi_comm), MPI_INFO_NULL_STD, this->ncidp); 
     62               // printf("creating file with createPar\n"); 
    6163            } 
    6264            else 
     
    7476            if (wmpi) 
    7577            { 
    76                CNetCdfInterface::openPar(filename, mode, static_cast<MPI_Comm>(comm->mpi_comm), static_cast<MPI_Info>(info_null.mpi_info), this->ncidp); 
    77                printf("opening file with openPar\n"); 
     78//               printf("start opening file with openPar\n"); 
     79               // CNetCdfInterface::openPar(filename, mode, static_cast<MPI_Comm>(comm->mpi_comm), static_cast<MPI_Info>(info_null.mpi_info), this->ncidp); 
     80               CNetCdfInterface::openPar(filename, mode, static_cast<MPI_Comm>(comm->mpi_comm), MPI_INFO_NULL_STD, this->ncidp); 
     81//               printf("opening file with openPar\n"); 
    7882            } 
    7983            else 
Note: See TracChangeset for help on using the changeset viewer.