Ignore:
Timestamp:
12/05/17 16:24:42 (7 years ago)
Author:
yushan
Message:

unify MPI_Comm type

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_openmp/extern/src_ep_dev/ep_type.hpp

    r1354 r1355  
    5757    public: 
    5858 
    59       #ifdef _intelmpi 
    6059      int ep_datatype; 
    61       #elif _openmpi 
    62       void * ep_datatype; 
    63       #endif 
    64        
    6560      int ep_src; 
    6661      int ep_tag; 
    67  
    68        
    6962      void* mpi_status; 
    7063  }; 
     
    7467    public: 
    7568 
    76       #ifdef _intelmpi 
    7769      int mpi_message; 
    78       #elif _openmpi 
    79       void * mpi_message; 
    80       #endif 
    81  
    8270      int ep_src; 
    8371      int ep_tag; 
    84  
    8572      void* mpi_status; 
    8673 
    8774      MPI_Message() {} 
    88  
    89       #ifdef _intelmpi 
    9075      MPI_Message(int message): mpi_message(message) {} 
    91       #elif _openmpi 
    92       MPI_Message(void* message): mpi_message(message) {} 
    93       #endif 
    9476  }; 
    9577 
     
    152134    public: 
    153135 
    154  
    155     // #ifdef _intelmpi 
    156     // int mpi_inter_comm; 
    157     // #elif _openmpi 
    158     // void * mpi_inter_comm; 
    159     // #endif 
    160  
    161     void * mpi_inter_comm; 
     136    int *mpi_inter_comm; 
    162137 
    163138    RANK_MAP *intercomm_rank_map; 
     
    172147    int intercomm_tag; 
    173148 
    174     ep_intercomm() 
    175     { 
    176       intercomm_rank_map = NULL; 
    177       local_rank_map = NULL; 
    178       remote_rank_map = NULL; 
    179     } 
    180  
    181  
    182     bool operator == (ep_intercomm right) 
    183     { 
    184       bool a = intercomm_rank_map == right.intercomm_rank_map; 
    185       bool b = local_rank_map == right.local_rank_map; 
    186       bool c = remote_rank_map == right.remote_rank_map; 
    187       bool d = mpi_inter_comm == right.mpi_inter_comm; 
    188       bool e = size_rank_info == right.size_rank_info; 
    189       bool f = intercomm_tag == right.intercomm_tag; 
    190       return a&&b&&c&&d&&e&&f; 
    191     } 
    192  
    193     bool operator != (ep_intercomm right) 
    194     { 
    195       bool a = intercomm_rank_map != right.intercomm_rank_map; 
    196       bool b = local_rank_map != right.local_rank_map; 
    197       bool c = remote_rank_map != right.remote_rank_map; 
    198       bool d = mpi_inter_comm != right.mpi_inter_comm; 
    199       bool e = size_rank_info != right.size_rank_info; 
    200       bool f = intercomm_tag != right.intercomm_tag; 
    201       return a||b||c||d||e||f; 
    202     } 
     149    ep_intercomm(); 
     150    bool operator == (ep_intercomm right); 
     151    bool operator != (ep_intercomm right); 
     152     
    203153 
    204154 
     
    224174    ep_intercomm *intercomm; 
    225175 
    226     ep_communicator() 
    227     { 
    228       comm_list = NULL; 
    229       message_queue = NULL; 
    230       intercomm = NULL; 
    231     } 
    232  
    233     bool operator == (ep_communicator right) 
    234     { 
    235       bool a = size_rank_info == right.size_rank_info; 
    236       bool b = comm_label == right.comm_label; 
    237       bool c = intercomm == right.intercomm; 
    238       return a&&b&&c; 
    239     } 
    240  
    241     bool operator != (ep_communicator right) 
    242     { 
    243       bool a = size_rank_info != right.size_rank_info; 
    244       bool b = comm_label != right.comm_label; 
    245       bool c = intercomm != right.intercomm; 
    246       return a||b||c; 
    247     } 
    248  
     176    ep_communicator(); 
     177    bool operator == (ep_communicator right); 
     178    bool operator != (ep_communicator right); 
     179     
    249180  }; 
    250181 
     
    259190  { 
    260191    public: 
    261  
    262     // #ifdef _intelmpi 
    263     // int mpi_comm; 
    264     // #elif _openmpi 
    265     // void * mpi_comm; 
    266     // #endif 
    267  
    268     void * mpi_comm; 
    269192 
    270193    bool is_ep; 
     
    274197    OMPbarrier *ep_barrier; 
    275198    RANK_MAP   *rank_map; 
    276  
     199    int* mpi_comm; 
    277200    EP_Comm ep_comm_ptr; 
    278  
    279201    MPI_Comm *mem_bridge; 
    280  
    281  
    282     // #ifdef _intelmpi 
    283     // int mpi_bridge; 
    284     // #elif _openmpi 
    285     // void * mpi_bridge; 
    286     // #endif 
    287  
    288     void * mpi_bridge; 
    289  
    290     MPI_Comm() 
    291     { 
    292       is_ep = true; 
    293       is_intercomm = false; 
    294       my_buffer = NULL; 
    295       ep_barrier = NULL; 
    296       rank_map = NULL; 
    297       ep_comm_ptr = NULL; 
    298       mem_bridge = NULL; 
    299       mpi_bridge = NULL; 
    300     } 
    301  
    302     // #ifdef _intelmpi 
    303     // MPI_Comm(int comm) 
    304     // { 
    305     //   is_ep = false; 
    306     //   is_intercomm = false; 
    307     //   my_buffer = NULL; 
    308     //   ep_barrier = NULL; 
    309     //   rank_map = NULL; 
    310     //   ep_comm_ptr = NULL; 
    311     //   mem_bridge = NULL; 
    312     //   mpi_bridge = NULL; 
    313     //   mpi_comm = comm; 
    314     // } 
    315  
    316     // #elif _openmpi 
    317  
    318     // MPI_Comm(void* comm) 
    319     // { 
    320     //   is_ep = false; 
    321     //   is_intercomm = false; 
    322     //   my_buffer = NULL; 
    323     //   ep_barrier = NULL; 
    324     //   rank_map = NULL; 
    325     //   ep_comm_ptr = NULL; 
    326     //   mem_bridge = NULL; 
    327     //   mpi_bridge = NULL; 
    328     //   mpi_comm = comm; 
    329     // } 
    330     // #endif 
    331      
    332     MPI_Comm(void* comm) 
    333     { 
    334       is_ep = false; 
    335       is_intercomm = false; 
    336       my_buffer = NULL; 
    337       ep_barrier = NULL; 
    338       rank_map = NULL; 
    339       ep_comm_ptr = NULL; 
    340       mem_bridge = NULL; 
    341       mpi_bridge = NULL; 
    342       mpi_comm = comm; 
    343     } 
    344  
    345     bool operator == (MPI_Comm right) 
    346     { 
    347       bool a = is_ep == right.is_ep; 
    348       bool b = is_intercomm == right.is_intercomm; 
    349       bool c = mpi_comm == right.mpi_comm; 
    350       bool d = is_ep ? ep_comm_ptr == right.ep_comm_ptr : true; 
    351       return a&&b&&c&&d; 
    352     } 
    353  
    354     bool operator != (MPI_Comm right) 
    355     { 
    356       bool a = is_ep != right.is_ep; 
    357       bool b = is_intercomm != right.is_intercomm; 
    358       bool c = mpi_comm != right.mpi_comm; 
    359       bool d = is_ep ? ep_comm_ptr != right.ep_comm_ptr : true; 
    360  
    361       return a||b||c||d; 
    362     } 
    363  
     202    int* mpi_bridge; 
     203 
     204    MPI_Comm();   
     205    //MPI_Comm(const MPI_Comm &comm); 
     206    MPI_Comm(int* comm); 
     207 
     208 
     209    bool operator == (MPI_Comm right); 
     210    bool operator != (MPI_Comm right); 
    364211    bool is_null(); 
    365212 
     
    371218    public: 
    372219 
    373       #ifdef _intelmpi 
    374220      int mpi_info; 
    375       #elif _openmpi 
    376       void * mpi_info; 
    377       #endif 
    378221 
    379222      MPI_Info(){ } 
    380        
    381       #ifdef _intelmpi 
    382223      MPI_Info(int info): mpi_info(info) {} 
    383       #elif _openmpi 
    384       MPI_Info(void* info): mpi_info(info) {} 
    385       #endif 
    386224  }; 
    387225 
     
    391229    public: 
    392230 
    393       #ifdef _intelmpi 
    394231      int mpi_request; 
    395       #elif _openmpi 
    396       void * mpi_request; 
    397       #endif 
    398232 
    399233      int type; //! type of the non-blocking communication. 1: Isend; 2:Irecv; 3:Imrecv; 4:Issend 
     
    402236      int ep_src; 
    403237      int ep_tag; 
    404       #ifdef _intelmpi 
    405238      int ep_datatype; 
    406       #elif _openmpi 
    407       void * ep_datatype; 
    408       #endif 
    409239 
    410240      MPI_Comm comm;    //! EP communicator related to the communication 
    411241 
    412242      MPI_Request() {} 
    413  
    414       #ifdef _intelmpi 
    415243      MPI_Request(int request): mpi_request(request) {} 
    416       #elif _openmpi 
    417       MPI_Request(void* request): mpi_request(request) {} 
    418       #endif 
    419  
    420  
    421     bool operator == (MPI_Request right) 
    422     { 
    423       //bool a = mpi_request == right.mpi_request; 
    424       bool b = type == right.type; 
    425       bool c = buf == right.buf; 
    426       bool d = ep_src == right.ep_src; 
    427       bool e = ep_tag == right.ep_tag; 
    428       bool f = ep_datatype == right.ep_datatype; 
    429       return b&&c&&d&&e&&f; 
    430     } 
     244      bool operator == (MPI_Request right); 
     245 
    431246  }; 
    432247 
Note: See TracChangeset for help on using the changeset viewer.