Ignore:
Timestamp:
11/19/18 15:52:54 (6 years ago)
Author:
yushan
Message:

branch_openmp merged with trunk r1597

Location:
XIOS/dev/dev_trunk_omp/src/io
Files:
11 edited

Legend:

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

    r1534 r1601  
    22#include "netCdfInterface.hpp" 
    33#include "netCdf_cf_constant.hpp" 
    4  
     4#include "ep_mpi.hpp" 
    55#include <boost/algorithm/string.hpp> 
    66 
    77namespace xios 
    88{ 
    9   CINetCDF4::CINetCDF4(const StdString& filename, const MPI_Comm* comm /*= NULL*/, bool multifile /*= true*/, 
     9  CINetCDF4::CINetCDF4(const StdString& filename, const ep_lib::MPI_Comm* comm /*= NULL*/, bool multifile /*= true*/, 
    1010                       bool readMetaDataPar /*= false*/, const StdString& timeCounterName /*= "time_counter"*/) 
    1111  { 
     
    1414    { 
    1515      int commSize = 0; 
    16       MPI_Comm_size(*comm, &commSize); 
     16      ep_lib::MPI_Comm_size(*comm, &commSize); 
    1717      if (commSize <= 1) 
    1818        comm = NULL; 
     
    2323    // even if Parallel NetCDF ends up being used. 
    2424    if (mpi) 
    25       CNetCdfInterface::openPar(filename, NC_NOWRITE | NC_MPIIO, *comm, MPI_INFO_NULL, this->ncidp); 
     25      CNetCdfInterface::openPar(filename, NC_NOWRITE | NC_MPIIO, to_mpi_comm((*comm)->mpi_comm), to_mpi_info(MPI_INFO_NULL), this->ncidp); 
    2626    else 
    2727      CNetCdfInterface::open(filename, NC_NOWRITE, this->ncidp); 
  • XIOS/dev/dev_trunk_omp/src/io/inetcdf4.hpp

    r1485 r1601  
    77#include "array_new.hpp" 
    88 
    9 #include "mpi.hpp" 
     9#include "mpi_std.hpp" 
    1010#include "netcdf.hpp" 
    1111 
     
    2222    public: 
    2323      /// Constructors /// 
    24       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, 
    2525                bool readMetaDataPar = false, const StdString& timeCounterName = "time_counter"); 
    2626 
  • XIOS/dev/dev_trunk_omp/src/io/nc4_data_input.cpp

    r1582 r1601  
    1010namespace xios 
    1111{ 
    12   CNc4DataInput::CNc4DataInput(const StdString& filename, MPI_Comm comm_file, bool multifile, bool isCollective /*= true*/, 
     12  CNc4DataInput::CNc4DataInput(const StdString& filename, ep_lib::MPI_Comm comm_file, bool multifile, bool isCollective /*= true*/, 
    1313                               bool readMetaDataPar /*= false*/, bool ugridConvention /*= false*/, const StdString& timeCounterName /*= "time_counter"*/) 
    1414    : SuperClass() 
     
    5555    CArray<double,1> fieldData(grid->getWrittenDataSize()); 
    5656    if (!field->default_value.isEmpty()) fieldData = field->default_value; 
    57  
     57    #ifdef _usingEP 
     58      SuperClass::type = ONE_FILE; 
     59      printf("SuperClass::type = %d\n", SuperClass::type); 
     60    #endif 
     61         
    5862    switch (SuperClass::type) 
    5963    { 
  • XIOS/dev/dev_trunk_omp/src/io/nc4_data_input.hpp

    r1486 r1601  
    33 
    44/// XIOS headers /// 
     5#include "mpi_std.hpp" 
    56#include "xios_spl.hpp" 
    67#include "data_input.hpp" 
     
    2324 
    2425    /// Constructors /// 
    25     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, 
    2627                  bool readMetaDataPar = false, bool ugridConvention = false, const StdString& timeCounterName = "time_counter"); 
    2728    CNc4DataInput(const CNc4DataInput& dataInput);       // Not implemented. 
     
    7071  private: 
    7172    /// Private attributes /// 
    72     MPI_Comm comm_file; 
     73    ep_lib::MPI_Comm comm_file; 
    7374    const StdString filename; 
    7475    bool isCollective; 
  • XIOS/dev/dev_trunk_omp/src/io/nc4_data_output.cpp

    r1559 r1601  
    2828      CNc4DataOutput::CNc4DataOutput 
    2929         (CFile* file, const StdString & filename, bool exist, bool useClassicFormat, bool useCFConvention, 
    30           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) 
    3131            : SuperClass() 
    3232            , SuperClassWriter(filename, exist, useClassicFormat, useCFConvention, &comm_file, multifile, timeCounterName) 
  • XIOS/dev/dev_trunk_omp/src/io/nc4_data_output.hpp

    r1542 r1601  
    44/// XIOS headers /// 
    55#include "xios_spl.hpp" 
     6#include "mpi_std.hpp" 
    67#include "onetcdf4.hpp" 
    78#include "data_output.hpp" 
     
    2728               (CFile* file, const StdString & filename, bool exist, bool useClassicFormat, 
    2829                bool useCFConvention, 
    29                 MPI_Comm comm_file, bool multifile, bool isCollective = true, 
     30                ep_lib::MPI_Comm comm_file, bool multifile, bool isCollective = true, 
    3031                const StdString& timeCounterName = "time_counter"); 
    3132 
     
    117118 
    118119            /// Propriétés privées /// 
    119             MPI_Comm comm_file; 
     120            ep_lib::MPI_Comm comm_file; 
    120121            const StdString filename; 
    121122            std::map<Time, StdSize> timeToRecordCache; 
  • XIOS/dev/dev_trunk_omp/src/io/netCdfInterface.cpp

    r1454 r1601  
    1010#include "netCdfInterface.hpp" 
    1111#include "netCdfException.hpp" 
    12  
     12#include "ep_mpi.hpp" 
    1313namespace xios 
    1414{ 
     
    2222int CNetCdfInterface::create(const StdString& fileName, int cMode, int& ncId) 
    2323{ 
    24   int status = nc_create(fileName.c_str(), cMode, &ncId); 
     24  int status; 
     25  #pragma omp critical (_netcdf) 
     26  { 
     27    info(100)<<"start nc_create"<<std::endl; 
     28    status = nc_create(fileName.c_str(), cMode, &ncId); 
     29    info(100)<<"end nc_create"<<std::endl; 
     30  } 
    2531  if (NC_NOERR != status) 
    2632  { 
     
    4955int CNetCdfInterface::createPar(const StdString& fileName, int cMode, MPI_Comm comm, MPI_Info info, int& ncId) 
    5056{ 
    51   int status = xios::nc_create_par(fileName.c_str(), cMode, comm, info, &ncId); 
     57  int status = xios::nc_create_par(fileName.c_str(), cMode, comm, to_mpi_info(MPI_INFO_NULL), &ncId); 
     58 
    5259  if (NC_NOERR != status) 
    5360  { 
     
    7481int CNetCdfInterface::open(const StdString& fileName, int oMode, int& ncId) 
    7582{ 
    76   int status = nc_open(fileName.c_str(), oMode, &ncId); 
     83  int status; 
     84  #pragma omp critical (_netcdf) 
     85  { 
     86    info(100)<<"start nc_open"<<std::endl; 
     87    status = nc_open(fileName.c_str(), oMode, &ncId); 
     88    info(100)<<"end nc_open"<<std::endl; 
     89  } 
    7790  if (NC_NOERR != status) 
    7891  { 
     
    102115int CNetCdfInterface::openPar(const StdString& fileName, int oMode, MPI_Comm comm, MPI_Info info, int& ncId) 
    103116{ 
    104   int status = xios::nc_open_par(fileName.c_str(), oMode, comm, info, &ncId); 
     117  int status = xios::nc_open_par(fileName.c_str(), oMode, comm, to_mpi_info(MPI_INFO_NULL), &ncId); 
     118   
    105119  if (NC_NOERR != status) 
    106120  { 
     
    125139int CNetCdfInterface::close(int ncId) 
    126140{ 
    127   int status = nc_close(ncId); 
     141  int status = NC_NOERR; 
     142  #pragma omp critical (_netcdf) 
     143  { 
     144    info(100)<<"start nc_close"<<std::endl; 
     145    status = nc_close(ncId); 
     146    info(100)<<"end nc_close"<<std::endl; 
     147  } 
     148       
    128149  if (NC_NOERR != status) 
    129150  { 
     
    147168int CNetCdfInterface::reDef(int ncId) 
    148169{ 
    149   int status = nc_redef(ncId); 
     170  int status; 
     171  #pragma omp critical (_netcdf) 
     172  { 
     173    info(100)<<"start nc_reDef"<<std::endl; 
     174    status = nc_redef(ncId); 
     175    info(100)<<"end nc_reDef"<<std::endl; 
     176  } 
     177   
    150178  if (NC_NOERR != status) 
    151179  { 
     
    169197int CNetCdfInterface::endDef(int ncId) 
    170198{ 
    171   int status = nc_enddef(ncId); 
     199  int status; 
     200  #pragma omp critical (_netcdf) 
     201  { 
     202    info(100)<<"start nc_enddef"<<std::endl; 
     203    status = nc_enddef(ncId); 
     204    info(100)<<"end nc_enddef"<<std::endl; 
     205  } 
    172206  if (NC_NOERR != status) 
    173207  { 
     
    194228int CNetCdfInterface::inqNcId(int ncid, const StdString& grpName, int& grpId) 
    195229{ 
    196   int status = nc_inq_ncid(ncid, grpName.c_str(), &grpId); 
     230  int status; 
     231  #pragma omp critical (_netcdf) 
     232  { 
     233    info(100)<<"start nc_inq_ncid"<<std::endl; 
     234    status = nc_inq_ncid(ncid, grpName.c_str(), &grpId); 
     235    info(100)<<"end nc_inq_ncid"<<std::endl; 
     236  } 
     237   
    197238  if (NC_NOERR != status) 
    198239  { 
     
    220261int CNetCdfInterface::inqVarId(int ncid, const StdString& varName, int& varId) 
    221262{ 
    222   int status = nc_inq_varid(ncid, varName.c_str(), &varId); 
     263  int status; 
     264  #pragma omp critical (_netcdf) 
     265  { 
     266    info(100)<<"start nc_inq_varid"<<std::endl; 
     267    status = nc_inq_varid(ncid, varName.c_str(), &varId); 
     268    info(100)<<"end nc_inq_varid"<<std::endl; 
     269  } 
    223270  if (NC_NOERR != status) 
    224271  { 
     
    245292int CNetCdfInterface::inqDimId(int ncid, const StdString& dimName, int& dimId) 
    246293{ 
    247   int status = nc_inq_dimid(ncid, dimName.c_str(), &dimId); 
     294  int status; 
     295  #pragma omp critical (_netcdf) 
     296  { 
     297    info(100)<<"start nc_inq_dimid"<<std::endl; 
     298    status = nc_inq_dimid(ncid, dimName.c_str(), &dimId); 
     299    info(100)<<"end nc_inq_dimid"<<std::endl; 
     300  } 
     301   
    248302  if (NC_NOERR != status) 
    249303  { 
     
    271325{ 
    272326  char varNameBuff[NC_MAX_NAME + 1]; 
    273   int status = nc_inq_varname(ncid, varId, varNameBuff); 
     327  int status; 
     328  #pragma omp critical (_netcdf) 
     329  { 
     330    info(100)<<"start nc_inq_varname"<<std::endl; 
     331    status = nc_inq_varname(ncid, varId, varNameBuff); 
     332    info(100)<<"end nc_inq_varname"<<std::endl; 
     333  } 
    274334  if (NC_NOERR != status) 
    275335  { 
     
    295355int CNetCdfInterface::inqUnLimDim(int ncid, int& dimId) 
    296356{ 
    297   int status = nc_inq_unlimdim(ncid, &dimId); 
     357  int status; 
     358  #pragma omp critical (_netcdf) 
     359  { 
     360    info(100)<<"start nc_inq_unlimdim"<<std::endl; 
     361    status = nc_inq_unlimdim(ncid, &dimId); 
     362    info(100)<<"end nc_inq_unlimdim"<<std::endl; 
     363  } 
    298364  if (NC_NOERR != status) 
    299365  { 
     
    321387{ 
    322388  char fullNameIn[NC_MAX_NAME + 1]; 
    323   int status = nc_inq_dimname(ncid, dimId, fullNameIn); 
     389  int status; 
     390  #pragma omp critical (_netcdf) 
     391  { 
     392    info(100)<<"start nc_inq_dimname"<<std::endl; 
     393    status = nc_inq_dimname(ncid, dimId, fullNameIn); 
     394    info(100)<<"end nc_inq_dimname"<<std::endl; 
     395  } 
    324396  if (NC_NOERR != status) 
    325397  { 
     
    346418int CNetCdfInterface::inqDimLen(int ncid, int dimId, StdSize& dimLen) 
    347419{ 
    348   int status = nc_inq_dimlen(ncid, dimId, &dimLen); 
     420  int status; 
     421  #pragma omp critical (_netcdf) 
     422  { 
     423    info(100)<<"start nc_inq_dimlen"<<std::endl; 
     424    status = nc_inq_dimlen(ncid, dimId, &dimLen); 
     425    info(100)<<"end nc_inq_dimlen"<<std::endl; 
     426  } 
    349427  if (NC_NOERR != status) 
    350428  { 
     
    371449int CNetCdfInterface::inqVarNDims(int ncid, int varId, int& nDims) 
    372450{ 
    373   int status = nc_inq_varndims(ncid, varId, &nDims); 
     451  int status; 
     452  #pragma omp critical (_netcdf) 
     453  { 
     454    info(100)<<"start nc_inq_varndims"<<std::endl; 
     455    status = nc_inq_varndims(ncid, varId, &nDims); 
     456    info(100)<<"end nc_inq_varndims"<<std::endl; 
     457  } 
    374458  if (NC_NOERR != status) 
    375459  { 
     
    396480int CNetCdfInterface::inqVarDimId(int ncid, int varId, int* dimIds) 
    397481{ 
    398   int status = nc_inq_vardimid(ncid, varId, dimIds); 
     482  int status; 
     483  #pragma omp critical (_netcdf) 
     484  { 
     485    info(100)<<"start nc_inq_vardimid"<<std::endl; 
     486    status = nc_inq_vardimid(ncid, varId, dimIds); 
     487    info(100)<<"end nc_inq_vardimid"<<std::endl; 
     488  } 
    399489  if (NC_NOERR != status) 
    400490  { 
     
    422512int CNetCdfInterface::inqDimIds(int ncid, int& nDims, int* dimIds, int includeParents) 
    423513{ 
    424   int status = nc_inq_dimids(ncid, &nDims, dimIds, includeParents); 
     514  int status; 
     515  #pragma omp critical (_netcdf) 
     516  { 
     517    info(100)<<"start nc_inq_dimids"<<std::endl; 
     518    status = nc_inq_dimids(ncid, &nDims, dimIds, includeParents); 
     519    info(100)<<"end nc_inq_dimids"<<std::endl; 
     520  } 
    425521  if (NC_NOERR != status) 
    426522  { 
     
    449545  StdSize strlen = 0; 
    450546  std::vector<char> buff; 
    451   int status = nc_inq_grpname_full(ncid, &strlen, NULL); 
    452   if (NC_NOERR == status) 
    453   { 
    454     buff.resize(strlen + 1); 
    455     status = nc_inq_grpname_full(ncid, NULL, &buff[0]); 
    456   } 
    457  
     547  int status; 
     548  #pragma omp critical (_netcdf) 
     549  { 
     550    info(100)<<"start nc_inq_grpname_full"<<std::endl; 
     551    status = nc_inq_grpname_full(ncid, &strlen, NULL); 
     552    info(100)<<"end nc_inq_grpname_full"<<std::endl; 
     553   
     554    if (NC_NOERR == status) 
     555    { 
     556      buff.resize(strlen + 1); 
     557      status = nc_inq_grpname_full(ncid, NULL, &buff[0]); 
     558    } 
     559    info(100)<<"start nc_inq_grpname_full"<<std::endl; 
     560  } 
    458561  if (NC_NOERR != status) 
    459562  { 
     
    482585int CNetCdfInterface::inqGrpIds(int ncid, int& numgrps, int* ncids) 
    483586{ 
    484   int status = nc_inq_grps(ncid, &numgrps, ncids); 
     587  int status; 
     588  #pragma omp critical (_netcdf) 
     589  { 
     590    info(100)<<"start nc_inq_grps"<<std::endl; 
     591    status = nc_inq_grps(ncid, &numgrps, ncids); 
     592    info(100)<<"end nc_inq_grps"<<std::endl; 
     593  } 
    485594  if (NC_NOERR != status) 
    486595  { 
     
    507616int CNetCdfInterface::inqVarIds(int ncid, int& nvars, int* varids) 
    508617{ 
    509   int status = nc_inq_varids(ncid, &nvars, varids); 
     618  int status; 
     619  #pragma omp critical (_netcdf) 
     620  { 
     621    info(100)<<"start nc_inq_varids"<<std::endl; 
     622    status = nc_inq_varids(ncid, &nvars, varids); 
     623    info(100)<<"end nc_inq_varids"<<std::endl; 
     624  } 
    510625  if (NC_NOERR != status) 
    511626  { 
     
    534649int CNetCdfInterface::inqAtt(int ncid, int varid, const StdString& name, nc_type& type, size_t& len) 
    535650{ 
    536   int status = nc_inq_att(ncid, varid, name.c_str(), &type, &len); 
     651  int status; 
     652  #pragma omp critical (_netcdf) 
     653  { 
     654    info(100)<<"start nc_inq_att"<<std::endl; 
     655    status = nc_inq_att(ncid, varid, name.c_str(), &type, &len); 
     656    info(100)<<"end nc_inq_att"<<std::endl; 
     657  } 
     658   
    537659  if (NC_NOERR != status) 
    538660  { 
     
    558680int CNetCdfInterface::inqNAtts(int ncid, int& ngatts) 
    559681{ 
    560   int status = nc_inq_natts(ncid, &ngatts); 
     682  int status; 
     683  #pragma omp critical (_netcdf) 
     684  { 
     685    info(100)<<"start nc_inq_natts"<<std::endl; 
     686    status = nc_inq_natts(ncid, &ngatts); 
     687    info(100)<<"end nc_inq_natts"<<std::endl; 
     688  } 
    561689  if (NC_NOERR != status) 
    562690  { 
     
    583711int CNetCdfInterface::inqVarNAtts(int ncid, int varid, int& natts) 
    584712{ 
    585   int status = nc_inq_varnatts(ncid, varid, &natts); 
     713  int status; 
     714  #pragma omp critical (_netcdf) 
     715  { 
     716    info(100)<<"start nc_inq_varnatts"<<std::endl; 
     717    status = nc_inq_varnatts(ncid, varid, &natts); 
     718    info(100)<<"end nc_inq_varnatts"<<std::endl; 
     719  } 
    586720  if (NC_NOERR != status) 
    587721  { 
     
    604738{ 
    605739  std::vector<char> attName(NC_MAX_NAME + 1,' '); 
    606   int status = nc_inq_attname(ncid, varid, attnum, &attName[0]); 
     740  int status; 
     741  #pragma omp critical (_netcdf) 
     742  { 
     743    info(100)<<"start nc_inq_attname"<<std::endl; 
     744    status = nc_inq_attname(ncid, varid, attnum, &attName[0]); 
     745    info(100)<<"end nc_inq_attname"<<std::endl; 
     746  } 
    607747  if (NC_NOERR != status) 
    608748  { 
     
    635775int CNetCdfInterface::defGrp(int parentNcid, const StdString& grpName, int& grpId) 
    636776{ 
    637   int status = nc_def_grp(parentNcid, grpName.c_str(), &grpId); 
     777  int status; 
     778  #pragma omp critical (_netcdf) 
     779  { 
     780    info(100)<<"start nc_def_grp"<<std::endl; 
     781    status = nc_def_grp(parentNcid, grpName.c_str(), &grpId); 
     782    info(100)<<"end nc_def_grp"<<std::endl; 
     783  } 
    638784  if (NC_NOERR != status) 
    639785  { 
     
    660806int CNetCdfInterface::defDim(int ncid, const StdString& dimName, StdSize dimLen, int& dimId) 
    661807{ 
    662   int status = nc_def_dim(ncid, dimName.c_str(), dimLen, &dimId); 
     808  int status; 
     809  #pragma omp critical (_netcdf) 
     810  { 
     811    info(100)<<"start nc_def_dim"<<std::endl; 
     812    status = nc_def_dim(ncid, dimName.c_str(), dimLen, &dimId); 
     813    info(100)<<"end nc_def_dim"<<std::endl; 
     814  } 
    663815  if (NC_NOERR != status) 
    664816  { 
     
    691843                             int nDims, const int dimIds[], int& varId) 
    692844{ 
    693   int status = nc_def_var(ncid, varName.c_str(), xtype, nDims, dimIds, &varId); 
     845  int status; 
     846  #pragma omp critical (_netcdf) 
     847  { 
     848    info(100)<<"start nc_def_var"<<std::endl; 
     849    status = nc_def_var(ncid, varName.c_str(), xtype, nDims, dimIds, &varId); 
     850    info(100)<<"end nc_def_var"<<std::endl; 
     851  } 
    694852  if (NC_NOERR != status) 
    695853  { 
     
    720878int CNetCdfInterface::defVarChunking(int ncid, int varId, int storage, StdSize chunkSize[]) 
    721879{ 
    722   int status = nc_def_var_chunking(ncid, varId, storage, chunkSize); 
     880  int status; 
     881  #pragma omp critical (_netcdf) 
     882  { 
     883    info(100)<<"start nc_def_var_chunking"<<std::endl; 
     884    status = nc_def_var_chunking(ncid, varId, storage, chunkSize); 
     885    info(100)<<"end nc_def_var_chunking"<<std::endl; 
     886  } 
    723887  if (NC_NOERR != status) 
    724888  { 
     
    748912   
    749913  if (compressionLevel == 0) return NC_NOERR ; 
    750   int status = nc_def_var_deflate(ncid, varId, (compressionLevel > 0), (compressionLevel > 0), compressionLevel); 
     914  int status; 
     915  #pragma omp critical (_netcdf) 
     916  { 
     917    info(100)<<"start nc_def_var_deflate"<<std::endl; 
     918    status = nc_def_var_deflate(ncid, varId, (compressionLevel > 0), (compressionLevel > 0), compressionLevel); 
     919    info(100)<<"end nc_def_var_deflate"<<std::endl; 
     920  } 
    751921  if (NC_NOERR != status) 
    752922  { 
     
    774944{ 
    775945  int old_fill_mode; 
    776   int status = nc_set_fill(ncid, fill ? NC_FILL: NC_NOFILL, &old_fill_mode); 
     946  int status; 
     947  #pragma omp critical (_netcdf) 
     948  { 
     949    info(100)<<"start nc_set_fill"<<std::endl; 
     950    status = nc_set_fill(ncid, fill ? NC_FILL: NC_NOFILL, &old_fill_mode); 
     951    info(100)<<"end nc_set_fill"<<std::endl; 
     952  } 
    777953  if (NC_NOERR != status) 
    778954  { 
     
    801977int CNetCdfInterface::defVarFill(int ncid, int varId, int noFill, void* fillValue) 
    802978{ 
    803   int status = nc_def_var_fill(ncid, varId, noFill, fillValue); 
     979  int status; 
     980  #pragma omp critical (_netcdf) 
     981  { 
     982    info(100)<<"start nc_def_var_fill"<<std::endl; 
     983    status = nc_def_var_fill(ncid, varId, noFill, fillValue); 
     984    info(100)<<"end nc_def_var_fill"<<std::endl; 
     985  } 
    804986  if (NC_NOERR != status) 
    805987  { 
     
    8291011int CNetCdfInterface::varParAccess(int ncid, int varId, int access) 
    8301012{ 
    831   int status = nc_var_par_access(ncid, varId, access); 
     1013  int status; 
     1014  #pragma omp critical (_netcdf) 
     1015  { 
     1016    info(100)<<"start nc_var_par_access"<<std::endl; 
     1017    status = nc_var_par_access(ncid, varId, access); 
     1018    info(100)<<"end nc_var_par_access"<<std::endl; 
     1019  } 
    8321020  if (NC_NOERR != status) 
    8331021  { 
     
    8521040int CNetCdfInterface::sync(int ncid) 
    8531041{ 
    854   int status = nc_sync(ncid); 
     1042  int status; 
     1043  #pragma omp critical (_netcdf) 
     1044  { 
     1045    info(100)<<"start nc_sync"<<std::endl; 
     1046    status = nc_sync(ncid); 
     1047    info(100)<<"end nc_sync"<<std::endl; 
     1048  } 
    8551049  if (NC_NOERR != status) 
    8561050  { 
     
    8721066int CNetCdfInterface::ncGetAttType(int ncid, int varid, const char* attrName, double* data) 
    8731067{ 
    874   return nc_get_att_double(ncid, varid, attrName, data); 
     1068  int status; 
     1069  #pragma omp critical (_netcdf) 
     1070  { 
     1071    info(100)<<"start nc_get_att_double"<<std::endl; 
     1072    status = nc_get_att_double(ncid, varid, attrName, data); 
     1073    info(100)<<"end nc_get_att_double"<<std::endl; 
     1074  } 
     1075  return status; 
    8751076} 
    8761077 
     
    8781079int CNetCdfInterface::ncGetAttType(int ncid, int varid, const char* attrName, float* data) 
    8791080{ 
    880   return nc_get_att_float(ncid, varid, attrName, data); 
     1081  int status; 
     1082  #pragma omp critical (_netcdf) 
     1083  { 
     1084    info(100)<<"start nc_get_att_float"<<std::endl; 
     1085    status = nc_get_att_float(ncid, varid, attrName, data); 
     1086    info(100)<<"end nc_get_att_float"<<std::endl; 
     1087  } 
     1088  return status; 
    8811089} 
    8821090 
     
    8841092int CNetCdfInterface::ncGetAttType(int ncid, int varid, const char* attrName, int* data) 
    8851093{ 
    886   return nc_get_att_int(ncid, varid, attrName, data); 
     1094  int status; 
     1095  #pragma omp critical (_netcdf) 
     1096  { 
     1097    info(100)<<"start nc_get_att_int"<<std::endl; 
     1098    status = nc_get_att_int(ncid, varid, attrName, data); 
     1099    info(100)<<"end nc_get_att_int"<<std::endl; 
     1100  } 
     1101  return status;  
    8871102} 
    8881103 
     
    8901105int CNetCdfInterface::ncGetAttType(int ncid, int varid, const char* attrName, long* data) 
    8911106{ 
    892   return nc_get_att_long(ncid, varid, attrName, data); 
     1107  int status; 
     1108  #pragma omp critical (_netcdf) 
     1109  { 
     1110    info(100)<<"start nc_get_att_long"<<std::endl; 
     1111    status = nc_get_att_long(ncid, varid, attrName, data); 
     1112    info(100)<<"end nc_get_att_long"<<std::endl; 
     1113  } 
     1114  return status; 
    8931115} 
    8941116 
     
    8961118int CNetCdfInterface::ncGetAttType(int ncid, int varid, const char* attrName, short* data) 
    8971119{ 
    898   return nc_get_att_short(ncid, varid, attrName, data); 
     1120  int status; 
     1121  #pragma omp critical (_netcdf) 
     1122  { 
     1123    info(100)<<"start nc_get_att_short"<<std::endl; 
     1124    status = nc_get_att_short(ncid, varid, attrName, data); 
     1125    info(100)<<"end nc_get_att_short"<<std::endl; 
     1126  } 
     1127  return status; 
    8991128} 
    9001129 
     
    9021131int CNetCdfInterface::ncGetAttType(int ncid, int varid, const char* attrName, char* data) 
    9031132{ 
    904   return nc_get_att_text(ncid, varid, attrName, data); 
     1133  int status; 
     1134  #pragma omp critical (_netcdf) 
     1135  { 
     1136    info(100)<<"start nc_get_att_text"<<std::endl; 
     1137    status = nc_get_att_text(ncid, varid, attrName, data); 
     1138    info(100)<<"end nc_get_att_text"<<std::endl; 
     1139  } 
     1140  return status; 
    9051141} 
    9061142 
     
    9101146                                   StdSize numVal, const double* data) 
    9111147{ 
    912   return nc_put_att_double(ncid, varid, attrName, NC_DOUBLE, numVal, data); 
     1148  int status; 
     1149  #pragma omp critical (_netcdf) 
     1150  { 
     1151    info(100)<<"start nc_put_att_double"<<std::endl; 
     1152    status = nc_put_att_double(ncid, varid, attrName, NC_DOUBLE, numVal, data); 
     1153    info(100)<<"end nc_put_att_double"<<std::endl; 
     1154  } 
     1155  return status; 
    9131156} 
    9141157 
     
    9171160                                   StdSize numVal, const float* data) 
    9181161{ 
    919   return nc_put_att_float(ncid, varid, attrName, NC_FLOAT, numVal, data); 
     1162  int status; 
     1163  #pragma omp critical (_netcdf) 
     1164  { 
     1165    info(100)<<"start nc_put_att_float"<<std::endl; 
     1166    status = nc_put_att_float(ncid, varid, attrName, NC_FLOAT, numVal, data); 
     1167    info(100)<<"end nc_put_att_float"<<std::endl; 
     1168  } 
     1169  return status; 
    9201170} 
    9211171 
     
    9241174                                   StdSize numVal, const int* data) 
    9251175{ 
    926   return nc_put_att_int(ncid, varid, attrName, NC_INT, numVal, data); 
     1176  int status; 
     1177  #pragma omp critical (_netcdf) 
     1178  { 
     1179    info(100)<<"start nc_put_att_int"<<std::endl; 
     1180    status = nc_put_att_int(ncid, varid, attrName, NC_INT, numVal, data); 
     1181    info(100)<<"end nc_put_att_int"<<std::endl; 
     1182  } 
     1183  return status; 
    9271184} 
    9281185 
     
    9311188                                   StdSize numVal, const long* data) 
    9321189{ 
    933   return nc_put_att_long(ncid, varid, attrName, NC_LONG, numVal, data); 
     1190  int status; 
     1191  #pragma omp critical (_netcdf) 
     1192  { 
     1193    info(100)<<"start nc_put_att_long"<<std::endl; 
     1194    status = nc_put_att_long(ncid, varid, attrName, NC_LONG, numVal, data); 
     1195    info(100)<<"end nc_put_att_long"<<std::endl; 
     1196  } 
     1197  return status; 
    9341198} 
    9351199 
     
    9381202                                   StdSize numVal, const short* data) 
    9391203{ 
    940   return nc_put_att_short(ncid, varid, attrName, NC_SHORT, numVal, data); 
     1204  int status; 
     1205  #pragma omp critical (_netcdf) 
     1206  { 
     1207    info(100)<<"start nc_put_att_short"<<std::endl; 
     1208    status = nc_put_att_short(ncid, varid, attrName, NC_SHORT, numVal, data); 
     1209    info(100)<<"end nc_put_att_short"<<std::endl; 
     1210  } 
     1211  return status; 
    9411212} 
    9421213 
     
    9451216                                   StdSize numVal, const char* data) 
    9461217{ 
    947   return nc_put_att_text(ncid, varid, attrName, numVal, data); 
     1218  int status; 
     1219  #pragma omp critical (_netcdf) 
     1220  { 
     1221    info(100)<<"start nc_put_att_text"<<std::endl; 
     1222    status = nc_put_att_text(ncid, varid, attrName, numVal, data); 
     1223    info(100)<<"end nc_put_att_text"<<std::endl; 
     1224  } 
     1225  return status; 
    9481226} 
    9491227 
     
    9521230int CNetCdfInterface::ncGetVaraType(int ncid, int varid, const StdSize* start, const StdSize* count, double* data) 
    9531231{ 
    954   return nc_get_vara_double(ncid, varid, start, count, data); 
     1232  int status; 
     1233  #pragma omp critical (_netcdf) 
     1234  { 
     1235    info(100)<<"start nc_get_vara_double"<<std::endl; 
     1236    status = nc_get_vara_double(ncid, varid, start, count, data); 
     1237    info(100)<<"end nc_get_vara_double"<<std::endl; 
     1238  } 
     1239  return status; 
    9551240} 
    9561241 
     
    9581243int CNetCdfInterface::ncGetVaraType(int ncid, int varid, const StdSize* start, const StdSize* count, float* data) 
    9591244{ 
    960   return nc_get_vara_float(ncid, varid, start, count, data); 
     1245  int status; 
     1246  #pragma omp critical (_netcdf) 
     1247  { 
     1248    info(100)<<"start nc_get_vara_float"<<std::endl; 
     1249    status = nc_get_vara_float(ncid, varid, start, count, data); 
     1250    info(100)<<"end nc_get_vara_float"<<std::endl; 
     1251  } 
     1252  return status;  
    9611253} 
    9621254 
     
    9641256int CNetCdfInterface::ncGetVaraType(int ncid, int varid, const StdSize* start, const StdSize* count, int* data) 
    9651257{ 
    966   return nc_get_vara_int(ncid, varid, start, count, data); 
     1258  int status; 
     1259  #pragma omp critical (_netcdf) 
     1260  { 
     1261    info(100)<<"start nc_get_vara_int"<<std::endl; 
     1262    status = nc_get_vara_int(ncid, varid, start, count, data); 
     1263    info(100)<<"end nc_get_vara_int"<<std::endl; 
     1264  } 
     1265  return status;  
    9671266} 
    9681267 
     
    9701269int CNetCdfInterface::ncGetVaraType(int ncid, int varid, const StdSize* start, const StdSize* count, char* data) 
    9711270{ 
    972   return nc_get_vara_text(ncid, varid, start, count, data); 
     1271  int status; 
     1272  #pragma omp critical (_netcdf) 
     1273  { 
     1274    info(100)<<"start nc_get_vara_text"<<std::endl; 
     1275    status = nc_get_vara_text(ncid, varid, start, count, data); 
     1276    info(100)<<"end nc_get_vara_text"<<std::endl; 
     1277  } 
     1278  return status; 
    9731279} 
    9741280 
     
    9771283int CNetCdfInterface::ncPutVaraType(int ncid, int varid, const StdSize* start, const StdSize* count, const double* data) 
    9781284{ 
    979   return nc_put_vara_double(ncid, varid, start, count, data); 
     1285  int status; 
     1286  #pragma omp critical (_netcdf) 
     1287  { 
     1288    info(100)<<"start nc_put_vara_double"<<std::endl; 
     1289    status = nc_put_vara_double(ncid, varid, start, count, data); 
     1290    info(100)<<"end nc_put_vara_double"<<std::endl; 
     1291  } 
     1292  return status; 
    9801293} 
    9811294 
     
    9831296int CNetCdfInterface::ncPutVaraType(int ncid, int varid, const StdSize* start, const StdSize* count, const float* data) 
    9841297{ 
    985   return nc_put_vara_float(ncid, varid, start, count, data); 
     1298  int status; 
     1299  #pragma omp critical (_netcdf) 
     1300  { 
     1301    info(100)<<"start nc_put_vara_float"<<std::endl; 
     1302    status = nc_put_vara_float(ncid, varid, start, count, data); 
     1303    info(100)<<"end nc_put_vara_float"<<std::endl; 
     1304  } 
     1305  return status; 
    9861306} 
    9871307 
     
    9891309int CNetCdfInterface::ncPutVaraType(int ncid, int varid, const StdSize* start, const StdSize* count, const int* data) 
    9901310{ 
    991   return nc_put_vara_int(ncid, varid, start, count, data); 
     1311  int status; 
     1312  #pragma omp critical (_netcdf) 
     1313  { 
     1314    info(100)<<"start nc_put_vara_int"<<std::endl; 
     1315    status = nc_put_vara_int(ncid, varid, start, count, data); 
     1316    info(100)<<"end nc_put_vara_int"<<std::endl; 
     1317  } 
     1318  return status; 
    9921319} 
    9931320 
     
    9951322int CNetCdfInterface::ncPutVaraType(int ncid, int varid, const StdSize* start, const StdSize* count, const char* data) 
    9961323{ 
    997   return nc_put_vara_text(ncid, varid, start, count, data); 
     1324  int status; 
     1325  #pragma omp critical (_netcdf) 
     1326  { 
     1327    info(100)<<"start nc_put_vara_text"<<std::endl; 
     1328    status = nc_put_vara_text(ncid, varid, start, count, data); 
     1329    info(100)<<"end nc_put_vara_text"<<std::endl; 
     1330  } 
     1331  return status; 
    9981332} 
    9991333 
     
    10081342{ 
    10091343   int varId = 0; 
    1010    return (NC_NOERR == (nc_inq_varid(ncId, varName.c_str(), &varId))); 
     1344   int status; 
     1345   #pragma omp critical (_netcdf) 
     1346   { 
     1347     info(100)<<"start isVarExisted"<<std::endl; 
     1348     status = nc_inq_varid(ncId, varName.c_str(), &varId); 
     1349     info(100)<<"end isVarExisted"<<std::endl; 
     1350   } 
     1351   return (NC_NOERR == status); 
    10111352} 
    10121353 
     
    10141355{ 
    10151356   int dimId = 0; 
    1016    return (NC_NOERR == (nc_inq_dimid(ncId, dimName.c_str(), &dimId))); 
     1357   int status; 
     1358   #pragma omp critical (_netcdf) 
     1359   { 
     1360     info(100)<<"start isDimExisted"<<std::endl; 
     1361     status = nc_inq_dimid(ncId, dimName.c_str(), &dimId); 
     1362     info(100)<<"end isDimExisted"<<std::endl; 
     1363   } 
     1364   return (NC_NOERR == status); 
    10171365} 
    10181366 
  • XIOS/dev/dev_trunk_omp/src/io/netCdfInterface.hpp

    r811 r1601  
    1010#define __NETCDF_INTERFACE_HPP_ 
    1111 
     12#include "mpi_std.hpp" 
    1213#include "xios_spl.hpp" 
    1314 
     
    1617#endif 
    1718 
    18 #include "mpi.hpp" 
     19 
    1920#include "netcdf.hpp" 
    2021 
  • XIOS/dev/dev_trunk_omp/src/io/netcdf.hpp

    r685 r1601  
    11#ifndef __XIOS_NETCDF_HPP__ 
    22#define __XIOS_NETCDF_HPP__ 
    3 #include "mpi.hpp" 
     3#include "mpi_std.hpp" 
    44#define MPI_INCLUDED 
    55#include <netcdf.h> 
     
    3333  { 
    3434#if defined(USING_NETCDF_PAR) 
    35     return ::nc_create_par(path, cmode, comm, info, ncidp) ; 
     35    int status; 
     36    #pragma omp critical (_netcdf) 
     37    { 
     38      status = ::nc_create_par(path, cmode, comm, info, ncidp) ; 
     39    } 
     40    return status; 
    3641#else 
    3742    ERROR("int nc_create_par(const char *path, int cmode, MPI_Comm comm, MPI_Info info,int *ncidp)", 
     
    4449  { 
    4550#if defined(USING_NETCDF_PAR) 
    46     return ::nc_open_par(path, mode, comm, info, ncidp) ; 
     51    int status; 
     52    #pragma omp critical (_netcdf) 
     53    { 
     54      status = ::nc_open_par(path, mode, comm, info, ncidp) ; 
     55    } 
     56    return status; 
    4757#else 
    4858    ERROR("int nc_open_par(const char *path, int mode, MPI_Comm comm, MPI_Info info,int *ncidp)", 
     
    5565  { 
    5666#if defined(USING_NETCDF_PAR) 
    57     return ::nc_var_par_access(ncid, varid, par_access) ; 
     67    int status = ::nc_var_par_access(ncid, varid, par_access) ; 
     68     
     69    return status; 
    5870#else 
    5971    ERROR("int nc_var_par_access(int ncid, int varid, int par_access)", 
  • XIOS/dev/dev_trunk_omp/src/io/onetcdf4.cpp

    r1456 r1601  
    33#include "onetcdf4.hpp" 
    44#include "group_template.hpp" 
    5 #include "mpi.hpp" 
     5#include "ep_mpi.hpp" 
    66#include "netcdf.hpp" 
    77#include "netCdfInterface.hpp" 
     
    1515      CONetCDF4::CONetCDF4(const StdString& filename, bool append, bool useClassicFormat, 
    1616                                                        bool useCFConvention, 
    17                            const MPI_Comm* comm, bool multifile, const StdString& timeCounterName) 
     17                           const ep_lib::MPI_Comm* comm, bool multifile, const StdString& timeCounterName) 
    1818        : path() 
    1919        , wmpi(false) 
     
    3333 
    3434      void CONetCDF4::initialize(const StdString& filename, bool append, bool useClassicFormat, bool useCFConvention,  
    35                                  const MPI_Comm* comm, bool multifile, const StdString& timeCounterName) 
     35                                 const ep_lib::MPI_Comm* comm, bool multifile, const StdString& timeCounterName) 
    3636      { 
    3737         this->useClassicFormat = useClassicFormat; 
     
    4444         { 
    4545            int commSize = 0; 
    46             MPI_Comm_size(*comm, &commSize); 
     46            ep_lib::MPI_Comm_size(*comm, &commSize); 
    4747            if (commSize <= 1) 
    4848               comm = NULL; 
     
    5858            CTimer::get("Files : create").resume(); 
    5959            if (wmpi) 
    60                CNetCdfInterface::createPar(filename, mode, *comm, MPI_INFO_NULL, this->ncidp); 
     60               CNetCdfInterface::createPar(filename, mode, to_mpi_comm((*comm)->mpi_comm), to_mpi_info(MPI_INFO_NULL), this->ncidp); 
    6161            else 
    6262               CNetCdfInterface::create(filename, mode, this->ncidp); 
     
    7070            CTimer::get("Files : open").resume(); 
    7171            if (wmpi) 
    72                CNetCdfInterface::openPar(filename, mode, *comm, MPI_INFO_NULL, this->ncidp); 
     72               CNetCdfInterface::openPar(filename, mode, to_mpi_comm((*comm)->mpi_comm), to_mpi_info(MPI_INFO_NULL), this->ncidp); 
    7373            else 
    7474               CNetCdfInterface::open(filename, mode, this->ncidp); 
  • XIOS/dev/dev_trunk_omp/src/io/onetcdf4.hpp

    r1456 r1601  
    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.hpp" 
    1010#include "netcdf.hpp" 
    1111 
     
    2828            CONetCDF4(const StdString& filename, bool append, bool useClassicFormat = false, 
    2929                          bool useCFConvention = true, 
    30                       const MPI_Comm* comm = NULL, bool multifile = true, 
     30                      const ep_lib::MPI_Comm* comm = NULL, bool multifile = true, 
    3131                      const StdString& timeCounterName = "time_counter"); 
    3232 
     
    3737            /// Initialisation /// 
    3838            void initialize(const StdString& filename, bool append, bool useClassicFormat, bool useCFConvention, 
    39                             const MPI_Comm* comm, bool multifile, const StdString& timeCounterName); 
     39                            const ep_lib::MPI_Comm* comm, bool multifile, const StdString& timeCounterName); 
    4040            void close(void); 
    4141            void sync(void); 
Note: See TracChangeset for help on using the changeset viewer.