Changeset 1067 for XIOS/dev/branch_yushan/extern
- Timestamp:
- 03/08/17 16:55:00 (7 years ago)
- 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 5 5 namespace ep_lib 6 6 { 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 57 7 58 8 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" 2 2 #include "ep_lib_fortran.hpp" 3 3 #include <mpi.h> 4 4 #include <map> 5 5 #include <utility> 6 #include "ep_declaration.hpp" 6 7 7 8 #ifdef _intelmpi … … 26 27 fint = ::MPI_Comm_c2f(static_cast< ::MPI_Comm>(comm.mpi_comm)); 27 28 #endif 28 std::map<std::pair<int, int>, MPI_Comm 29 std::map<std::pair<int, int>, MPI_Comm > ::iterator it; 29 30 30 31 it = fc_comm_map.find(std::make_pair(fint, omp_get_thread_num())); … … 32 33 { 33 34 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); 35 36 } 36 37 … … 45 46 46 47 47 std::map<std::pair<int, int>, MPI_Comm 48 std::map<std::pair<int, int>, MPI_Comm > ::iterator it; 48 49 49 50 it = fc_comm_map.find(std::make_pair(comm, omp_get_thread_num())); … … 51 52 { 52 53 MPI_Comm comm_ptr; 53 comm_ptr = 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); 55 56 return comm_ptr; 56 57 } … … 58 59 { 59 60 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 61 76 return return_comm; 62 77 } … … 122 137 fint = ::MPI_Comm_c2f(static_cast< ::MPI_Comm>(comm.mpi_comm)); 123 138 124 std::map<std::pair<int, int>, MPI_Comm 139 std::map<std::pair<int, int>, MPI_Comm > ::iterator it; 125 140 126 141 it = fc_comm_map.find(std::make_pair(fint, omp_get_thread_num())); … … 140 155 141 156 142 std::map<std::pair<int, int>, MPI_Comm 157 std::map<std::pair<int, int>, MPI_Comm > ::iterator it; 143 158 144 159 it = fc_comm_map.find(std::make_pair(comm, omp_get_thread_num())); … … 147 162 MPI_Comm comm_ptr; 148 163 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); 150 165 return comm_ptr; 151 166 } -
XIOS/dev/branch_yushan/extern/src_ep_dev/ep_intercomm_kernel.cpp
r1053 r1067 351 351 #pragma omp critical (write_to_tag_list) 352 352 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()); 353 354 } 354 355 … … 419 420 *newintercomm = iter->second[my_position]; 420 421 found = true; 422 tag_list.erase(iter); 421 423 break; 422 424 } … … 426 428 427 429 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 // } 428 441 429 442 int intercomm_ep_rank, intercomm_ep_rank_loc, intercomm_mpi_rank; … … 674 687 *newintercomm = iter->second[my_position]; 675 688 found = true; 689 tag_list.erase(iter); 676 690 break; 677 691 } … … 679 693 } 680 694 } 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 // } 681 706 682 707 -
XIOS/dev/branch_yushan/extern/src_ep_dev/ep_intercomm_world.cpp
r1053 r1067 417 417 418 418 found = true; 419 tag_list.erase(iter); 419 420 break; 420 421 } … … 424 425 425 426 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 426 440 427 441 int intercomm_ep_rank, intercomm_ep_rank_loc, intercomm_mpi_rank; … … 920 934 921 935 found = true; 936 tag_list.erase(iter); 922 937 break; 923 938 } … … 927 942 928 943 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 // } 929 955 930 956 int intercomm_ep_rank, intercomm_ep_rank_loc, intercomm_mpi_rank; -
XIOS/dev/branch_yushan/extern/src_ep_dev/ep_message.cpp
r1037 r1067 24 24 25 25 if(comm.is_intercomm) 26 26 { 27 27 return Message_Check_intercomm(comm); 28 28 } -
XIOS/dev/branch_yushan/extern/src_ep_dev/ep_test.cpp
r1053 r1067 65 65 status->ep_tag = request->ep_tag; 66 66 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); 69 69 //check_sum_recv(request->buf, count, request->ep_datatype, request->ep_src, request->ep_tag, request->comm, 2); 70 70 } -
XIOS/dev/branch_yushan/extern/src_ep_dev/ep_type.hpp
r1053 r1067 282 282 MPI_Comm() 283 283 { 284 is_ep = false;284 is_ep = true; 285 285 is_intercomm = false; 286 286 my_buffer = NULL; … … 338 338 bool c = mpi_comm != right.mpi_comm; 339 339 bool d = is_ep ? ep_comm_ptr != right.ep_comm_ptr : true; 340 340 341 return a||b||c||d; 341 342 } … … 424 425 static std::list<std::pair<std::pair<int, int>, MPI_Comm * > > tag_list; 425 426 426 static std::map<std::pair<int, int>, MPI_Comm 427 static std::map<std::pair<int, int>, MPI_Comm > fc_comm_map; 427 428 // <MPI_Fint,thread_num> EP_Comm 428 429 -
XIOS/dev/branch_yushan/extern/src_ep_dev/ep_wait.cpp
r1053 r1067 68 68 status->ep_datatype = request->ep_datatype; 69 69 70 int count;71 MPI_Get_count(status, request->ep_datatype, &count);70 //int count; 71 //MPI_Get_count(status, request->ep_datatype, &count); 72 72 //check_sum_recv(request->buf, count, request->ep_datatype, request->ep_src, request->ep_tag, request->comm, 2); 73 73 } … … 104 104 if(array_of_requests[i].type == 3) 105 105 { 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); 108 108 //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); 109 109 }
Note: See TracChangeset
for help on using the changeset viewer.