Changeset 1328 for XIOS/dev/branch_openmp/src/io
- Timestamp:
- 11/15/17 12:14:34 (6 years ago)
- Location:
- XIOS/dev/branch_openmp/src/io
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_openmp/src/io/inetcdf4.cpp
r1287 r1328 4 4 5 5 #include <boost/algorithm/string.hpp> 6 // mpi_std.hpp7 #ifdef _usingEP8 #include "ep_declaration.hpp"9 #endif10 6 11 7 namespace xios 12 8 { 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"*/) 14 10 { 15 11 // Don't use parallel mode if there is only one process … … 17 13 { 18 14 int commSize = 0; 19 MPI_Comm_size(*comm, &commSize);15 ep_lib::MPI_Comm_size(*comm, &commSize); 20 16 if (commSize <= 1) 21 17 comm = NULL; 22 18 } 23 24 19 mpi = comm && !multifile; 25 MPI_Info m_info = MPI_INFO_NULL.mpi_info;20 ep_lib::MPI_Info info_null; 26 21 27 22 // The file format will be detected automatically by NetCDF, it is safe to always set NC_MPIIO 28 23 // even if Parallel NetCDF ends up being used. 29 24 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); 31 27 else 32 28 CNetCdfInterface::open(filename, NC_NOWRITE, this->ncidp); -
XIOS/dev/branch_openmp/src/io/inetcdf4.hpp
r1138 r1328 14 14 #endif // UNLIMITED_DIM 15 15 16 17 16 namespace xios 18 17 { … … 23 22 public: 24 23 /// 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, 26 25 const StdString& timeCounterName = "time_counter"); 27 26 CINetCDF4(const CINetCDF4& inetcdf4); // Not implemented. -
XIOS/dev/branch_openmp/src/io/inetcdf4_decl.cpp
r1138 r1328 1 1 #include "inetcdf4_impl.hpp" 2 // mpi_std.hpp3 2 4 3 namespace xios -
XIOS/dev/branch_openmp/src/io/inetcdf4_impl.hpp
r1138 r1328 4 4 #include "inetcdf4.hpp" 5 5 #include "netCdfInterface.hpp" 6 // mpi_std.hpp7 6 8 7 namespace xios -
XIOS/dev/branch_openmp/src/io/nc4_data_input.cpp
r1176 r1328 8 8 #include "scalar.hpp" 9 9 10 // mpi.hpp11 12 10 namespace xios 13 11 { 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"*/) 15 13 : SuperClass() 16 14 , SuperClassWriter(filename, &comm_file, multifile, timeCounterName) … … 55 53 CArray<double,1> fieldData(grid->getWrittenDataSize()); 56 54 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 61 56 switch (SuperClass::type) 62 57 { … … 326 321 std::vector<StdSize> nBeginBndsLatLon(3), nSizeBndsLatLon(3); 327 322 nBeginBndsLatLon[0] = 0; nSizeBndsLatLon[0] = domain->nj_glo.getValue(); 328 nBeginBndsLatLon[1] = 0; nSizeBndsLatLon[1] = domain->n j_glo.getValue();323 nBeginBndsLatLon[1] = 0; nSizeBndsLatLon[1] = domain->ni_glo.getValue(); 329 324 nBeginBndsLatLon[2] = 0; nSizeBndsLatLon[2] = nbVertex; 330 325 -
XIOS/dev/branch_openmp/src/io/nc4_data_input.hpp
r1138 r1328 3 3 4 4 /// XIOS headers /// 5 #include "mpi_std.hpp" 5 6 #include "xios_spl.hpp" 6 7 #include "data_input.hpp" 7 8 #include "inetcdf4.hpp" 8 // mpi_std.hpp9 9 10 10 namespace xios … … 24 24 25 25 /// 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, 27 27 const StdString& timeCounterName = "time_counter"); 28 28 CNc4DataInput(const CNc4DataInput& dataInput); // Not implemented. … … 71 71 private: 72 72 /// Private attributes /// 73 MPI_Comm comm_file;73 ep_lib::MPI_Comm comm_file; 74 74 const StdString filename; 75 75 bool isCollective; -
XIOS/dev/branch_openmp/src/io/nc4_data_output.cpp
r1205 r1328 13 13 #include "timer.hpp" 14 14 #include "uuid.hpp" 15 // mpi.hpp16 17 15 namespace xios 18 16 { … … 30 28 CNc4DataOutput::CNc4DataOutput 31 29 (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) 33 31 : SuperClass() 34 32 , SuperClassWriter(filename, exist, useClassicFormat, useCFConvention, &comm_file, multifile, timeCounterName) … … 465 463 StdString domainName = domain->name; 466 464 domain->assignMesh(domainName, domain->nvertex); 467 domain->mesh->createMeshEpsilon(s tatic_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); 468 466 469 467 StdString node_x = domainName + "_node_x"; -
XIOS/dev/branch_openmp/src/io/nc4_data_output.hpp
r1138 r1328 4 4 /// XIOS headers /// 5 5 #include "xios_spl.hpp" 6 #include "mpi_std.hpp" 6 7 #include "onetcdf4.hpp" 7 8 #include "data_output.hpp" 8 // mpi_std.hpp9 9 10 10 namespace xios … … 27 27 CNc4DataOutput 28 28 (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"); 31 32 32 33 CNc4DataOutput(const CNc4DataOutput & dataoutput); // Not implemented. … … 116 117 117 118 /// Propriétés privées /// 118 MPI_Comm comm_file;119 ep_lib::MPI_Comm comm_file; 119 120 const StdString filename; 120 121 std::map<Time, StdSize> timeToRecordCache; -
XIOS/dev/branch_openmp/src/io/netCdfInterface.cpp
r1153 r1328 10 10 #include "netCdfInterface.hpp" 11 11 #include "netCdfException.hpp" 12 // mpi_std.hpp13 12 14 13 namespace xios … … 50 49 int CNetCdfInterface::createPar(const StdString& fileName, int cMode, MPI_Comm comm, MPI_Info info, int& ncId) 51 50 { 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); 53 52 if (NC_NOERR != status) 54 53 { … … 75 74 int CNetCdfInterface::open(const StdString& fileName, int oMode, int& ncId) 76 75 { 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); 81 77 if (NC_NOERR != status) 82 78 { … … 106 102 int CNetCdfInterface::openPar(const StdString& fileName, int oMode, MPI_Comm comm, MPI_Info info, int& ncId) 107 103 { 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); 111 106 if (NC_NOERR != status) 112 107 { … … 131 126 int CNetCdfInterface::close(int ncId) 132 127 { 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); 138 129 if (NC_NOERR != status) 139 130 { … … 146 137 throw CNetCdfException(e); 147 138 } 148 } 139 149 140 return status; 150 141 } … … 356 347 int CNetCdfInterface::inqDimLen(int ncid, int dimId, StdSize& dimLen) 357 348 { 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); 361 350 if (NC_NOERR != status) 362 351 { -
XIOS/dev/branch_openmp/src/io/netCdfInterface.hpp
r1134 r1328 10 10 #define __NETCDF_INTERFACE_HPP_ 11 11 12 #include "mpi_std.hpp" 12 13 #include "xios_spl.hpp" 13 14 … … 16 17 #endif 17 18 18 #include "mpi_std.hpp"19 19 #include "netcdf.hpp" 20 20 -
XIOS/dev/branch_openmp/src/io/netCdfInterface_decl.cpp
r1138 r1328 9 9 10 10 #include "netCdfInterface_impl.hpp" 11 // mpi_std.hpp12 11 13 12 namespace xios -
XIOS/dev/branch_openmp/src/io/netCdfInterface_impl.hpp
r1146 r1328 13 13 #include "netCdfInterface.hpp" 14 14 #include "netCdfException.hpp" 15 // mpi_std.hpp16 15 17 16 namespace xios … … 86 85 int CNetCdfInterface::getVaraType(int ncid, int varId, const StdSize* start, const StdSize* count, T* data) 87 86 { 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); 91 88 if (NC_NOERR != status) 92 89 { -
XIOS/dev/branch_openmp/src/io/netCdf_cf_constant.hpp
r1138 r1328 4 4 #include "inetcdf4.hpp" 5 5 #include "netCdfInterface.hpp" 6 7 // mpi_std.hpp8 6 9 7 namespace xios -
XIOS/dev/branch_openmp/src/io/netcdf.hpp
r1138 r1328 18 18 extern "C" 19 19 { 20 #include <netcdf_par.h>20 # include <netcdf_par.h> 21 21 } 22 22 # endif -
XIOS/dev/branch_openmp/src/io/onetcdf4.cpp
r1287 r1328 12 12 /// ////////////////////// Définitions ////////////////////// /// 13 13 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) 16 17 : path() 17 18 , wmpi(false) … … 31 32 32 33 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) 34 35 { 35 36 this->useClassicFormat = useClassicFormat; … … 42 43 { 43 44 int commSize = 0; 44 MPI_Comm_size(*comm, &commSize);45 ep_lib::MPI_Comm_size(*comm, &commSize); 45 46 if (commSize <= 1) 46 47 comm = NULL; 47 48 } 48 49 wmpi = comm && !multifile; 50 ep_lib::MPI_Info info_null; 49 51 50 52 if (wmpi) … … 56 58 CTimer::get("Files : create").resume(); 57 59 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); 59 61 else 60 62 CNetCdfInterface::create(filename, mode, this->ncidp); … … 68 70 CTimer::get("Files : open").resume(); 69 71 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); 71 73 else 72 74 CNetCdfInterface::open(filename, mode, this->ncidp); … … 539 541 const std::vector<StdSize>& scount, const int* data) 540 542 { 541 CNetCdfInterface::putVaraType(grpid, varid, &sstart[0], &scount[0], data); 542 } 543 543 CNetCdfInterface::putVaraType(grpid, varid, &sstart[0], &scount[0], data); 544 } 544 545 //--------------------------------------------------------------- 545 546 … … 549 550 const std::vector<StdSize>& scount, const float* data) 550 551 { 551 CNetCdfInterface::putVaraType(grpid, varid, &sstart[0], &scount[0], data);552 CNetCdfInterface::putVaraType(grpid, varid, &sstart[0], &scount[0], data); 552 553 } 553 554 -
XIOS/dev/branch_openmp/src/io/onetcdf4.hpp
r1205 r1328 4 4 /// XIOS headers /// 5 5 #include "xios_spl.hpp" 6 #include "mpi_std.hpp" 6 7 #include "exception.hpp" 7 8 #include "data_output.hpp" 8 9 #include "array_new.hpp" 9 #include "mpi_std.hpp"10 10 #include "netcdf.hpp" 11 11 … … 13 13 #define UNLIMITED_DIM (size_t)(-1) 14 14 #endif //UNLIMITED_DIM 15 16 // mpi_std.hpp17 15 18 16 namespace xios … … 30 28 CONetCDF4(const StdString& filename, bool append, bool useClassicFormat = false, 31 29 bool useCFConvention = true, 32 const MPI_Comm* comm = NULL, bool multifile = true,30 const ep_lib::MPI_Comm* comm = NULL, bool multifile = true, 33 31 const StdString& timeCounterName = "time_counter"); 34 32 … … 39 37 /// Initialisation /// 40 38 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); 42 40 void close(void); 43 41 void sync(void); -
XIOS/dev/branch_openmp/src/io/onetcdf4_decl.cpp
r1138 r1328 1 1 #include "onetcdf4_impl.hpp" 2 // mpi_std.hpp3 2 4 3 namespace xios -
XIOS/dev/branch_openmp/src/io/onetcdf4_impl.hpp
r1205 r1328 5 5 #include "netCdfInterface.hpp" 6 6 #include "timer.hpp" 7 // mpi_std.hpp8 7 9 8 namespace xios
Note: See TracChangeset
for help on using the changeset viewer.