Changeset 1522


Ignore:
Timestamp:
06/05/18 19:14:40 (6 years ago)
Author:
yushan
Message:

Test_client 6*8 clients 2 servers OK. TO DO : intercomm->intracomm, comm_free_intercomm

Location:
XIOS/dev/branch_openmp/extern/ep_dev
Files:
10 edited

Legend:

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

    r1518 r1522  
    535535 
    536536      (*newintercomm)->ep_comm_ptr->intercomm->local_rank_map = new EP_RANK_MAP; 
     537#ifdef _showinfo 
    537538      printf("new local_rank_map = %p\n", (*newintercomm)->ep_comm_ptr->intercomm->local_rank_map); 
     539#endif 
    538540 
    539541      for(std::map<int, std::pair<int, int> >::iterator it = local_comm->ep_rank_map->begin(); it != local_comm->ep_rank_map->end(); it++) 
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_lib.hpp

    r1517 r1522  
    8282 
    8383  int Request_Check(); 
     84   
     85  void show_EP_PendingRequests(std::list< ep_lib::MPI_Request* > * EP_PendingRequest); 
    8486 
    8587  int test_sendrecv(MPI_Comm comm); 
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_lib_mpi.hpp

    r1517 r1522  
    1818  int MPI_Irecv_mpi      (void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Request *request); 
    1919 
    20  
     20  int MPI_Iprobe_mpi(int source, int tag, MPI_Comm comm, int *flag, MPI_Status *status); 
     21   
    2122  int MPI_Comm_rank_mpi(MPI_Comm comm, int* rank); 
    2223  int MPI_Comm_size_mpi(MPI_Comm comm, int* size); 
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_merge.cpp

    r1518 r1522  
    77 
    88 
    9 namespace ep_lib { 
     9namespace ep_lib  
     10{ 
    1011 
    1112  int MPI_Intercomm_merge_unique_leader(MPI_Comm inter_comm, bool high, MPI_Comm *newintracomm) 
     
    198199     
    199200    delete my_triple_list; 
    200   
    201  
    202     return 0; 
    203  
    204  
    205  
    206     Debug("intercomm_merge kernel\n"); 
    207  
    208     //int ep_rank_loc; 
    209     //int num_ep; 
    210  
    211     ep_rank_loc = inter_comm->ep_comm_ptr->size_rank_info[1].first; 
    212     num_ep = inter_comm->ep_comm_ptr->size_rank_info[1].second; 
    213  
    214  
    215  
    216     //int remote_ep_size = inter_comm->ep_comm_ptr->intercomm->remote_rank_map->size(); 
    217  
    218  
    219     MPI_Barrier(inter_comm); 
    220  
    221  
    222     ::MPI_Comm *mpi_intracomm = new ::MPI_Comm; 
    223     MPI_Comm *ep_intracomm; 
    224  
    225     if(ep_rank_loc == 0) 
    226     { 
    227  
    228       ::MPI_Comm mpi_comm = to_mpi_comm(inter_comm->ep_comm_ptr->intercomm->mpi_inter_comm); 
    229  
    230       ::MPI_Intercomm_merge(mpi_comm, high, mpi_intracomm); 
    231       MPI_Info info; 
    232       MPI_Comm_create_endpoints(mpi_intracomm, num_ep, info, ep_intracomm); 
    233  
    234       inter_comm->ep_comm_ptr->comm_list[0]->mem_bridge = ep_intracomm; 
    235  
    236     } 
    237  
    238     MPI_Barrier_local(inter_comm); 
    239  
    240     int inter_rank; 
    241     MPI_Comm_rank(inter_comm, &inter_rank); 
    242      
    243     int my_ep_rank = high? inter_rank+remote_ep_size : inter_rank; 
    244     int my_ep_rank_loc;// = inter_comm->ep_comm_ptr->intercomm->local_comm->ep_comm_ptr->size_rank_info[1].first; 
    245     int my_num_ep_loc;// = inter_comm->ep_comm_ptr->intercomm->local_comm->ep_comm_ptr->size_rank_info[1].second; 
    246     int my_num_ep_total = inter_comm->ep_comm_ptr->comm_list[0]->mem_bridge[0]->ep_comm_ptr->size_rank_info[1].second; 
    247     int my_ep_size = inter_comm->ep_comm_ptr->comm_list[0]->mem_bridge[0]->ep_comm_ptr->size_rank_info[0].second; 
    248  
    249     int tmp_intra_ep_rank_loc = high?my_ep_rank_loc+my_num_ep_total-my_num_ep_loc: my_ep_rank_loc; 
    250  
    251  
    252     *newintracomm = inter_comm->ep_comm_ptr->comm_list[0]->mem_bridge[tmp_intra_ep_rank_loc]; 
    253  
    254     int newintracomm_ep_rank = (*newintracomm)->ep_comm_ptr->size_rank_info[0].first; 
    255     int newintracomm_ep_rank_loc = (*newintracomm)->ep_comm_ptr->size_rank_info[1].first; 
    256     int newintracomm_mpi_rank = (*newintracomm)->ep_comm_ptr->size_rank_info[2].first; 
    257     int newintracomm_ep_size = (*newintracomm)->ep_comm_ptr->size_rank_info[0].second; 
    258     int newintracomm_num_ep = (*newintracomm)->ep_comm_ptr->size_rank_info[1].second; 
    259     int newintracomm_mpi_size = (*newintracomm)->ep_comm_ptr->size_rank_info[2].second; 
    260  
    261  
    262     int buf[3]; 
    263     buf[0] = my_ep_rank; 
    264     buf[1] = tmp_intra_ep_rank_loc; 
    265     buf[2] = (*newintracomm)->ep_comm_ptr->size_rank_info[2].first; 
    266  
    267     // printf("my_ep_rank = %d, tmp_intra_ep_rank_loc = %d, mpi_rank = %d\n", my_ep_rank, tmp_intra_ep_rank_loc, newintracomm->ep_comm_ptr->size_rank_info[2].first); 
    268  
    269     int *rankmap_buf; 
    270     rankmap_buf = new int [3*my_ep_size]; 
    271  
    272     MPI_Allgather(buf, 3, MPI_INT, rankmap_buf, 3, MPI_INT, *newintracomm); 
    273  
    274      
    275     // printf(" ID = %d : rankmap_buf = (%d %d %d), (%d %d %d), (%d %d %d), (%d %d %d), (%d %d %d), (%d %d %d), (%d %d %d), (%d %d %d), (%d %d %d), (%d %d %d), (%d %d %d), (%d %d %d), (%d %d %d), (%d %d %d), (%d %d %d), (%d %d %d)\n", newintracomm_ep_rank, 
    276     //                     rankmap_buf[0], rankmap_buf[1], rankmap_buf[2], rankmap_buf[3], rankmap_buf[4], rankmap_buf[5], rankmap_buf[6], rankmap_buf[7], rankmap_buf[8], rankmap_buf[9], 
    277     //                     rankmap_buf[10], rankmap_buf[11], rankmap_buf[12], rankmap_buf[13], rankmap_buf[14], rankmap_buf[15], rankmap_buf[16], rankmap_buf[17], rankmap_buf[18], rankmap_buf[19],  
    278     //                     rankmap_buf[20], rankmap_buf[21], rankmap_buf[22], rankmap_buf[23], rankmap_buf[24], rankmap_buf[25], rankmap_buf[26], rankmap_buf[27], rankmap_buf[28], rankmap_buf[29], 
    279     //                     rankmap_buf[30], rankmap_buf[31], rankmap_buf[32], rankmap_buf[33], rankmap_buf[34], rankmap_buf[35], rankmap_buf[36], rankmap_buf[37], rankmap_buf[38], rankmap_buf[39], 
    280     //                     rankmap_buf[40], rankmap_buf[41], rankmap_buf[42], rankmap_buf[43], rankmap_buf[44], rankmap_buf[45], rankmap_buf[46], rankmap_buf[47]); 
    281  
    282  
    283     for(int i=0; i<newintracomm_ep_size; i++) 
    284     { 
    285       (*newintracomm)->ep_rank_map->at(rankmap_buf[3*i]).first  = rankmap_buf[3*i+1]; 
    286       (*newintracomm)->ep_rank_map->at(rankmap_buf[3*i]).second = rankmap_buf[3*i+2]; 
    287     } 
    288  
    289  
    290     (*newintracomm)->ep_comm_ptr->size_rank_info[0].first = my_ep_rank; 
    291     (*newintracomm)->ep_comm_ptr->size_rank_info[1].first = tmp_intra_ep_rank_loc; 
    292      
    293  
    294     delete[] rankmap_buf; 
    295  
    296      
    297     return MPI_SUCCESS; 
    298  
    299201  } 
    300  
    301  
     202   
    302203} 
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_message.cpp

    r1517 r1522  
    2323     
    2424    if(EP_PendingRequests->size() == 0) return 0; 
     25     
     26    show_EP_PendingRequests(EP_PendingRequests); 
    2527     
    2628    MPI_Status status; 
     
    3032    std::list<MPI_Request* >::iterator it; 
    3133     
     34//    show_EP_PendingRequests(EP_PendingRequests); 
     35     
    3236     
    3337    for(it = EP_PendingRequests->begin(); it!=EP_PendingRequests->end(); it++) 
    3438    {  
     39      if(*(*it) == 0) 
     40      { 
     41        EP_PendingRequests->erase(it); 
     42         
     43        memcheck("EP_PendingRequests["<<ep_rank<<"]->size() = " << EP_PendingRequests->size()); 
     44        it = EP_PendingRequests->begin(); 
     45        continue; 
     46      } 
     47       
     48      if((*(*it))->state == 2) 
     49      { 
     50        EP_PendingRequests->erase(it); 
     51         
     52        memcheck("EP_PendingRequests["<<ep_rank<<"]->size() = " << EP_PendingRequests->size()); 
     53        it = EP_PendingRequests->begin(); 
     54        continue; 
     55      } 
     56       
    3557      Message_Check(((*(*it))->comm)); 
    3658    } 
     59     
     60     
    3761 
    3862 
    3963    for(it = EP_PendingRequests->begin(); it!=EP_PendingRequests->end(); ) 
    4064    { 
     65      if(*(*it) == 0) 
     66      { 
     67        EP_PendingRequests->erase(it); 
     68         
     69        memcheck("EP_PendingRequests["<<ep_rank<<"]->size() = " << EP_PendingRequests->size()); 
     70        it = EP_PendingRequests->begin(); 
     71        continue; 
     72      } 
     73       
     74      if((*(*it))->state == 2) 
     75      { 
     76        EP_PendingRequests->erase(it); 
     77         
     78        memcheck("EP_PendingRequests["<<ep_rank<<"]->size() = " << EP_PendingRequests->size()); 
     79        it = EP_PendingRequests->begin(); 
     80        continue; 
     81      } 
     82       
    4183      if((*(*it))->state == 0) 
    4284      { 
     
    81123      } 
    82124       
    83       if((*(*it))->state == 2) 
    84       { 
    85         int ep_rank = ((*(*it))->comm)->ep_comm_ptr->size_rank_info[0].first; 
    86         memcheck("delete "<< (*(*it)) <<" : in ep_lib::Request_Check, delete (*(*it))"); 
    87         delete (*(*it)); 
    88          
    89         EP_PendingRequests->erase(it); 
    90         memcheck("EP_PendingRequests["<<ep_rank<<"]->size() = " << EP_PendingRequests->size()); 
    91         it = EP_PendingRequests->begin(); 
    92         continue; 
    93       } 
    94       else it++; 
    95     } 
     125      it++; 
     126    } 
     127     
     128    show_EP_PendingRequests(EP_PendingRequests); 
    96129  } 
    97130   
     
    170203    return MPI_SUCCESS; 
    171204  } 
    172  
    173  
    174    
    175    
    176    
    177205 
    178206 
     
    241269    return MPI_SUCCESS; 
    242270  } 
     271   
     272   
     273   
     274  void show_EP_PendingRequests(std::list< ep_lib::MPI_Request* > * EP_PendingRequest) 
     275  { 
     276#ifdef _showinfo 
     277    std::list<MPI_Request* >::iterator it; 
     278     
     279    int i=0; 
     280     
     281    for(it = EP_PendingRequests->begin(); it!=EP_PendingRequests->end(); it++) 
     282    {  
     283      if(*(*it) == 0) 
     284      { 
     285        EP_PendingRequests->erase(it); 
     286             
     287        memcheck("EP_PendingRequests["<<ep_rank<<"]->size() = " << EP_PendingRequests->size()); 
     288        it = EP_PendingRequests->begin(); 
     289        continue; 
     290      } 
     291       
     292      if((*(*it))->state == 2) 
     293      { 
     294        EP_PendingRequests->erase(it); 
     295         
     296        memcheck("EP_PendingRequests["<<ep_rank<<"]->size() = " << EP_PendingRequests->size()); 
     297        it = EP_PendingRequests->begin(); 
     298        continue; 
     299      } 
     300           
     301      if((*(*it))->ep_src>6) 
     302        printf("EP_PendingRequests[%d] : ep_src = %d, ep_tag = %d, type = %d, state = %d, comm = %d\n", i, (*(*it))->ep_src, (*(*it))->ep_tag, (*(*it))->type, (*(*it))->state, to_mpi_comm(((*(*it))->comm)->mpi_comm)); 
     303      i++; 
     304    } 
     305#endif 
     306 
     307  } 
    243308 
    244309   
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_probe.cpp

    r1503 r1522  
    66namespace ep_lib 
    77{ 
     8  int MPI_Iprobe_mpi(int src, int tag, MPI_Comm comm, int *flag, MPI_Status *status) 
     9  { 
     10    status->ep_src = src; 
     11    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)); 
     13  } 
    814 
    915  int MPI_Iprobe(int src, int tag, MPI_Comm comm, int *flag, MPI_Status *status) 
    1016  { 
    11     *flag = false; 
    12  
    1317    if(!comm->is_ep) 
    1418    { 
    15       Debug("calling MPI_Iprobe MPI\n"); 
    16       ::MPI_Status mpi_status; 
    17       ::MPI_Iprobe(src<0? MPI_ANY_SOURCE : src, tag<0? MPI_ANY_TAG: tag, to_mpi_comm(comm->mpi_comm), flag, &mpi_status); 
     19      Debug("MPI_Iprobe with MPI\n"); 
     20      return MPI_Iprobe_mpi(src, tag, comm, flag, status); 
     21    } 
     22     
     23    else 
     24    { 
     25      Debug("MPI_Iprobe with EP\n"); 
     26       
     27      *flag = false; 
     28     
     29      Message_Check(comm); 
    1830 
    19       status->mpi_status = &mpi_status; 
    20       status->ep_src = src; 
    21       status->ep_tag = tag; 
    22       return 0; 
    23     } 
     31      #pragma omp flush 
    2432 
    25     Debug("calling MPI_Iprobe EP\n"); 
    26     Message_Check(comm); 
    27  
    28     #pragma omp flush 
    29  
    30     #pragma omp critical (_query) 
    31     if(!comm->ep_comm_ptr->message_queue->empty()) 
    32     { 
     33      #pragma omp critical (_query) 
    3334      for(Message_list::iterator it = comm->ep_comm_ptr->message_queue->begin(); it!= comm->ep_comm_ptr->message_queue->end(); ++it) 
    3435      { 
     
    3940        { 
    4041          Debug("find message\n"); 
    41           *flag = true; 
     42           
    4243 
    43           ::MPI_Status mpi_status = *(static_cast< ::MPI_Status *>((*it)->mpi_status)); 
    44  
    45           status->mpi_status = (*it)->mpi_status; 
     44          status->mpi_status = new ::MPI_Status(*static_cast< ::MPI_Status*>((*it)->mpi_status)); 
    4645          status->ep_src = (*it)->ep_src; 
    4746          status->ep_tag = (*it)->ep_tag; 
    4847 
     48          *flag = true; 
    4949          break; 
    5050        } 
    5151      } 
    5252    } 
    53  
    54     return 0; 
    5553  } 
    5654 
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_recv.cpp

    r1518 r1522  
    6464 
    6565    EP_PendingRequests->push_back(request);   
    66     int ep_rank = comm->ep_comm_ptr->size_rank_info[0].first; 
     66     
    6767    memcheck("EP_PendingRequests["<<ep_rank<<"]->size() = " << EP_PendingRequests->size());     
     68     
     69    show_EP_PendingRequests(EP_PendingRequests); 
    6870 
    6971#ifdef _showinfo 
     
    115117    (*request)->ep_tag = (*message)->ep_tag; 
    116118    (*request)->ep_src = (*message)->ep_src; 
     119     
     120    (*request)->state = 1; 
    117121         
    118122    ::MPI_Imrecv(buf, count, to_mpi_type(datatype), to_mpi_message_ptr(*message), to_mpi_request_ptr(*request));                 
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_test.cpp

    r1520 r1522  
    99#include <mpi.h> 
    1010#include "ep_declaration.hpp" 
     11#include "ep_mpi.hpp" 
    1112 
    1213using namespace std; 
     
    1819  { 
    1920    Debug("MPI_Test with EP"); 
    20  
    21     *flag = false; 
    2221     
    23  
    24     if((*request)->type == 1)      // isend 
     22    if(*request==0) return *flag=true; 
     23     
     24    if((*request)->type !=1 && (*request)->type !=2 && (*request)->type !=3)  
    2525    { 
    26       ::MPI_Status mpi_status; 
    27       ::MPI_Test(static_cast< ::MPI_Request*>((*request)->mpi_request), flag, &mpi_status); 
    28        
    29       if(*flag)  
    30       { 
    31         status->mpi_status = new ::MPI_Status(mpi_status); 
    32         status->ep_src = (*request)->ep_src; 
    33         status->ep_tag = (*request)->ep_tag; 
    34         status->ep_datatype = (*request)->ep_datatype; 
    35         delete (*request)->mpi_request; 
    36         delete request; 
    37       } 
    38  
    39       return 0; 
     26      printf("MPI_Test : Error in request type\n"); 
     27  
     28      exit(1); 
    4029    } 
    4130 
    4231    if((*request)->type == 2)   // irecv message not probed 
    4332    { 
    44       Request_Check(); 
     33      *flag = false; 
     34      return Request_Check(); 
     35    } 
     36     
     37    else //(*request)->type == 1 || (*request)->type == 3      // isend or imrecv 
     38    { 
    4539       
    46       #pragma omp flush 
    47        
    48     } 
    49  
    50     if((*request)->type == 3)  // imrecv 
    51     { 
    5240      ::MPI_Status mpi_status; 
    5341       
    54       ::MPI_Test(static_cast< ::MPI_Request*>((*request)->mpi_request), flag, &mpi_status); 
    5542       
     43      ::MPI_Test(to_mpi_request_ptr(*request), flag, &mpi_status); 
    5644       
    57       if(*flag) 
     45      if(*flag)  
    5846      { 
    59         status->mpi_status = new ::MPI_Status(mpi_status); 
     47 
     48        status->mpi_status=new ::MPI_Status(mpi_status); 
    6049        status->ep_src = (*request)->ep_src; 
    6150        status->ep_tag = (*request)->ep_tag; 
    6251        status->ep_datatype = (*request)->ep_datatype; 
     52         
     53        (*request)->state = 2; 
     54                 
     55        memcheck("delete "<< (*request)->mpi_request << " : in ep_lib::MPI_Test, delete (*request)->mpi_request"); 
    6356        delete (*request)->mpi_request; 
    64         delete request; 
    65         //int count; 
    66         //MPI_Get_count(status, request->ep_datatype, &count); 
    67         //check_sum_recv(request->buf, count, request->ep_datatype, request->ep_src, request->ep_tag, request->comm, 2); 
    68       }   
    69  
    70       return 0; 
     57        delete *request; 
     58        *request=0; 
     59      } 
    7160    } 
     61     
     62    return Request_Check(); 
    7263 
    7364  } 
     
    7768  { 
    7869    Debug("MPI_Testall with EP"); 
    79  
     70    *flag = false; 
     71    
     72    int rank = array_of_requests[0]->comm->ep_comm_ptr->size_rank_info[0].first; 
     73     
     74    for(int i=0; i<count; i++) 
     75    { 
     76      if(array_of_requests[i]->type == 2) 
     77      { 
     78        *flag=false; 
     79        return Request_Check(); 
     80      } 
     81    } 
     82     
    8083    ::MPI_Request* mpi_request = new ::MPI_Request[count]; 
    8184    ::MPI_Status* mpi_status = new ::MPI_Status[count]; 
     
    8992    ::MPI_Testall(count, mpi_request, flag, mpi_status); 
    9093 
    91     if(flag) 
     94    if(*flag) 
    9295    { 
    9396      for(int i=0; i<count; i++) 
    9497      { 
    95         array_of_statuses[i].mpi_status = &mpi_status[i]; 
     98        array_of_statuses[i].mpi_status = new ::MPI_Status(mpi_status[i]); 
    9699        array_of_statuses[i].ep_src = array_of_requests[i]->ep_src; 
    97100        array_of_statuses[i].ep_tag = array_of_requests[i]->ep_tag; 
    98101        array_of_statuses[i].ep_datatype = array_of_requests[i]->ep_datatype; 
     102         
     103        array_of_requests[i]->state = 2; 
    99104       
    100         memcheck("delete "<< array_of_requests[i]->mpi_request <<" : in ep_lib::MPI_Waitall, array_of_requests["<<i<<"]->mpi_request"); 
     105        memcheck("delete "<< array_of_requests[i]->mpi_request <<" : in ep_lib::MPI_Testall, array_of_requests["<<i<<"]->mpi_request"); 
    101106        delete array_of_requests[i]->mpi_request; 
    102         delete array_of_requests[i];  
     107        delete array_of_requests[i]; 
     108        array_of_requests[i]=0; 
     109         
    103110      } 
    104111       
    105112    } 
     113     
     114    return Request_Check(); 
    106115 
    107116  } 
  • XIOS/dev/branch_openmp/extern/ep_dev/ep_wait.cpp

    r1503 r1522  
    2525    if((*request)->type !=1 && (*request)->type !=2 && (*request)->type !=3)  
    2626    { 
    27       printf("Error in request type\n"); 
     27      printf("MPI_Wait : Error in request type\n"); 
    2828  
    2929      exit(1); 
     
    3232    while((*request)->type == 2) Request_Check(); 
    3333     
    34     ::MPI_Wait(to_mpi_request_ptr(*request), to_mpi_status_ptr(status)); 
     34    ::MPI_Status mpi_status; 
     35     
     36    ::MPI_Wait(to_mpi_request_ptr(*request), &mpi_status); 
    3537 
    36      
     38    status->mpi_status = new ::MPI_Status(mpi_status); 
    3739    status->ep_src = (*request)->ep_src; 
    3840    status->ep_tag = (*request)->ep_tag; 
     
    4244 
    4345    memcheck("delete "<< (*request)->mpi_request << " : in ep_lib::MPI_Wait, delete (*request)->mpi_request"); 
     46 
    4447    delete (*request)->mpi_request; 
    45     Request_Check(); 
    46  
    47     return MPI_SUCCESS; 
     48    delete *request; 
     49    *request=0; 
     50     
     51    return Request_Check(); 
    4852 
    4953  }   /*end of mpi_wait*/ 
     
    8690    for(int i=0; i<count; i++) 
    8791    { 
    88       array_of_statuses[i].mpi_status = &mpi_status[i]; 
     92      array_of_statuses[i].mpi_status = new ::MPI_Status(mpi_status[i]); 
    8993      array_of_statuses[i].ep_src = array_of_requests[i]->ep_src; 
    9094      array_of_statuses[i].ep_tag = array_of_requests[i]->ep_tag; 
    9195      array_of_statuses[i].ep_datatype = array_of_requests[i]->ep_datatype; 
     96       
    9297      array_of_requests[i]->state = 2; 
     98       
    9399      memcheck("delete "<< array_of_requests[i]->mpi_request <<" : in ep_lib::MPI_Waitall, array_of_requests["<<i<<"]->mpi_request"); 
    94100      delete array_of_requests[i]->mpi_request; 
    95       if(array_of_requests[i]->type == 1)  
    96       { 
    97         memcheck("delete "<< array_of_requests[i] <<" : in ep_lib::MPI_Waitall, array_of_requests["<<i<<"]"); 
    98         delete array_of_requests[i]; 
    99       } 
     101      delete array_of_requests[i]; 
     102      array_of_requests[i] = 0; 
    100103    } 
    101104 
     
    103106    delete[] mpi_status; 
    104107     
    105     Request_Check(); 
    106      
    107      
    108     return MPI_SUCCESS; 
     108    return Request_Check(); 
    109109  }  /* end of mpi_waitall*/ 
    110110 
  • XIOS/dev/branch_openmp/extern/ep_dev/main.cpp

    r1518 r1522  
    852852 
    853853      if(rank == 0) printf("            \t Test iP2P for intercomm \t OK\n"); 
     854       
     855       
    854856 
    855857 
     
    888890      MPI_Comm_size(inter_comm_dup_merged, &inter_comm_dup_merged_size); 
    889891 
    890       printf("rank = %d, inter_comm_dup_merged_rank = %d, inter_comm_dup_merged_size = %d\n", rank, inter_comm_dup_merged_rank, inter_comm_dup_merged_size); 
     892      //printf("rank = %d, inter_comm_dup_merged_rank = %d, inter_comm_dup_merged_size = %d\n", rank, inter_comm_dup_merged_rank, inter_comm_dup_merged_size); 
     893       
     894      // TEST OF TESTALL 
     895       
     896        int merged_size, merged_rank; 
     897        MPI_Comm_rank(inter_comm_dup_merged, &merged_rank); 
     898        MPI_Comm_size(inter_comm_dup_merged, &merged_size); 
     899         
     900        int left = merged_rank>0? merged_rank-1 : merged_size-1; 
     901        int right = (merged_rank+1) % merged_size; 
     902         
     903        //printf("rank = %d, left = %d, right = %d\n", merged_rank, left, right); 
     904         
     905        int N=10000; 
     906        int *left_buf = new int[N]; 
     907        int *right_buf = new int[N]; 
     908                 
     909        for(int i=0; i<N; i++) 
     910        { 
     911          right_buf[i] = merged_rank*100000+i; 
     912        } 
     913         
     914        MPI_Request request[2]; 
     915        MPI_Status status[2]; 
     916         
     917        MPI_Irecv(left_buf, N, MPI_INT, left, 0, inter_comm_dup_merged, &request[0]); 
     918        MPI_Isend(right_buf, N, MPI_INT, right, 0, inter_comm_dup_merged, &request[1]); 
     919         
     920         
     921        int flag; 
     922        MPI_Testall(2, request, &flag, status); 
     923       
     924        printf("rank = %d, flag = %d\n", merged_rank, flag); 
     925         
     926        while(!flag) MPI_Testall(2, request, &flag, status); 
     927        //if(!flag)  MPI_Waitall(2, request, status); 
     928         
     929        int recv_count; 
     930        MPI_Get_count(&status[0], MPI_INT, &recv_count); 
     931         
     932        MPI_Barrier(inter_comm_dup_merged); 
     933         
     934        printf("rank = %d, recv_count = %d, left_buf[5-10] = %d\t%d\t%d\t%d\t%d\t%d\n", merged_rank, recv_count, left_buf[5], left_buf[6], left_buf[7], left_buf[8], left_buf[9], left_buf[10]); 
     935                         
     936        delete[] left_buf; 
     937        delete[] right_buf; 
     938       
     939       
    891940 
    892941      // TEST OF GATHER 
     
    9611010 
    9621011      // TEST OF EXSCAN 
    963       { 
     1012      /*{ 
    9641013  
    9651014        std::vector<int>sendbuf(2, inter_comm_dup_merged_rank); 
     
    9881037        if(inter_comm_dup_merged_rank == 0 && exscan_result)  printf("            \t test MPI_Exscan for merged comm \t OK\n"); 
    9891038        if(inter_comm_dup_merged_rank == 0 && !exscan_result) printf("            \t test MPI_Exscan for merged comm \t FAILED %d\n", exscan_result); 
    990       } 
     1039      }*/ 
    9911040 
    9921041      // TEST OF SCATTERV 
Note: See TracChangeset for help on using the changeset viewer.