Ignore:
Timestamp:
06/08/18 15:59:53 (6 years ago)
Author:
yushan
Message:

save dev

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_probe.cpp

    r1522 r1527  
    88  int MPI_Iprobe_mpi(int src, int tag, MPI_Comm comm, int *flag, MPI_Status *status) 
    99  { 
     10    ::MPI_Status mpi_status; 
     11 
     12    ::MPI_Iprobe(src<0? MPI_ANY_SOURCE : src, tag<0? MPI_ANY_TAG: tag, to_mpi_comm(comm->mpi_comm), flag, &mpi_status); 
     13 
     14    status->mpi_status = new ::MPI_Status(mpi_status); 
    1015    status->ep_src = src; 
    1116    status->ep_tag = tag; 
    12     return ::MPI_Iprobe(src<0? MPI_ANY_SOURCE : src, tag<0? MPI_ANY_TAG: tag, to_mpi_comm(comm->mpi_comm), flag, to_mpi_status_ptr(*status)); 
    1317  } 
     18 
     19 
     20  int MPI_Improbe_mpi(int src, int tag, MPI_Comm comm, int *flag, MPI_Message *message, MPI_Status *status) 
     21  { 
     22    ::MPI_Status mpi_status; 
     23    ::MPI_Message mpi_message; 
     24 
     25    #ifdef _openmpi 
     26    #pragma omp critical (_mpi_call) 
     27    { 
     28      ::MPI_Iprobe(src<0? MPI_ANY_SOURCE : src, tag<0? MPI_ANY_TAG: tag, to_mpi_comm(comm->mpi_comm), flag, &mpi_status); 
     29      if(*flag) 
     30      { 
     31        ::MPI_Mprobe(src<0? MPI_ANY_SOURCE : src, tag<0? MPI_ANY_TAG: tag, to_mpi_comm(comm->mpi_comm), &mpi_message, &mpi_status); 
     32      } 
     33    } 
     34    #elif _intelmpi 
     35    ::MPI_Improbe(src<0? MPI_ANY_SOURCE : src, tag<0? MPI_ANY_TAG: tag, to_mpi_comm(comm->mpi_comm), flag, &mpi_message, &mpi_status); 
     36    #endif 
     37       
     38    status->mpi_status = new ::MPI_Status(mpi_status); 
     39    status->ep_src = src; 
     40    status->ep_tag = tag; 
     41 
     42    (*message)->mpi_message = &message; 
     43    (*message)->ep_src = src; 
     44    (*message)->ep_tag = tag; 
     45  } 
     46 
     47 
     48 
    1449 
    1550  int MPI_Iprobe(int src, int tag, MPI_Comm comm, int *flag, MPI_Status *status) 
     
    2459    { 
    2560      Debug("MPI_Iprobe with EP\n"); 
    26        
     61 
    2762      *flag = false; 
    2863     
     
    5388  } 
    5489 
     90   
     91 
    5592 
    5693 
     
    63100    { 
    64101      Debug("calling MPI_Improbe MPI\n"); 
    65  
    66       ::MPI_Status mpi_status; 
    67       ::MPI_Message mpi_message; 
    68  
    69       #ifdef _openmpi 
    70       #pragma omp critical (_mpi_call) 
    71       { 
    72         ::MPI_Iprobe(src<0? MPI_ANY_SOURCE : src, tag<0? MPI_ANY_TAG: tag, to_mpi_comm(comm->mpi_comm), flag, &mpi_status); 
    73         if(*flag) 
    74         { 
    75           ::MPI_Mprobe(src<0? MPI_ANY_SOURCE : src, tag<0? MPI_ANY_TAG: tag, to_mpi_comm(comm->mpi_comm), &mpi_message, &mpi_status); 
    76         } 
    77       } 
    78       #elif _intelmpi 
    79         ::MPI_Improbe(src<0? MPI_ANY_SOURCE : src, tag<0? MPI_ANY_TAG: tag, to_mpi_comm(comm->mpi_comm), flag, &mpi_message, &mpi_status); 
    80       #endif 
    81          
    82       status->mpi_status = &mpi_status; 
    83       status->ep_src = src; 
    84       status->ep_tag = tag; 
    85  
    86       (*message)->mpi_message = &message; 
    87       (*message)->ep_src = src; 
    88       (*message)->ep_tag = tag; 
    89        
    90        
    91       return 0; 
    92     } 
    93  
    94     
     102      return MPI_Improbe_mpi(src, tag, comm, flag, message, status); 
     103    }  
    95104 
    96105    #pragma omp flush 
Note: See TracChangeset for help on using the changeset viewer.