Changeset 1067 for XIOS/dev/branch_yushan/extern/src_ep_dev/ep_fortran.cpp
- Timestamp:
- 03/08/17 16:55:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.