Ignore:
Timestamp:
06/04/18 19:25:08 (3 years ago)
Author:
yushan
Message:

save dev. TO DO : test with xios

File:
1 edited

Legend:

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

    r1374 r1520  
    99#include <mpi.h> 
    1010#include "ep_declaration.hpp" 
     11#include "ep_mpi.hpp" 
    1112 
    1213using namespace std; 
     
    2223  int MPI_Wait(MPI_Request *request, MPI_Status *status) 
    2324  { 
    24     if(request->type !=1 && request->type !=2 && request->type !=3)  
     25    if((*request)->type !=1 && (*request)->type !=2 && (*request)->type !=3)  
    2526    { 
    2627      printf("Error in request type\n"); 
     
    2930    } 
    3031 
    31     while(request->type == 2) Request_Check(); 
     32    while((*request)->type == 2) Request_Check(); 
     33     
     34    ::MPI_Wait(to_mpi_request_ptr(*request), to_mpi_status_ptr(status)); 
    3235 
     36     
     37    status->ep_src = (*request)->ep_src; 
     38    status->ep_tag = (*request)->ep_tag; 
     39    status->ep_datatype = (*request)->ep_datatype; 
     40     
     41    (*request)->state = 2; 
    3342 
    34     //::MPI_Request mpi_request = static_cast< ::MPI_Request >(request->mpi_request); 
    35     ::MPI_Status mpi_status; 
    36     ::MPI_Wait(static_cast< ::MPI_Request*>(request->mpi_request), &mpi_status); 
    37  
    38     
    39             
    40   
    41     // request->mpi_request = mpi_request; 
    42  
    43     status->mpi_status = &mpi_status; 
    44     status->ep_src = request->ep_src; 
    45     status->ep_tag = request->ep_tag; 
    46     status->ep_datatype = request->ep_datatype; 
     43    memcheck("delete "<< (*request)->mpi_request << " : in ep_lib::MPI_Wait, delete (*request)->mpi_request"); 
     44    delete (*request)->mpi_request; 
     45    delete *request; 
    4746     
    4847 
    49  
    50     return MPI_SUCCESS; 
     48    return Request_Check(); 
    5149 
    5250  }   /*end of mpi_wait*/ 
     
    6967      for(int i=0; i<count; i++) 
    7068      { 
    71         if(array_of_requests[i].type !=1 && array_of_requests[i].type !=2 && array_of_requests[i].type !=3)  
     69        if(array_of_requests[i]->type !=1 && array_of_requests[i]->type !=2 && array_of_requests[i]->type !=3)  
    7270        { 
    7371          printf("Error in request type\n"); 
     
    7674        } 
    7775         
    78         if(array_of_requests[i].type == 2) Request_Check();  
    79         if(array_of_requests[i].type != 2 && finished.at(i) == 0)  
     76        if(array_of_requests[i]->type == 2) Request_Check();  
     77        if(array_of_requests[i]->type != 2 && finished.at(i) == 0)  
    8078        { 
    8179          finished.at(i) = 1; 
    82           //mpi_request[i] = static_cast< ::MPI_Request >(array_of_requests[i].mpi_request); 
    83           mpi_request[i] = *static_cast< ::MPI_Request*>(array_of_requests[i].mpi_request); 
     80          mpi_request[i] = *static_cast< ::MPI_Request*>(array_of_requests[i]->mpi_request); 
    8481        } 
    8582      }     
     
    9188    { 
    9289      array_of_statuses[i].mpi_status = &mpi_status[i]; 
    93       array_of_statuses[i].ep_src = array_of_requests[i].ep_src; 
    94       array_of_statuses[i].ep_tag = array_of_requests[i].ep_tag; 
    95       array_of_statuses[i].ep_datatype = array_of_requests[i].ep_datatype; 
     90      array_of_statuses[i].ep_src = array_of_requests[i]->ep_src; 
     91      array_of_statuses[i].ep_tag = array_of_requests[i]->ep_tag; 
     92      array_of_statuses[i].ep_datatype = array_of_requests[i]->ep_datatype; 
     93       
     94      array_of_requests[i]->state = 2; 
     95       
     96      memcheck("delete "<< array_of_requests[i]->mpi_request <<" : in ep_lib::MPI_Waitall, array_of_requests["<<i<<"]->mpi_request"); 
     97      delete array_of_requests[i]->mpi_request; 
     98      delete array_of_requests[i]; 
    9699    } 
    97100 
     
    99102    delete[] mpi_status; 
    100103     
    101      
    102     return MPI_SUCCESS; 
     104    return Request_Check(); 
    103105  }  /* end of mpi_waitall*/ 
    104106 
Note: See TracChangeset for help on using the changeset viewer.