Ignore:
Timestamp:
05/20/19 13:14:51 (5 years ago)
Author:
yushan
Message:

MARK: branch merged with trunk @1660. Add option --omp to enable multithreading.

Location:
XIOS/dev/dev_trunk_omp/src
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_trunk_omp/src/context_client.cpp

    r1646 r1665  
    363363     #ifdef _usingEP 
    364364     MPI_Allreduce(&minBufferSizeEventSizeRatio, &minBufferSizeEventSizeRatio, 1, MPI_DOUBLE, MPI_MIN, intraComm); 
    365      #elif _usingMPI 
     365     #else 
    366366     MPI_Allreduce(MPI_IN_PLACE, &minBufferSizeEventSizeRatio, 1, MPI_DOUBLE, MPI_MIN, intraComm); 
    367367     #endif 
  • XIOS/dev/dev_trunk_omp/src/context_server.cpp

    r1646 r1665  
    8888    if (flag==true) 
    8989    { 
    90       #ifdef _usingMPI 
     90       
     91      #ifdef _usingEP 
     92      rank=status.ep_src ; 
     93      #else 
    9194      rank=status.MPI_SOURCE ; 
    92       #elif _usingEP 
    93       rank=status.ep_src ; 
    9495      #endif 
    9596      okLoop = true; 
     
    118119    char * addr; 
    119120    map<int,CServerBuffer*>::iterator it; 
    120     #ifdef _usingMPI 
     121     
     122    #ifdef _usingEP 
     123    int rank=status.ep_src; 
     124    #else 
    121125    int rank=status.MPI_SOURCE ; 
    122     #elif _usingEP 
    123     int rank=status.ep_src; 
    124126    #endif     
    125127 
  • XIOS/dev/dev_trunk_omp/src/cxios.cpp

    r1661 r1665  
    102102    checkEventSync = getin<bool>("check_event_sync", checkEventSync); 
    103103 
    104     #ifdef _usingMPI 
    105     globalComm=MPI_COMM_WORLD ; 
    106     #elif _usingEP 
     104     
     105    #ifdef _usingEP 
    107106    int num_ep; 
    108107 
     
    120119    #pragma omp barrier 
    121120    CXios::globalComm = passage[omp_get_thread_num()]; 
     121 
     122    #else 
     123    globalComm=MPI_COMM_WORLD ; 
     124 
    122125    #endif 
    123126  } 
  • XIOS/dev/dev_trunk_omp/src/interface/c/icdata.cpp

    r1646 r1665  
    6767      int initialized; 
    6868      MPI_Initialized(&initialized); 
    69       #ifdef _usingMPI 
    70       if (initialized) local_comm=MPI_Comm_f2c(*f_local_comm); 
    71       else local_comm=MPI_COMM_NULL; 
    72       #elif _usingEP 
     69       
     70      #ifdef _usingEP 
    7371      ep_lib::fc_comm_map.clear(); 
    7472      if (initialized) local_comm=EP_Comm_f2c((f_local_comm)); 
    7573      else local_comm=MPI_COMM_NULL; 
     74      #else 
     75      if (initialized) local_comm=MPI_Comm_f2c(*f_local_comm); 
     76      else local_comm=MPI_COMM_NULL; 
    7677      #endif 
    7778       
     
    7980 
    8081      CXios::initClientSide(str, local_comm, return_comm); 
    81       #ifdef _usingMPI 
     82       
     83      #ifdef _usingEP 
     84      *f_return_comm=*static_cast<MPI_Fint*>(EP_Comm_c2f(return_comm)); 
     85      #else 
    8286      *f_return_comm=MPI_Comm_c2f(return_comm); 
    83       #elif _usingEP 
    84       *f_return_comm=*static_cast<MPI_Fint*>(EP_Comm_c2f(return_comm)); 
    8587      #endif 
    8688      CTimer::get("XIOS init").suspend(); 
     
    98100     CTimer::get("XIOS").resume(); 
    99101     CTimer::get("XIOS init context").resume(); 
    100      #ifdef _usingMPI 
     102      
     103     #ifdef _usingEP 
     104     comm = EP_Comm_f2c(f_comm); 
     105     #else 
    101106     comm=MPI_Comm_f2c(*f_comm); 
    102      #elif _usingEP 
    103      comm = EP_Comm_f2c(f_comm); 
    104107     #endif 
    105108     CClient::registerContext(str, comm); 
  • XIOS/dev/dev_trunk_omp/src/io/inetcdf4.cpp

    r1646 r1665  
    2525      #ifdef _usingEP 
    2626      CNetCdfInterface::openPar(filename, NC_NOWRITE | NC_MPIIO, to_mpi_comm((*comm)->mpi_comm), to_mpi_info(MPI_INFO_NULL), this->ncidp); 
    27       #elif _usingMPI 
     27      #else 
    2828      CNetCdfInterface::openPar(filename, NC_NOWRITE | NC_MPIIO, *comm, MPI_INFO_NULL, this->ncidp); 
    2929      #endif 
  • XIOS/dev/dev_trunk_omp/src/io/netCdfInterface.cpp

    r1661 r1665  
    5858  #ifdef _usingEP 
    5959  int status = xios::nc_create_par(fileName.c_str(), cMode, comm, to_mpi_info(MPI_INFO_NULL), &ncId); 
    60   #elif _usingMPI 
     60  #else 
    6161  int status = xios::nc_create_par(fileName.c_str(), cMode, comm, MPI_INFO_NULL, &ncId); 
    6262  #endif 
     
    122122  #ifdef _usingEP 
    123123  int status = xios::nc_open_par(fileName.c_str(), oMode, comm, to_mpi_info(MPI_INFO_NULL), &ncId); 
    124   #elif _usingMPI 
     124  #else 
    125125  int status = xios::nc_open_par(fileName.c_str(), oMode, comm, MPI_INFO_NULL, &ncId); 
    126126  #endif 
  • XIOS/dev/dev_trunk_omp/src/io/onetcdf4.cpp

    r1646 r1665  
    6060               #ifdef _usingEP 
    6161               CNetCdfInterface::createPar(filename, mode, to_mpi_comm((*comm)->mpi_comm), to_mpi_info(MPI_INFO_NULL), this->ncidp); 
    62                #elif _usingMPI 
     62               #else 
    6363               CNetCdfInterface::createPar(filename, mode, *comm, MPI_INFO_NULL, this->ncidp); 
    6464               #endif 
     
    7676               #ifdef _usingEP 
    7777               CNetCdfInterface::openPar(filename, mode, to_mpi_comm((*comm)->mpi_comm), to_mpi_info(MPI_INFO_NULL), this->ncidp); 
    78                #elif _usingMPI 
     78               #else 
    7979               CNetCdfInterface::openPar(filename, mode, *comm, MPI_INFO_NULL, this->ncidp); 
    8080               #endif 
  • XIOS/dev/dev_trunk_omp/src/mpi.hpp

    r1661 r1665  
    1414  #include "ep_lib.hpp" 
    1515  #include "ep_declaration.hpp" 
    16 #elif _usingMPI 
     16#else 
    1717  #include <mpi.h> 
    1818  #define ep_lib  
  • XIOS/dev/dev_trunk_omp/src/mpi_std.hpp

    r1650 r1665  
    1717#include "ep_lib.hpp" 
    1818#include "ep_declaration.hpp" 
    19 #elif _usingMPI 
     19#else 
    2020#include <mpi.h> 
    2121#define ep_lib  
  • XIOS/dev/dev_trunk_omp/src/node/field.cpp

    r1646 r1665  
    536536       #ifdef _usingEP 
    537537       MPI_Allreduce(&nstepMax, &nstepMax, 1, MPI_INT, MPI_MAX, context->server->intraComm); 
    538        #elif _usingMPI 
     538       #else 
    539539       MPI_Allreduce(MPI_IN_PLACE, &nstepMax, 1, MPI_INT, MPI_MAX, context->server->intraComm); 
    540540       #endif 
  • XIOS/dev/dev_trunk_omp/src/node/file.cpp

    r1661 r1665  
    728728        isOpen = false; 
    729729       } 
    730      #ifdef _usingMPI  
     730     #ifdef _usingEP 
     731     //if (fileComm != MPI_COMM_NULL) MPI_Comm_free(&fileComm); 
     732     #else 
    731733     if (fileComm != MPI_COMM_NULL) MPI_Comm_free(&fileComm); 
    732734     #endif 
  • XIOS/dev/dev_trunk_omp/src/server.cpp

    r1661 r1665  
    666666         if (flag==true) 
    667667         { 
    668            #ifdef _usingMPI 
     668            
     669           #ifdef _usingEP 
     670           rank=status.ep_src; 
     671           #else 
    669672           rank=status.MPI_SOURCE ; 
    670            #elif _usingEP 
    671            rank=status.ep_src; 
    672673           #endif 
    673674           MPI_Get_count(&status,MPI_CHAR,&count) ; 
     
    684685         if (flag==true) 
    685686         { 
    686            #ifdef _usingMPI 
     687            
     688           #ifdef _usingEP 
     689           rank=status.ep_src; 
     690           #else 
    687691           rank=status.MPI_SOURCE ; 
    688            #elif _usingEP 
    689            rank=status.ep_src; 
    690692           #endif 
    691693           MPI_Get_count(&status,MPI_CHAR,&count) ; 
  • XIOS/dev/dev_trunk_omp/src/test/test_complete_omp.f90

    r1661 r1665  
    3131  INTEGER :: i,j,l,ts,n, nb_pt, provided 
    3232 
     33  integer :: num_args, ix, nb_servers 
     34  character(len=12), dimension(:), allocatable :: args 
     35 
     36  num_args = command_argument_count() 
     37  if(num_args<1) then 
     38    print*, "please give the number of servers as argument." 
     39    call abort 
     40  endif 
     41 
     42  allocate(args(num_args))  ! I've omitted checking the return status of the allocation  
     43 
     44  do ix = 1, num_args 
     45    call get_command_argument(ix,args(ix)) 
     46    ! now parse the argument as you wish 
     47  end do 
     48 
     49  READ(args(1),*) nb_servers 
     50 
    3351!!! MPI Initialization 
    3452 
     
    4563  CALL MPI_COMM_RANK(MPI_COMM_WORLD,rank,ierr) 
    4664  CALL MPI_COMM_SIZE(MPI_COMM_WORLD,size,ierr) 
    47   if(rank < size-4) then 
     65  if(rank < size-nb_servers) then 
    4866 
    4967  !$omp parallel default(firstprivate)  
  • XIOS/dev/dev_trunk_omp/src/test/test_omp.f90

    r1646 r1665  
    3333  INTEGER :: i,j,l,ts,n, provided 
    3434 
     35  integer :: num_args, ix, nb_servers 
     36  character(len=12), dimension(:), allocatable :: args 
     37 
     38  num_args = command_argument_count() 
     39  if(num_args<1) then 
     40    print*, "please give the number of servers as input argument." 
     41    call abort 
     42  endif 
     43 
     44  allocate(args(num_args))  ! I've omitted checking the return status of the allocation  
     45 
     46  do ix = 1, num_args 
     47    call get_command_argument(ix,args(ix)) 
     48    ! now parse the argument as you wish 
     49  end do 
     50 
     51  READ(args(1),*) nb_servers 
     52 
    3553!!! MPI Initialization    
    3654 
     
    4563    CALL MPI_COMM_RANK(MPI_COMM_WORLD,rank,ierr) 
    4664    CALL MPI_COMM_SIZE(MPI_COMM_WORLD,size,ierr) 
    47     if(rank < size-4) then 
     65    if(rank < size-nb_servers) then 
    4866 
    4967    !$omp parallel default(firstprivate) 
  • XIOS/dev/dev_trunk_omp/src/test/test_remap_omp.f90

    r1608 r1665  
    4141  DOUBLE PRECISION, PARAMETER :: missing_value = 100000 
    4242  INTEGER :: provided 
     43   
     44  integer :: num_args, ix, nb_servers 
     45  character(len=12), dimension(:), allocatable :: args 
     46 
     47  num_args = command_argument_count() 
     48  if(num_args<1) then 
     49    print*, "please give the number of servers as argument." 
     50    call abort 
     51  endif 
     52 
     53  allocate(args(num_args))  ! I've omitted checking the return status of the allocation  
     54 
     55  do ix = 1, num_args 
     56    call get_command_argument(ix,args(ix)) 
     57    ! now parse the argument as you wish 
     58  end do 
     59 
     60  READ(args(1),*) nb_servers 
    4361 
    4462  CALL MPI_INIT_THREAD(3, provided, ierr) 
     
    5169  CALL MPI_COMM_RANK(MPI_COMM_WORLD,rank,ierr) 
    5270  CALL MPI_COMM_SIZE(MPI_COMM_WORLD,size,ierr) 
    53   if(rank < size-2) then 
     71  if(rank < size-nb_servers) then 
    5472  
    5573  !$omp parallel default(firstprivate)  
  • XIOS/dev/dev_trunk_omp/src/transformation/domain_algorithm_interpolate.cpp

    r1661 r1665  
    705705    int countBuff = 0; 
    706706    ep_lib::MPI_Get_count(&recvStatus, MPI_INT, &countBuff); 
    707     #ifdef _usingMPI 
     707     
     708    #ifdef _usingEP 
     709    clientSrcRank = recvStatus.ep_src; 
     710    #else 
    708711    clientSrcRank = recvStatus.MPI_SOURCE; 
    709     #elif _usingEP 
    710     clientSrcRank = recvStatus.ep_src; 
    711712    #endif 
    712713 
     
    864865  #ifdef _usingEP 
    865866  int my_rank_loc = client->intraComm->ep_comm_ptr->size_rank_info[1].first; 
    866   #elif _usingMPI 
     867  #else 
    867868  int my_rank_loc = 0; 
    868869  #endif 
Note: See TracChangeset for help on using the changeset viewer.