Changeset 1665 for XIOS


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
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_trunk_omp/arch/arch-X64_ADA_ep.fcm

    r1646 r1665  
    22###################                Projet XIOS               ################### 
    33################################################################################ 
    4  
    5 %CCOMPILER      mpiicc -std=c++11 -D_usingEP -qopenmp -D_intelmpi 
     4  
     5%CCOMPILER      mpiicc -std=c++11  -qopenmp  
    66%FCOMPILER      mpiifort  -qopenmp 
    77%LINKER         mpiifort  -nofor-main -qopenmp  
  • XIOS/dev/dev_trunk_omp/arch/arch-X64_ADA_mpi.fcm

    r1646 r1665  
    33################################################################################ 
    44 
    5 %CCOMPILER      mpiicc -std=c++11 -D_usingMPI -qopenmp -D_intelmpi 
     5%CCOMPILER      mpiicc -std=c++11 -qopenmp  
    66%FCOMPILER      mpiifort  -qopenmp 
    77%LINKER         mpiifort  -nofor-main -qopenmp  
  • XIOS/dev/dev_trunk_omp/bld.cfg

    r1661 r1665  
    5454bld::target test_complete.exe 
    5555bld::target test_complete_omp.exe 
    56 #bld::target test_client.exe 
     56bld::target test_client.exe 
    5757bld::target test_omp.exe 
    5858#bld::target test_omp2.exe 
  • XIOS/dev/dev_trunk_omp/extern/remap/src/mpi_routing.cpp

    r1661 r1665  
    155155                #ifdef _usingEP 
    156156                MPI_Irecv(&sourceRank[i], 1, MPI_INT, -2, 0, communicator, &request[indexRequest++]); 
    157                 #endif 
    158                  
    159                 #ifdef _usingMPI 
     157                #else 
    160158                MPI_Irecv(&sourceRank[i], 1, MPI_INT, MPI_ANY_SOURCE, 0, communicator, &request[indexRequest++]); 
    161159                #endif 
     
    179177#ifdef _usingEP 
    180178                MPI_Irecv(&sourceRank[i], 1, MPI_INT, -2, 0, communicator, &request[indexRequest]); 
    181 #endif 
    182 #ifdef _usingMPI 
    183                 MPI_Irecv(&sourceRank[i], 1, MPI_INT, MPI_ANY_SOURCE, 0, communicator, &request[indexRequest]); 
     179#else 
     180    MPI_Irecv(&sourceRank[i], 1, MPI_INT, MPI_ANY_SOURCE, 0, communicator, &request[indexRequest]); 
    184181#endif 
    185182                indexRequest++; 
  • XIOS/dev/dev_trunk_omp/make_xios

    r1510 r1665  
    1818arch_defined="FALSE" 
    1919arch_path_defined="FALSE" 
    20  
     20use_ep="FALSE" 
    2121# Traitement de la ligne de commande 
    2222while (($# > 0)) 
     
    3434            echo "       [--full] : to generate dependencies and recompile from scratch" 
    3535            echo "       [--use_oasis 'oasis3' 'oasis3_mct' : default oasis3_mct] : to use Oasis coupler" 
    36         echo "       [--build_path : absolute path to the build directory" 
    37         echo "       [--build_dir : name of the build directory" 
    38         echo "       [--build_suffixed : generate automatically suffixed name of the build directory (e.g. config_X64_CURIE_prod)" 
    39         echo "       [--use_extern_boost : to use external boost library" 
    40         echo "       [--use_extern_blitz : to use external blitz library" 
     36            echo "       [--build_path : absolute path to the build directory" 
     37            echo "       [--build_dir : name of the build directory" 
     38            echo "       [--build_suffixed : generate automatically suffixed name of the build directory (e.g. config_X64_CURIE_prod)" 
     39            echo "       [--use_extern_boost : to use external boost library" 
     40            echo "       [--use_extern_blitz : to use external blitz library" 
    4141            echo "       [--doc] : to generate Doxygen documentation (not available yet)" 
    4242            echo "       [--job ntasks] : to use parallel compilation with ntasks" 
    4343            echo "       [--netcdf_lib 'netcdf4_par'/'netcdf4_seq'/'netcdf4_internal' : default netcdf4_par] : choice of netcdf library" 
    4444            echo "       [--memtrack] : tracking memory leak - developper only" 
     45            echo "       [--omp] : enable multithread XIOS using mpi_endpoint (EP) : default no EP" 
    4546            echo "Example : ./make_xios --prod --arch PW6_VARGAS" 
    4647            echo "Example : ./make_xios --avail" 
     
    6364         "--netcdf_lib")   netcdf_lib=$2 ; shift ; shift ;; 
    6465         "--memtrack")  use_memtrack="true" memtrack=$2  ; shift ; shift ;; 
     66         "--omp")   use_ep="true" ; shift ;; 
    6567         *)         code="$1"           ; shift ;; 
    6668      esac 
     
    153155fi 
    154156 
     157 
     158 
     159 
    155160# Vérification de la présence d'un mode de compilation. 
     161 
     162if [[ "$use_ep" == "true" ]]; then 
     163 
     164if [[ "$compil_mode" == "prod" ]] 
     165   then 
     166      COMPIL_CFLAGS="%PROD_CFLAGS -D_usingEP -D_intelmpi" 
     167      COMPIL_FFLAGS="%PROD_FFLAGS -D_usingEP -D_intelmpi" 
     168elif [[ "$compil_mode" == "dev" ]] 
     169   then  
     170      COMPIL_CFLAGS="%DEV_CFLAGS -D_usingEP -D_intelmpi" 
     171      COMPIL_FFLAGS="%DEV_FFLAGS -D_usingEP -D_intelmpi" 
     172elif [[ "$compil_mode" == "debug" ]] 
     173   then 
     174      COMPIL_CFLAGS="%DEBUG_CFLAGS -D_usingEP -D_intelmpi" 
     175      COMPIL_FFLAGS="%DEBUG_FFLAGS -D_usingEP -D_intelmpi" 
     176fi 
     177 
     178else 
    156179 
    157180if [[ "$compil_mode" == "prod" ]] 
     
    169192fi 
    170193 
     194fi 
    171195rm -r $PWD/extern/netcdf4 
    172196 
  • 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.