Changeset 1601 for XIOS/dev/dev_trunk_omp/src/io
- Timestamp:
- 11/19/18 15:52:54 (6 years ago)
- 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 2 2 #include "netCdfInterface.hpp" 3 3 #include "netCdf_cf_constant.hpp" 4 4 #include "ep_mpi.hpp" 5 5 #include <boost/algorithm/string.hpp> 6 6 7 7 namespace xios 8 8 { 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*/, 10 10 bool readMetaDataPar /*= false*/, const StdString& timeCounterName /*= "time_counter"*/) 11 11 { … … 14 14 { 15 15 int commSize = 0; 16 MPI_Comm_size(*comm, &commSize);16 ep_lib::MPI_Comm_size(*comm, &commSize); 17 17 if (commSize <= 1) 18 18 comm = NULL; … … 23 23 // even if Parallel NetCDF ends up being used. 24 24 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); 26 26 else 27 27 CNetCdfInterface::open(filename, NC_NOWRITE, this->ncidp); -
XIOS/dev/dev_trunk_omp/src/io/inetcdf4.hpp
r1485 r1601 7 7 #include "array_new.hpp" 8 8 9 #include "mpi .hpp"9 #include "mpi_std.hpp" 10 10 #include "netcdf.hpp" 11 11 … … 22 22 public: 23 23 /// 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, 25 25 bool readMetaDataPar = false, const StdString& timeCounterName = "time_counter"); 26 26 -
XIOS/dev/dev_trunk_omp/src/io/nc4_data_input.cpp
r1582 r1601 10 10 namespace xios 11 11 { 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*/, 13 13 bool readMetaDataPar /*= false*/, bool ugridConvention /*= false*/, const StdString& timeCounterName /*= "time_counter"*/) 14 14 : SuperClass() … … 55 55 CArray<double,1> fieldData(grid->getWrittenDataSize()); 56 56 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 58 62 switch (SuperClass::type) 59 63 { -
XIOS/dev/dev_trunk_omp/src/io/nc4_data_input.hpp
r1486 r1601 3 3 4 4 /// XIOS headers /// 5 #include "mpi_std.hpp" 5 6 #include "xios_spl.hpp" 6 7 #include "data_input.hpp" … … 23 24 24 25 /// 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, 26 27 bool readMetaDataPar = false, bool ugridConvention = false, const StdString& timeCounterName = "time_counter"); 27 28 CNc4DataInput(const CNc4DataInput& dataInput); // Not implemented. … … 70 71 private: 71 72 /// Private attributes /// 72 MPI_Comm comm_file;73 ep_lib::MPI_Comm comm_file; 73 74 const StdString filename; 74 75 bool isCollective; -
XIOS/dev/dev_trunk_omp/src/io/nc4_data_output.cpp
r1559 r1601 28 28 CNc4DataOutput::CNc4DataOutput 29 29 (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) 31 31 : SuperClass() 32 32 , SuperClassWriter(filename, exist, useClassicFormat, useCFConvention, &comm_file, multifile, timeCounterName) -
XIOS/dev/dev_trunk_omp/src/io/nc4_data_output.hpp
r1542 r1601 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" … … 27 28 (CFile* file, const StdString & filename, bool exist, bool useClassicFormat, 28 29 bool useCFConvention, 29 MPI_Comm comm_file, bool multifile, bool isCollective = true,30 ep_lib::MPI_Comm comm_file, bool multifile, bool isCollective = true, 30 31 const StdString& timeCounterName = "time_counter"); 31 32 … … 117 118 118 119 /// Propriétés privées /// 119 MPI_Comm comm_file;120 ep_lib::MPI_Comm comm_file; 120 121 const StdString filename; 121 122 std::map<Time, StdSize> timeToRecordCache; -
XIOS/dev/dev_trunk_omp/src/io/netCdfInterface.cpp
r1454 r1601 10 10 #include "netCdfInterface.hpp" 11 11 #include "netCdfException.hpp" 12 12 #include "ep_mpi.hpp" 13 13 namespace xios 14 14 { … … 22 22 int CNetCdfInterface::create(const StdString& fileName, int cMode, int& ncId) 23 23 { 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 } 25 31 if (NC_NOERR != status) 26 32 { … … 49 55 int CNetCdfInterface::createPar(const StdString& fileName, int cMode, MPI_Comm comm, MPI_Info info, int& ncId) 50 56 { 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 52 59 if (NC_NOERR != status) 53 60 { … … 74 81 int CNetCdfInterface::open(const StdString& fileName, int oMode, int& ncId) 75 82 { 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 } 77 90 if (NC_NOERR != status) 78 91 { … … 102 115 int CNetCdfInterface::openPar(const StdString& fileName, int oMode, MPI_Comm comm, MPI_Info info, int& ncId) 103 116 { 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 105 119 if (NC_NOERR != status) 106 120 { … … 125 139 int CNetCdfInterface::close(int ncId) 126 140 { 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 128 149 if (NC_NOERR != status) 129 150 { … … 147 168 int CNetCdfInterface::reDef(int ncId) 148 169 { 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 150 178 if (NC_NOERR != status) 151 179 { … … 169 197 int CNetCdfInterface::endDef(int ncId) 170 198 { 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 } 172 206 if (NC_NOERR != status) 173 207 { … … 194 228 int CNetCdfInterface::inqNcId(int ncid, const StdString& grpName, int& grpId) 195 229 { 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 197 238 if (NC_NOERR != status) 198 239 { … … 220 261 int CNetCdfInterface::inqVarId(int ncid, const StdString& varName, int& varId) 221 262 { 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 } 223 270 if (NC_NOERR != status) 224 271 { … … 245 292 int CNetCdfInterface::inqDimId(int ncid, const StdString& dimName, int& dimId) 246 293 { 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 248 302 if (NC_NOERR != status) 249 303 { … … 271 325 { 272 326 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 } 274 334 if (NC_NOERR != status) 275 335 { … … 295 355 int CNetCdfInterface::inqUnLimDim(int ncid, int& dimId) 296 356 { 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 } 298 364 if (NC_NOERR != status) 299 365 { … … 321 387 { 322 388 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 } 324 396 if (NC_NOERR != status) 325 397 { … … 346 418 int CNetCdfInterface::inqDimLen(int ncid, int dimId, StdSize& dimLen) 347 419 { 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 } 349 427 if (NC_NOERR != status) 350 428 { … … 371 449 int CNetCdfInterface::inqVarNDims(int ncid, int varId, int& nDims) 372 450 { 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 } 374 458 if (NC_NOERR != status) 375 459 { … … 396 480 int CNetCdfInterface::inqVarDimId(int ncid, int varId, int* dimIds) 397 481 { 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 } 399 489 if (NC_NOERR != status) 400 490 { … … 422 512 int CNetCdfInterface::inqDimIds(int ncid, int& nDims, int* dimIds, int includeParents) 423 513 { 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 } 425 521 if (NC_NOERR != status) 426 522 { … … 449 545 StdSize strlen = 0; 450 546 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 } 458 561 if (NC_NOERR != status) 459 562 { … … 482 585 int CNetCdfInterface::inqGrpIds(int ncid, int& numgrps, int* ncids) 483 586 { 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 } 485 594 if (NC_NOERR != status) 486 595 { … … 507 616 int CNetCdfInterface::inqVarIds(int ncid, int& nvars, int* varids) 508 617 { 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 } 510 625 if (NC_NOERR != status) 511 626 { … … 534 649 int CNetCdfInterface::inqAtt(int ncid, int varid, const StdString& name, nc_type& type, size_t& len) 535 650 { 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 537 659 if (NC_NOERR != status) 538 660 { … … 558 680 int CNetCdfInterface::inqNAtts(int ncid, int& ngatts) 559 681 { 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 } 561 689 if (NC_NOERR != status) 562 690 { … … 583 711 int CNetCdfInterface::inqVarNAtts(int ncid, int varid, int& natts) 584 712 { 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 } 586 720 if (NC_NOERR != status) 587 721 { … … 604 738 { 605 739 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 } 607 747 if (NC_NOERR != status) 608 748 { … … 635 775 int CNetCdfInterface::defGrp(int parentNcid, const StdString& grpName, int& grpId) 636 776 { 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 } 638 784 if (NC_NOERR != status) 639 785 { … … 660 806 int CNetCdfInterface::defDim(int ncid, const StdString& dimName, StdSize dimLen, int& dimId) 661 807 { 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 } 663 815 if (NC_NOERR != status) 664 816 { … … 691 843 int nDims, const int dimIds[], int& varId) 692 844 { 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 } 694 852 if (NC_NOERR != status) 695 853 { … … 720 878 int CNetCdfInterface::defVarChunking(int ncid, int varId, int storage, StdSize chunkSize[]) 721 879 { 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 } 723 887 if (NC_NOERR != status) 724 888 { … … 748 912 749 913 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 } 751 921 if (NC_NOERR != status) 752 922 { … … 774 944 { 775 945 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 } 777 953 if (NC_NOERR != status) 778 954 { … … 801 977 int CNetCdfInterface::defVarFill(int ncid, int varId, int noFill, void* fillValue) 802 978 { 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 } 804 986 if (NC_NOERR != status) 805 987 { … … 829 1011 int CNetCdfInterface::varParAccess(int ncid, int varId, int access) 830 1012 { 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 } 832 1020 if (NC_NOERR != status) 833 1021 { … … 852 1040 int CNetCdfInterface::sync(int ncid) 853 1041 { 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 } 855 1049 if (NC_NOERR != status) 856 1050 { … … 872 1066 int CNetCdfInterface::ncGetAttType(int ncid, int varid, const char* attrName, double* data) 873 1067 { 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; 875 1076 } 876 1077 … … 878 1079 int CNetCdfInterface::ncGetAttType(int ncid, int varid, const char* attrName, float* data) 879 1080 { 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; 881 1089 } 882 1090 … … 884 1092 int CNetCdfInterface::ncGetAttType(int ncid, int varid, const char* attrName, int* data) 885 1093 { 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; 887 1102 } 888 1103 … … 890 1105 int CNetCdfInterface::ncGetAttType(int ncid, int varid, const char* attrName, long* data) 891 1106 { 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; 893 1115 } 894 1116 … … 896 1118 int CNetCdfInterface::ncGetAttType(int ncid, int varid, const char* attrName, short* data) 897 1119 { 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; 899 1128 } 900 1129 … … 902 1131 int CNetCdfInterface::ncGetAttType(int ncid, int varid, const char* attrName, char* data) 903 1132 { 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; 905 1141 } 906 1142 … … 910 1146 StdSize numVal, const double* data) 911 1147 { 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; 913 1156 } 914 1157 … … 917 1160 StdSize numVal, const float* data) 918 1161 { 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; 920 1170 } 921 1171 … … 924 1174 StdSize numVal, const int* data) 925 1175 { 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; 927 1184 } 928 1185 … … 931 1188 StdSize numVal, const long* data) 932 1189 { 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; 934 1198 } 935 1199 … … 938 1202 StdSize numVal, const short* data) 939 1203 { 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; 941 1212 } 942 1213 … … 945 1216 StdSize numVal, const char* data) 946 1217 { 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; 948 1226 } 949 1227 … … 952 1230 int CNetCdfInterface::ncGetVaraType(int ncid, int varid, const StdSize* start, const StdSize* count, double* data) 953 1231 { 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; 955 1240 } 956 1241 … … 958 1243 int CNetCdfInterface::ncGetVaraType(int ncid, int varid, const StdSize* start, const StdSize* count, float* data) 959 1244 { 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; 961 1253 } 962 1254 … … 964 1256 int CNetCdfInterface::ncGetVaraType(int ncid, int varid, const StdSize* start, const StdSize* count, int* data) 965 1257 { 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; 967 1266 } 968 1267 … … 970 1269 int CNetCdfInterface::ncGetVaraType(int ncid, int varid, const StdSize* start, const StdSize* count, char* data) 971 1270 { 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; 973 1279 } 974 1280 … … 977 1283 int CNetCdfInterface::ncPutVaraType(int ncid, int varid, const StdSize* start, const StdSize* count, const double* data) 978 1284 { 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; 980 1293 } 981 1294 … … 983 1296 int CNetCdfInterface::ncPutVaraType(int ncid, int varid, const StdSize* start, const StdSize* count, const float* data) 984 1297 { 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; 986 1306 } 987 1307 … … 989 1309 int CNetCdfInterface::ncPutVaraType(int ncid, int varid, const StdSize* start, const StdSize* count, const int* data) 990 1310 { 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; 992 1319 } 993 1320 … … 995 1322 int CNetCdfInterface::ncPutVaraType(int ncid, int varid, const StdSize* start, const StdSize* count, const char* data) 996 1323 { 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; 998 1332 } 999 1333 … … 1008 1342 { 1009 1343 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); 1011 1352 } 1012 1353 … … 1014 1355 { 1015 1356 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); 1017 1365 } 1018 1366 -
XIOS/dev/dev_trunk_omp/src/io/netCdfInterface.hpp
r811 r1601 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.hpp" 19 19 20 #include "netcdf.hpp" 20 21 -
XIOS/dev/dev_trunk_omp/src/io/netcdf.hpp
r685 r1601 1 1 #ifndef __XIOS_NETCDF_HPP__ 2 2 #define __XIOS_NETCDF_HPP__ 3 #include "mpi .hpp"3 #include "mpi_std.hpp" 4 4 #define MPI_INCLUDED 5 5 #include <netcdf.h> … … 33 33 { 34 34 #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; 36 41 #else 37 42 ERROR("int nc_create_par(const char *path, int cmode, MPI_Comm comm, MPI_Info info,int *ncidp)", … … 44 49 { 45 50 #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; 47 57 #else 48 58 ERROR("int nc_open_par(const char *path, int mode, MPI_Comm comm, MPI_Info info,int *ncidp)", … … 55 65 { 56 66 #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; 58 70 #else 59 71 ERROR("int nc_var_par_access(int ncid, int varid, int par_access)", -
XIOS/dev/dev_trunk_omp/src/io/onetcdf4.cpp
r1456 r1601 3 3 #include "onetcdf4.hpp" 4 4 #include "group_template.hpp" 5 #include " mpi.hpp"5 #include "ep_mpi.hpp" 6 6 #include "netcdf.hpp" 7 7 #include "netCdfInterface.hpp" … … 15 15 CONetCDF4::CONetCDF4(const StdString& filename, bool append, bool useClassicFormat, 16 16 bool useCFConvention, 17 const MPI_Comm* comm, bool multifile, const StdString& timeCounterName)17 const ep_lib::MPI_Comm* comm, bool multifile, const StdString& timeCounterName) 18 18 : path() 19 19 , wmpi(false) … … 33 33 34 34 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) 36 36 { 37 37 this->useClassicFormat = useClassicFormat; … … 44 44 { 45 45 int commSize = 0; 46 MPI_Comm_size(*comm, &commSize);46 ep_lib::MPI_Comm_size(*comm, &commSize); 47 47 if (commSize <= 1) 48 48 comm = NULL; … … 58 58 CTimer::get("Files : create").resume(); 59 59 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); 61 61 else 62 62 CNetCdfInterface::create(filename, mode, this->ncidp); … … 70 70 CTimer::get("Files : open").resume(); 71 71 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); 73 73 else 74 74 CNetCdfInterface::open(filename, mode, this->ncidp); -
XIOS/dev/dev_trunk_omp/src/io/onetcdf4.hpp
r1456 r1601 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.hpp"10 10 #include "netcdf.hpp" 11 11 … … 28 28 CONetCDF4(const StdString& filename, bool append, bool useClassicFormat = false, 29 29 bool useCFConvention = true, 30 const MPI_Comm* comm = NULL, bool multifile = true,30 const ep_lib::MPI_Comm* comm = NULL, bool multifile = true, 31 31 const StdString& timeCounterName = "time_counter"); 32 32 … … 37 37 /// Initialisation /// 38 38 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); 40 40 void close(void); 41 41 void sync(void);
Note: See TracChangeset
for help on using the changeset viewer.