Ignore:
Timestamp:
10/06/17 13:56:33 (7 years ago)
Author:
yushan
Message:

EP update all

File:
1 edited

Legend:

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

    r1289 r1295  
    99#include <mpi.h> 
    1010#include "ep_declaration.hpp" 
     11#include "ep_mpi.hpp" 
    1112 
    1213using namespace std; 
     
    2021  int Message_Check(MPI_Comm comm) 
    2122  { 
    22     int myRank; 
    23     MPI_Comm_rank(comm, &myRank); 
    24  
    2523    if(!comm.is_ep) return 0; 
    2624 
     
    3836    { 
    3937      Debug("Message probing for intracomm\n"); 
    40       ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm> (comm.mpi_comm); 
     38       
     39 
    4140      #ifdef _openmpi 
    4241      #pragma omp critical (_mpi_call) 
    4342      { 
    44         ::MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, mpi_comm, &flag, &status); 
     43        ::MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, to_mpi_comm(comm.mpi_comm), &flag, &status); 
    4544        if(flag) 
    4645        { 
     
    4847          mpi_source = status.MPI_SOURCE; 
    4948          int tag = status.MPI_TAG; 
    50           ::MPI_Mprobe(mpi_source, tag, mpi_comm, &message, &status); 
     49          ::MPI_Mprobe(mpi_source, tag, to_mpi_comm(comm.mpi_comm), &message, &status); 
    5150 
    5251        } 
    5352      } 
    5453      #elif _intelmpi 
    55       #pragma omp critical (_mpi_call) 
    56       ::MPI_Improbe(MPI_ANY_SOURCE, MPI_ANY_TAG, mpi_comm, &flag, &message, &status);  
     54      ::MPI_Improbe(MPI_ANY_SOURCE, MPI_ANY_TAG, to_mpi_comm(comm.mpi_comm), &flag, &message, &status);  
    5755      #endif 
    5856       
     
    6866              
    6967        msg_block->ep_src  = get_ep_rank(comm, src_loc,  src_mpi);        
    70         int dest_mpi = comm.ep_comm_ptr->size_rank_info[2].first; 
    71         int ep_dest = get_ep_rank(comm, dest_loc, dest_mpi); 
    7268        msg_block->mpi_status = new ::MPI_Status(status); 
    7369 
     
    7975        { 
    8076          #pragma omp flush 
    81           ptr_comm_target->ep_comm_ptr->message_queue->push_back(*msg_block);   
    82      
     77          comm.ep_comm_ptr->comm_list[dest_loc].ep_comm_ptr->message_queue->push_back(*msg_block);       
    8378          #pragma omp flush 
    8479        } 
     
    110105    { 
    111106      Debug("Message probing for intracomm\n"); 
    112       ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm> (comm.ep_comm_ptr->intercomm->mpi_inter_comm);  // => mpi_intercomm 
    113        
     107 
    114108      #ifdef _openmpi 
    115109      #pragma omp critical (_mpi_call) 
    116110      { 
    117         ::MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, mpi_comm, &flag, &status); 
     111        ::MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, to_mpi_comm(comm.ep_comm_ptr->intercomm->mpi_inter_comm), &flag, &status); 
    118112        if(flag) 
    119113        { 
     
    121115          mpi_source = status.MPI_SOURCE; 
    122116          int tag = status.MPI_TAG; 
    123           ::MPI_Mprobe(mpi_source, tag, mpi_comm, &message, &status); 
     117          ::MPI_Mprobe(mpi_source, tag, to_mpi_comm(comm.ep_comm_ptr->intercomm->mpi_inter_comm), &message, &status); 
    124118 
    125119        } 
    126120      } 
    127121      #elif _intelmpi 
    128       #pragma omp critical (_mpi_call) 
    129       ::MPI_Improbe(MPI_ANY_SOURCE, MPI_ANY_TAG, mpi_comm, &flag, &message, &status);        
     122      ::MPI_Improbe(MPI_ANY_SOURCE, MPI_ANY_TAG, to_mpi_comm(comm.ep_comm_ptr->intercomm->mpi_inter_comm), &flag, &message, &status);        
    130123      #endif 
    131124 
     
    153146        { 
    154147          #pragma omp flush 
    155           ptr_comm_target->ep_comm_ptr->message_queue->push_back(*msg_block); 
     148          comm.ep_comm_ptr->comm_list[dest_loc].ep_comm_ptr->message_queue->push_back(*msg_block); 
    156149          #pragma omp flush 
    157150        } 
     
    167160    { 
    168161      Debug("Message probing for intracomm\n"); 
    169       ::MPI_Comm mpi_comm = static_cast< ::MPI_Comm> (comm.mpi_comm); 
     162      
    170163      #ifdef _openmpi 
    171164      #pragma omp critical (_mpi_call) 
    172165      { 
    173         ::MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, mpi_comm, &flag, &status); 
     166        ::MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, to_mpi_comm(comm.mpi_comm), &flag, &status); 
    174167        if(flag) 
    175168        { 
     
    177170          mpi_source = status.MPI_SOURCE; 
    178171          int tag = status.MPI_TAG; 
    179           ::MPI_Mprobe(mpi_source, tag, mpi_comm, &message, &status); 
     172          ::MPI_Mprobe(mpi_source, tag, to_mpi_comm(comm.mpi_comm), &message, &status); 
    180173 
    181174        } 
    182175      } 
    183176      #elif _intelmpi 
    184       #pragma omp critical (_mpi_call) 
    185       ::MPI_Improbe(MPI_ANY_SOURCE, MPI_ANY_TAG, mpi_comm, &flag, &message, &status);        
     177      ::MPI_Improbe(MPI_ANY_SOURCE, MPI_ANY_TAG, to_mpi_comm(comm.mpi_comm), &flag, &message, &status);        
    186178      #endif 
    187179 
     
    196188        int dest_loc      = bitset<8> (status.MPI_TAG)      .to_ulong(); 
    197189        int src_mpi       = status.MPI_SOURCE; 
    198         int current_inter = comm.ep_comm_ptr->intercomm->local_rank_map->at(current_ep_rank).first; 
    199190         
    200191        msg_block->ep_src  = get_ep_rank_intercomm(comm, src_loc, src_mpi); 
     
    209200        { 
    210201          #pragma omp flush 
    211           ptr_comm_target->ep_comm_ptr->message_queue->push_back(*msg_block); 
     202          comm.ep_comm_ptr->comm_list[dest_loc].ep_comm_ptr->message_queue->push_back(*msg_block); 
    212203          #pragma omp flush 
    213204        } 
Note: See TracChangeset for help on using the changeset viewer.