Ignore:
Timestamp:
11/15/17 12:14:34 (6 years ago)
Author:
yushan
Message:

dev_omp

Location:
XIOS/dev/branch_openmp/src/io
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_openmp/src/io/inetcdf4.cpp

    r1287 r1328  
    44 
    55#include <boost/algorithm/string.hpp> 
    6 // mpi_std.hpp 
    7 #ifdef _usingEP 
    8 #include "ep_declaration.hpp" 
    9 #endif 
    106 
    117namespace xios 
    128{ 
    13   CINetCDF4::CINetCDF4(const StdString& filename, const MPI_Comm* comm /*= NULL*/, bool multifile /*= true*/, const StdString& timeCounterName /*= "time_counter"*/) 
     9  CINetCDF4::CINetCDF4(const StdString& filename, const ep_lib::MPI_Comm* comm /*= NULL*/, bool multifile /*= true*/, const StdString& timeCounterName /*= "time_counter"*/) 
    1410  { 
    1511    // Don't use parallel mode if there is only one process 
     
    1713    { 
    1814      int commSize = 0; 
    19       MPI_Comm_size(*comm, &commSize); 
     15      ep_lib::MPI_Comm_size(*comm, &commSize); 
    2016      if (commSize <= 1) 
    2117        comm = NULL; 
    2218    } 
    23  
    2419    mpi = comm && !multifile; 
    25     MPI_Info m_info = MPI_INFO_NULL.mpi_info; 
     20    ep_lib::MPI_Info info_null; 
    2621 
    2722    // The file format will be detected automatically by NetCDF, it is safe to always set NC_MPIIO 
    2823    // even if Parallel NetCDF ends up being used. 
    2924    if (mpi) 
    30       CNetCdfInterface::openPar(filename, NC_NOWRITE | NC_MPIIO, *comm, m_info, this->ncidp); 
     25      //CNetCdfInterface::openPar(filename, NC_NOWRITE | NC_MPIIO, *comm, info_null, this->ncidp); 
     26      CNetCdfInterface::openPar(filename, NC_NOWRITE | NC_MPIIO, static_cast<MPI_Comm>(comm->mpi_comm), info_null.mpi_info, this->ncidp); 
    3127    else 
    3228      CNetCdfInterface::open(filename, NC_NOWRITE, this->ncidp); 
  • XIOS/dev/branch_openmp/src/io/inetcdf4.hpp

    r1138 r1328  
    1414#endif  // UNLIMITED_DIM 
    1515 
    16  
    1716namespace xios 
    1817{ 
     
    2322    public: 
    2423      /// Constructors /// 
    25       CINetCDF4(const StdString& filename, const MPI_Comm* comm = NULL, bool multifile = true, 
     24      CINetCDF4(const StdString& filename, const ep_lib::MPI_Comm* comm = NULL, bool multifile = true, 
    2625                const StdString& timeCounterName = "time_counter"); 
    2726      CINetCDF4(const CINetCDF4& inetcdf4);       // Not implemented. 
  • XIOS/dev/branch_openmp/src/io/inetcdf4_decl.cpp

    r1138 r1328  
    11#include "inetcdf4_impl.hpp" 
    2 // mpi_std.hpp 
    32 
    43namespace xios 
  • XIOS/dev/branch_openmp/src/io/inetcdf4_impl.hpp

    r1138 r1328  
    44#include "inetcdf4.hpp" 
    55#include "netCdfInterface.hpp" 
    6 // mpi_std.hpp 
    76 
    87namespace xios 
  • XIOS/dev/branch_openmp/src/io/nc4_data_input.cpp

    r1176 r1328  
    88#include "scalar.hpp" 
    99 
    10 // mpi.hpp 
    11  
    1210namespace xios 
    1311{ 
    14   CNc4DataInput::CNc4DataInput(const StdString& filename, ::MPI_Comm comm_file, bool multifile, bool isCollective /*= true*/, const StdString& timeCounterName /*= "time_counter"*/) 
     12  CNc4DataInput::CNc4DataInput(const StdString& filename, ep_lib::MPI_Comm comm_file, bool multifile, bool isCollective /*= true*/, const StdString& timeCounterName /*= "time_counter"*/) 
    1513    : SuperClass() 
    1614    , SuperClassWriter(filename, &comm_file, multifile, timeCounterName) 
     
    5553    CArray<double,1> fieldData(grid->getWrittenDataSize()); 
    5654    if (!field->default_value.isEmpty()) fieldData = field->default_value; 
    57     #ifdef _usingEP 
    58     SuperClass::type = ONE_FILE; 
    59     printf("SuperClass::type = %d\n", SuperClass::type); 
    60     #endif 
     55 
    6156    switch (SuperClass::type) 
    6257    { 
     
    326321      std::vector<StdSize> nBeginBndsLatLon(3), nSizeBndsLatLon(3); 
    327322      nBeginBndsLatLon[0] = 0; nSizeBndsLatLon[0] = domain->nj_glo.getValue(); 
    328       nBeginBndsLatLon[1] = 0; nSizeBndsLatLon[1] = domain->nj_glo.getValue(); 
     323      nBeginBndsLatLon[1] = 0; nSizeBndsLatLon[1] = domain->ni_glo.getValue(); 
    329324      nBeginBndsLatLon[2] = 0; nSizeBndsLatLon[2] = nbVertex; 
    330325 
  • XIOS/dev/branch_openmp/src/io/nc4_data_input.hpp

    r1138 r1328  
    33 
    44/// XIOS headers /// 
     5#include "mpi_std.hpp" 
    56#include "xios_spl.hpp" 
    67#include "data_input.hpp" 
    78#include "inetcdf4.hpp" 
    8 // mpi_std.hpp 
    99 
    1010namespace xios 
     
    2424 
    2525    /// Constructors /// 
    26     CNc4DataInput(const StdString& filename, MPI_Comm comm_file, bool multifile, bool isCollective = true, 
     26    CNc4DataInput(const StdString& filename, ep_lib::MPI_Comm comm_file, bool multifile, bool isCollective = true, 
    2727                  const StdString& timeCounterName = "time_counter"); 
    2828    CNc4DataInput(const CNc4DataInput& dataInput);       // Not implemented. 
     
    7171  private: 
    7272    /// Private attributes /// 
    73     MPI_Comm comm_file; 
     73    ep_lib::MPI_Comm comm_file; 
    7474    const StdString filename; 
    7575    bool isCollective; 
  • XIOS/dev/branch_openmp/src/io/nc4_data_output.cpp

    r1205 r1328  
    1313#include "timer.hpp" 
    1414#include "uuid.hpp" 
    15 // mpi.hpp 
    16  
    1715namespace xios 
    1816{ 
     
    3028      CNc4DataOutput::CNc4DataOutput 
    3129         (CFile* file, const StdString & filename, bool exist, bool useClassicFormat, bool useCFConvention, 
    32           ::MPI_Comm comm_file, bool multifile, bool isCollective, const StdString& timeCounterName) 
     30          ep_lib::MPI_Comm comm_file, bool multifile, bool isCollective, const StdString& timeCounterName) 
    3331            : SuperClass() 
    3432            , SuperClassWriter(filename, exist, useClassicFormat, useCFConvention, &comm_file, multifile, timeCounterName) 
     
    465463      StdString domainName = domain->name; 
    466464      domain->assignMesh(domainName, domain->nvertex); 
    467       domain->mesh->createMeshEpsilon(static_cast< ::MPI_Comm >(server->intraComm.mpi_comm), domain->lonvalue_srv, domain->latvalue_srv, domain->bounds_lon_srv, domain->bounds_lat_srv); 
     465      domain->mesh->createMeshEpsilon(server->intraComm, domain->lonvalue_srv, domain->latvalue_srv, domain->bounds_lon_srv, domain->bounds_lat_srv); 
    468466 
    469467      StdString node_x = domainName + "_node_x"; 
  • XIOS/dev/branch_openmp/src/io/nc4_data_output.hpp

    r1138 r1328  
    44/// XIOS headers /// 
    55#include "xios_spl.hpp" 
     6#include "mpi_std.hpp" 
    67#include "onetcdf4.hpp" 
    78#include "data_output.hpp" 
    8 // mpi_std.hpp 
    99 
    1010namespace xios 
     
    2727            CNc4DataOutput 
    2828               (CFile* file, const StdString & filename, bool exist, bool useClassicFormat, 
    29                 bool useCFConvention, MPI_Comm comm_file, bool multifile,  
    30                 bool isCollective = true, const StdString& timeCounterName = "time_counter"); 
     29                bool useCFConvention, 
     30                ep_lib::MPI_Comm comm_file, bool multifile, bool isCollective = true, 
     31                const StdString& timeCounterName = "time_counter"); 
    3132 
    3233            CNc4DataOutput(const CNc4DataOutput & dataoutput);       // Not implemented. 
     
    116117 
    117118            /// Propriétés privées /// 
    118             MPI_Comm comm_file; 
     119            ep_lib::MPI_Comm comm_file; 
    119120            const StdString filename; 
    120121            std::map<Time, StdSize> timeToRecordCache; 
  • XIOS/dev/branch_openmp/src/io/netCdfInterface.cpp

    r1153 r1328  
    1010#include "netCdfInterface.hpp" 
    1111#include "netCdfException.hpp" 
    12 // mpi_std.hpp 
    1312 
    1413namespace xios 
     
    5049int CNetCdfInterface::createPar(const StdString& fileName, int cMode, MPI_Comm comm, MPI_Info info, int& ncId) 
    5150{ 
    52   int status = xios::nc_create_par(fileName.c_str(), cMode, comm, info, &ncId); 
     51  int status = xios::nc_create_par(fileName.c_str(), cMode, comm, MPI_INFO_NULL.mpi_info, &ncId); 
    5352  if (NC_NOERR != status) 
    5453  { 
     
    7574int CNetCdfInterface::open(const StdString& fileName, int oMode, int& ncId) 
    7675{ 
    77   int status = NC_NOERR; 
    78   #pragma omp critical (_netcdf) 
    79   status = nc_open(fileName.c_str(), oMode, &ncId); 
    80    
     76  int status = nc_open(fileName.c_str(), oMode, &ncId); 
    8177  if (NC_NOERR != status) 
    8278  { 
     
    106102int CNetCdfInterface::openPar(const StdString& fileName, int oMode, MPI_Comm comm, MPI_Info info, int& ncId) 
    107103{ 
    108   int status; 
    109   #pragma omp critical (_netcdf) 
    110   status = xios::nc_open_par(fileName.c_str(), oMode, comm, info, &ncId); // nc_open 
     104  //int status = xios::nc_open_par(fileName.c_str(), oMode, comm, info, &ncId); 
     105  int status = xios::nc_open_par(fileName.c_str(), oMode, comm, MPI_INFO_NULL.mpi_info, &ncId); 
    111106  if (NC_NOERR != status) 
    112107  { 
     
    131126int CNetCdfInterface::close(int ncId) 
    132127{ 
    133   int status = NC_NOERR; 
    134   #pragma omp critical (_netcdf) 
    135   //#pragma omp master 
    136   { 
    137   status = nc_close(ncId); 
     128  int status = nc_close(ncId); 
    138129  if (NC_NOERR != status) 
    139130  { 
     
    146137    throw CNetCdfException(e); 
    147138  } 
    148   } 
     139 
    149140  return status; 
    150141} 
     
    356347int CNetCdfInterface::inqDimLen(int ncid, int dimId, StdSize& dimLen) 
    357348{ 
    358   int status; 
    359   #pragma omp critical (_netcdf) 
    360   status = nc_inq_dimlen(ncid, dimId, &dimLen); 
     349  int status = nc_inq_dimlen(ncid, dimId, &dimLen); 
    361350  if (NC_NOERR != status) 
    362351  { 
  • XIOS/dev/branch_openmp/src/io/netCdfInterface.hpp

    r1134 r1328  
    1010#define __NETCDF_INTERFACE_HPP_ 
    1111 
     12#include "mpi_std.hpp" 
    1213#include "xios_spl.hpp" 
    1314 
     
    1617#endif 
    1718 
    18 #include "mpi_std.hpp" 
    1919#include "netcdf.hpp" 
    2020 
  • XIOS/dev/branch_openmp/src/io/netCdfInterface_decl.cpp

    r1138 r1328  
    99 
    1010#include "netCdfInterface_impl.hpp" 
    11 // mpi_std.hpp 
    1211 
    1312namespace xios 
  • XIOS/dev/branch_openmp/src/io/netCdfInterface_impl.hpp

    r1146 r1328  
    1313#include "netCdfInterface.hpp" 
    1414#include "netCdfException.hpp" 
    15 // mpi_std.hpp 
    1615 
    1716namespace xios 
     
    8685  int CNetCdfInterface::getVaraType(int ncid, int varId, const StdSize* start, const StdSize* count, T* data) 
    8786  { 
    88     int status; 
    89     #pragma omp critical (_netcdf) 
    90     status = ncGetVaraType(ncid, varId, start, count, data); 
     87    int status = ncGetVaraType(ncid, varId, start, count, data); 
    9188    if (NC_NOERR != status) 
    9289    { 
  • XIOS/dev/branch_openmp/src/io/netCdf_cf_constant.hpp

    r1138 r1328  
    44#include "inetcdf4.hpp" 
    55#include "netCdfInterface.hpp" 
    6  
    7 // mpi_std.hpp 
    86 
    97namespace xios 
  • XIOS/dev/branch_openmp/src/io/netcdf.hpp

    r1138 r1328  
    1818extern "C" 
    1919{ 
    20   #include <netcdf_par.h> 
     20include <netcdf_par.h> 
    2121} 
    2222#  endif 
  • XIOS/dev/branch_openmp/src/io/onetcdf4.cpp

    r1287 r1328  
    1212      /// ////////////////////// Définitions ////////////////////// /// 
    1313 
    14       CONetCDF4::CONetCDF4(const StdString& filename, bool append, bool useClassicFormat, bool useCFConvention,  
    15                            const MPI_Comm* comm, bool multifile, const StdString& timeCounterName) 
     14      CONetCDF4::CONetCDF4(const StdString& filename, bool append, bool useClassicFormat, 
     15                                                        bool useCFConvention, 
     16                           const ep_lib::MPI_Comm* comm, bool multifile, const StdString& timeCounterName) 
    1617        : path() 
    1718        , wmpi(false) 
     
    3132 
    3233      void CONetCDF4::initialize(const StdString& filename, bool append, bool useClassicFormat, bool useCFConvention,  
    33                                  const MPI_Comm* comm, bool multifile, const StdString& timeCounterName) 
     34                                 const ep_lib::MPI_Comm* comm, bool multifile, const StdString& timeCounterName) 
    3435      { 
    3536         this->useClassicFormat = useClassicFormat; 
     
    4243         { 
    4344            int commSize = 0; 
    44             MPI_Comm_size(*comm, &commSize); 
     45            ep_lib::MPI_Comm_size(*comm, &commSize); 
    4546            if (commSize <= 1) 
    4647               comm = NULL; 
    4748         } 
    4849         wmpi = comm && !multifile; 
     50         ep_lib::MPI_Info info_null; 
    4951 
    5052         if (wmpi) 
     
    5658            CTimer::get("Files : create").resume(); 
    5759            if (wmpi) 
    58                CNetCdfInterface::createPar(filename, mode, *comm, MPI_INFO_NULL.mpi_info, this->ncidp); 
     60               CNetCdfInterface::createPar(filename, mode, static_cast<MPI_Comm>(comm->mpi_comm), info_null.mpi_info, this->ncidp); 
    5961            else 
    6062               CNetCdfInterface::create(filename, mode, this->ncidp); 
     
    6870            CTimer::get("Files : open").resume(); 
    6971            if (wmpi) 
    70                CNetCdfInterface::openPar(filename, mode, *comm, MPI_INFO_NULL.mpi_info, this->ncidp); 
     72               CNetCdfInterface::openPar(filename, mode, static_cast<MPI_Comm>(comm->mpi_comm), info_null.mpi_info, this->ncidp); 
    7173            else 
    7274               CNetCdfInterface::open(filename, mode, this->ncidp); 
     
    539541                                 const std::vector<StdSize>& scount, const int* data) 
    540542      { 
    541          CNetCdfInterface::putVaraType(grpid, varid, &sstart[0], &scount[0], data); 
    542       } 
    543  
     543          CNetCdfInterface::putVaraType(grpid, varid, &sstart[0], &scount[0], data); 
     544      } 
    544545      //--------------------------------------------------------------- 
    545546 
     
    549550                                 const std::vector<StdSize>& scount, const float* data) 
    550551      { 
    551          CNetCdfInterface::putVaraType(grpid, varid, &sstart[0], &scount[0], data); 
     552          CNetCdfInterface::putVaraType(grpid, varid, &sstart[0], &scount[0], data); 
    552553      } 
    553554 
  • XIOS/dev/branch_openmp/src/io/onetcdf4.hpp

    r1205 r1328  
    44/// XIOS headers /// 
    55#include "xios_spl.hpp" 
     6#include "mpi_std.hpp" 
    67#include "exception.hpp" 
    78#include "data_output.hpp" 
    89#include "array_new.hpp" 
    9 #include "mpi_std.hpp" 
    1010#include "netcdf.hpp" 
    1111 
     
    1313   #define UNLIMITED_DIM (size_t)(-1) 
    1414#endif  //UNLIMITED_DIM 
    15  
    16 // mpi_std.hpp 
    1715 
    1816namespace xios 
     
    3028            CONetCDF4(const StdString& filename, bool append, bool useClassicFormat = false, 
    3129                          bool useCFConvention = true, 
    32                       const MPI_Comm* comm = NULL, bool multifile = true, 
     30                      const ep_lib::MPI_Comm* comm = NULL, bool multifile = true, 
    3331                      const StdString& timeCounterName = "time_counter"); 
    3432 
     
    3937            /// Initialisation /// 
    4038            void initialize(const StdString& filename, bool append, bool useClassicFormat, bool useCFConvention, 
    41                             const MPI_Comm* comm, bool multifile, const StdString& timeCounterName); 
     39                            const ep_lib::MPI_Comm* comm, bool multifile, const StdString& timeCounterName); 
    4240            void close(void); 
    4341            void sync(void); 
  • XIOS/dev/branch_openmp/src/io/onetcdf4_decl.cpp

    r1138 r1328  
    11#include "onetcdf4_impl.hpp" 
    2 // mpi_std.hpp 
    32 
    43namespace xios 
  • XIOS/dev/branch_openmp/src/io/onetcdf4_impl.hpp

    r1205 r1328  
    55#include "netCdfInterface.hpp" 
    66#include "timer.hpp" 
    7 // mpi_std.hpp 
    87 
    98namespace xios 
Note: See TracChangeset for help on using the changeset viewer.