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

server mode OK tested with test_complete

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" 
    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    } 
Note: See TracChangeset for help on using the changeset viewer.