Ignore:
Timestamp:
03/08/17 16:55:00 (7 years ago)
Author:
yushan
Message:

server mode OK tested with test_complete

Location:
XIOS/dev/branch_yushan/extern/src_ep_dev
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_dup.cpp

    r1063 r1067  
    55namespace ep_lib 
    66{ 
    7  
    8  
    9  
    10   int MPI_Comm_dup_dev(MPI_Comm comm, MPI_Comm *newcomm) 
    11   { 
    12     if(!comm.is_ep) 
    13     { 
    14       Debug("Comm_dup MPI\n"); 
    15       newcomm = new MPI_Comm; 
    16       newcomm->is_ep = comm.is_ep; 
    17  
    18       ::MPI_Comm input = static_cast< ::MPI_Comm>(comm.mpi_comm); 
    19       ::MPI_Comm output; 
    20  
    21        
    22       ::MPI_Comm_dup(input, &output); 
    23  
    24       newcomm->mpi_comm = output; 
    25  
    26       return 0; 
    27     } 
    28  
    29     if(!comm.mpi_comm) return 0; 
    30  
    31  
    32     int my_rank = comm.ep_comm_ptr->size_rank_info[1].first; 
    33     int num_ep  = comm.ep_comm_ptr->size_rank_info[1].second; 
    34  
    35  
    36     if(0 == my_rank) 
    37     { 
    38       MPI_Info info; 
    39       ::MPI_Comm mpi_dup; 
    40  
    41       ::MPI_Comm in_comm = static_cast< ::MPI_Comm>(comm.mpi_comm); 
    42  
    43       ::MPI_Comm_dup(in_comm, &mpi_dup); 
    44  
    45       MPI_Comm_create_endpoints(mpi_dup, num_ep, info, newcomm); 
    46       comm.ep_comm_ptr->comm_list->mem_bridge = newcomm; 
    47     } 
    48  
    49     MPI_Barrier_local(comm); 
    50  
    51     newcomm = &(comm.ep_comm_ptr->comm_list->mem_bridge[my_rank]); 
    52  
    53     return MPI_SUCCESS; 
    54   } 
    55  
    56  
    577 
    588  int MPI_Comm_dup(MPI_Comm comm, MPI_Comm *newcomm) 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_fortran.cpp

    r1060 r1067  
    1 //#include "ep_lib.hpp" 
     1#include "ep_lib.hpp" 
    22#include "ep_lib_fortran.hpp" 
    33#include <mpi.h> 
    44#include <map> 
    55#include <utility> 
     6#include "ep_declaration.hpp" 
    67 
    78#ifdef _intelmpi 
     
    2627    fint = ::MPI_Comm_c2f(static_cast< ::MPI_Comm>(comm.mpi_comm)); 
    2728    #endif 
    28     std::map<std::pair<int, int>, MPI_Comm  > ::iterator it; 
     29    std::map<std::pair<int, int>, MPI_Comm > ::iterator it; 
    2930     
    3031    it = fc_comm_map.find(std::make_pair(fint, omp_get_thread_num())); 
     
    3233    { 
    3334      fc_comm_map.insert(std::make_pair( std::make_pair( fint, omp_get_thread_num()) , comm)); 
    34       //printf("EP_Comm_c2f : MAP insert: %d, %d, %p\n", fint, omp_get_thread_num(), &comm); 
     35      printf("EP_Comm_c2f : MAP insert: %d, %d, %p\n", fint, omp_get_thread_num(), &comm); 
    3536    } 
    3637     
     
    4546     
    4647     
    47     std::map<std::pair<int, int>, MPI_Comm  > ::iterator it; 
     48    std::map<std::pair<int, int>, MPI_Comm > ::iterator it; 
    4849     
    4950    it = fc_comm_map.find(std::make_pair(comm, omp_get_thread_num())); 
     
    5152    { 
    5253      MPI_Comm comm_ptr; 
    53       comm_ptr =  it->second; 
    54       //printf("EP_Comm_f2c : MAP find: %d, %d, %p\n", it->first.first, it->first.second, &comm_ptr); 
     54      comm_ptr = it->second; 
     55      printf("EP_Comm_f2c : MAP find: %d, %d, %p\n", it->first.first, it->first.second, it->second); 
    5556      return  comm_ptr; 
    5657    } 
     
    5859    {       
    5960      MPI_Comm return_comm; 
    60       return_comm.mpi_comm = ::MPI_Comm_f2c(comm); 
     61      if(omp_get_thread_num() == 0) 
     62      { 
     63        ::MPI_Comm base_comm = ::MPI_Comm_f2c(comm); 
     64        if(base_comm != MPI_COMM_NULL_STD) 
     65        { 
     66          int num_ep = omp_get_num_threads(); 
     67          MPI_Comm *new_comm; 
     68          MPI_Info info; 
     69          MPI_Comm_create_endpoints(base_comm, num_ep, info, new_comm); 
     70          return_comm = new_comm[omp_get_thread_num()]; 
     71        } 
     72        return MPI_COMM_NULL; 
     73      } 
     74       
     75       
    6176      return return_comm; 
    6277    } 
     
    122137    fint = ::MPI_Comm_c2f(static_cast< ::MPI_Comm>(comm.mpi_comm)); 
    123138     
    124     std::map<std::pair<int, int>, MPI_Comm  > ::iterator it; 
     139    std::map<std::pair<int, int>, MPI_Comm > ::iterator it; 
    125140     
    126141    it = fc_comm_map.find(std::make_pair(fint, omp_get_thread_num())); 
     
    140155     
    141156     
    142     std::map<std::pair<int, int>, MPI_Comm  > ::iterator it; 
     157    std::map<std::pair<int, int>, MPI_Comm > ::iterator it; 
    143158     
    144159    it = fc_comm_map.find(std::make_pair(comm, omp_get_thread_num())); 
     
    147162      MPI_Comm comm_ptr; 
    148163      comm_ptr =  it->second; 
    149       printf("MAP find: %d, %d, %p\n", it->first.first, it->first.second, &comm_ptr); 
     164      printf("MAP find: %d, %d, %p\n", it->first.first, it->first.second, comm_ptr); 
    150165      return  comm_ptr; 
    151166    } 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_intercomm_kernel.cpp

    r1053 r1067  
    351351        #pragma omp critical (write_to_tag_list) 
    352352        tag_list.push_back(make_pair( make_pair(tag, min(leader_info[0], leader_info[1])) , ep_intercomm)); 
     353        printf("tag_list size = %lu\n", tag_list.size()); 
    353354      } 
    354355 
     
    419420            *newintercomm =  iter->second[my_position]; 
    420421            found = true; 
     422            tag_list.erase(iter); 
    421423            break; 
    422424          } 
     
    426428 
    427429    MPI_Barrier_local(local_comm); 
     430    // if(is_proc_master) 
     431    // { 
     432    //   for(std::list<std::pair < std::pair<int,int>, MPI_Comm* > >::iterator iter = tag_list.begin(); iter!=tag_list.end(); iter++) 
     433    //   { 
     434    //     if((*iter).first == make_pair(tag, min(leader_info[0], leader_info[1]))) 
     435    //     { 
     436    //       tag_list.erase(iter); 
     437    //       break; 
     438    //     } 
     439    //   } 
     440    // } 
    428441 
    429442    int intercomm_ep_rank, intercomm_ep_rank_loc, intercomm_mpi_rank; 
     
    674687            *newintercomm =  iter->second[my_position]; 
    675688            found = true; 
     689            tag_list.erase(iter); 
    676690            break; 
    677691          } 
     
    679693      } 
    680694    } 
     695 
     696    // if(leader_rank_in_peer[0] < leader_rank_in_peer[1]) 
     697    // { 
     698    //   for(std::list<std::pair < std::pair<int,int>, MPI_Comm* > >::iterator iter = tag_list.begin(); iter!=tag_list.end(); iter++) 
     699    //     { 
     700    //       if((*iter).first == make_pair(tag_label[0], tag_label[1])) 
     701    //       { 
     702    //         tag_list.erase(iter); 
     703    //       } 
     704    //     } 
     705    // } 
    681706 
    682707 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_intercomm_world.cpp

    r1053 r1067  
    417417 
    418418            found = true; 
     419            tag_list.erase(iter); 
    419420            break; 
    420421          } 
     
    424425 
    425426    MPI_Barrier_local(local_comm); 
     427 
     428    // if(is_proc_master) 
     429    // { 
     430    //   for(std::list<std::pair < std::pair<int,int>, MPI_Comm* > >::iterator iter = tag_list.begin(); iter!=tag_list.end(); iter++) 
     431    //   { 
     432    //     if((*iter).first == make_pair(tag, min(leader_info[0], leader_info[1]))) 
     433    //     { 
     434    //       tag_list.erase(iter); 
     435    //     } 
     436    //   } 
     437    // } 
     438 
     439     
    426440 
    427441    int intercomm_ep_rank, intercomm_ep_rank_loc, intercomm_mpi_rank; 
     
    920934 
    921935            found = true; 
     936            tag_list.erase(iter); 
    922937            break; 
    923938          } 
     
    927942 
    928943    MPI_Barrier_local(local_comm); 
     944 
     945    // if(is_proc_master) 
     946    // { 
     947    //   for(std::list<std::pair < std::pair<int,int>, MPI_Comm* > >::iterator iter = tag_list.begin(); iter!=tag_list.end(); iter++) 
     948    //   { 
     949    //     if((*iter).first == make_pair(tag, min(leader_info[0], leader_info[1]))) 
     950    //     { 
     951    //       tag_list.erase(iter); 
     952    //     } 
     953    //   } 
     954    // } 
    929955 
    930956    int intercomm_ep_rank, intercomm_ep_rank_loc, intercomm_mpi_rank; 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_message.cpp

    r1037 r1067  
    2424 
    2525    if(comm.is_intercomm) 
    26           { 
     26    { 
    2727      return  Message_Check_intercomm(comm); 
    2828    } 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_test.cpp

    r1053 r1067  
    6565        status->ep_tag = request->ep_tag; 
    6666        status->ep_datatype = request->ep_datatype; 
    67         int count; 
    68         MPI_Get_count(status, request->ep_datatype, &count); 
     67        //int count; 
     68        //MPI_Get_count(status, request->ep_datatype, &count); 
    6969        //check_sum_recv(request->buf, count, request->ep_datatype, request->ep_src, request->ep_tag, request->comm, 2); 
    7070      } 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_type.hpp

    r1053 r1067  
    282282    MPI_Comm() 
    283283    { 
    284       is_ep = false; 
     284      is_ep = true; 
    285285      is_intercomm = false; 
    286286      my_buffer = NULL; 
     
    338338      bool c = mpi_comm != right.mpi_comm; 
    339339      bool d = is_ep ? ep_comm_ptr != right.ep_comm_ptr : true; 
     340 
    340341      return a||b||c||d; 
    341342    } 
     
    424425  static std::list<std::pair<std::pair<int, int>, MPI_Comm * > > tag_list; 
    425426 
    426   static std::map<std::pair<int, int>, MPI_Comm  >  fc_comm_map; 
     427  static std::map<std::pair<int, int>, MPI_Comm >  fc_comm_map; 
    427428            //    <MPI_Fint,thread_num>   EP_Comm 
    428429 
  • XIOS/dev/branch_yushan/extern/src_ep_dev/ep_wait.cpp

    r1053 r1067  
    6868      status->ep_datatype = request->ep_datatype; 
    6969 
    70       int count; 
    71       MPI_Get_count(status, request->ep_datatype, &count); 
     70      //int count; 
     71      //MPI_Get_count(status, request->ep_datatype, &count); 
    7272      //check_sum_recv(request->buf, count, request->ep_datatype, request->ep_src, request->ep_tag, request->comm, 2); 
    7373    } 
     
    104104            if(array_of_requests[i].type == 3) 
    105105            { 
    106               int check_count; 
    107               MPI_Get_count(&array_of_statuses[i], array_of_requests[i].ep_datatype, &check_count); 
     106              //int check_count; 
     107              //MPI_Get_count(&array_of_statuses[i], array_of_requests[i].ep_datatype, &check_count); 
    108108              //check_sum_recv(array_of_requests[i].buf, count, array_of_requests[i].ep_datatype, array_of_requests[i].ep_src, array_of_requests[i].ep_tag, array_of_requests[i].comm, 2); 
    109109            } 
Note: See TracChangeset for help on using the changeset viewer.