From 6f026ffca479c83631eb53fba56782b98a479df8 Mon Sep 17 00:00:00 2001 From: Scott Wittenburg Date: Tue, 1 Aug 2023 17:12:01 -0600 Subject: [PATCH 1/8] ci: Add HDF5 to a windows build --- scripts/ci/cmake/ci-win2022-vs2022-ompi.cmake | 3 +++ .../ci/cmake/ci-win2022-vs2022-serial.cmake | 3 +++ scripts/ci/gh-actions/windows-setup.ps1 | 24 +++++++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/scripts/ci/cmake/ci-win2022-vs2022-ompi.cmake b/scripts/ci/cmake/ci-win2022-vs2022-ompi.cmake index f51d9c438a..321d1d6cae 100644 --- a/scripts/ci/cmake/ci-win2022-vs2022-ompi.cmake +++ b/scripts/ci/cmake/ci-win2022-vs2022-ompi.cmake @@ -6,6 +6,9 @@ set(ENV{CXXFLAGS} /WX) set(dashboard_cache " ADIOS2_USE_Fortran:BOOL=OFF ADIOS2_USE_MPI:BOOL=ON +ADIOS2_USE_HDF5:STRING=ON +ADIOS2_USE_HDF5_VOL:STRING=OFF +HDF5_DIR:PATH=C:/hdf5/HDF5-1.14.2.1-win64/cmake ") set(CTEST_CMAKE_GENERATOR "Visual Studio 17 2022") diff --git a/scripts/ci/cmake/ci-win2022-vs2022-serial.cmake b/scripts/ci/cmake/ci-win2022-vs2022-serial.cmake index f3b7347e7c..a078f1ee58 100644 --- a/scripts/ci/cmake/ci-win2022-vs2022-serial.cmake +++ b/scripts/ci/cmake/ci-win2022-vs2022-serial.cmake @@ -6,6 +6,9 @@ set(ENV{CXXFLAGS} /WX) set(dashboard_cache " ADIOS2_USE_Fortran:BOOL=OFF ADIOS2_USE_MPI:BOOL=OFF +ADIOS2_USE_HDF5:STRING=ON +ADIOS2_USE_HDF5_VOL:STRING=OFF +HDF5_DIR:PATH=C:/hdf5/HDF5-1.14.2.1-win64/cmake ") set(CTEST_CMAKE_GENERATOR "Visual Studio 17 2022") diff --git a/scripts/ci/gh-actions/windows-setup.ps1 b/scripts/ci/gh-actions/windows-setup.ps1 index 4334327a2b..4bcae1d35a 100644 --- a/scripts/ci/gh-actions/windows-setup.ps1 +++ b/scripts/ci/gh-actions/windows-setup.ps1 @@ -56,3 +56,27 @@ if($Env:GH_YML_MATRIX_PARALLEL -eq "ompi") Write-Host "::endgroup::" } +if ($Env:GH_YML_MATRIX_COMPILER -eq "vs2022") +{ + $url = "https://github.com/HDFGroup/hdf5/releases/download/hdf5-1_14_1-2/hdf5-1_14_1-2-win_vs2022.zip" + + $tempdir = $Env:RUNNER_TEMP + $hdf5Zip = Join-Path $tempdir hdf5-1_14_1-2-win_vs2022.zip + $installDir = "C:\hdf5" + $extractDir = Join-Path $tempdir hdf5 + $innerZip = Join-Path $extractDir HDF5-1.14.2.1-win64.zip + + Write-Host "::group::Downloading windows HDF5 release $url" + Invoke-WebRequest $url -OutFile $hdf5Zip + Write-Host "::endgroup::" + + Write-Host "::group::Extracting outer windows HDF5 release $hdf5Zip" + Expand-Archive $hdf5Zip -DestinationPath $tempDir -Force + Write-Host "::endgroup::" + + Write-Host "::group::Extracting inner windows HDF5 release $innerZip" + Expand-Archive $innerZip -DestinationPath $installDir -Force + Write-Host "::endgroup::" + + # Now the HDF5_DIR can be set to: C:\hdf5\HDF5-1.14.2.1-win64\cmake +} From 89555418ecd1484c9241b76457de43f06586d00a Mon Sep 17 00:00:00 2001 From: Scott Wittenburg Date: Wed, 2 Aug 2023 11:05:56 -0600 Subject: [PATCH 2/8] use documented initial cache variable to find hdf5 on windows --- scripts/ci/cmake/ci-win2022-vs2022-ompi.cmake | 2 +- scripts/ci/cmake/ci-win2022-vs2022-serial.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ci/cmake/ci-win2022-vs2022-ompi.cmake b/scripts/ci/cmake/ci-win2022-vs2022-ompi.cmake index 321d1d6cae..66ce4ea851 100644 --- a/scripts/ci/cmake/ci-win2022-vs2022-ompi.cmake +++ b/scripts/ci/cmake/ci-win2022-vs2022-ompi.cmake @@ -8,7 +8,7 @@ ADIOS2_USE_Fortran:BOOL=OFF ADIOS2_USE_MPI:BOOL=ON ADIOS2_USE_HDF5:STRING=ON ADIOS2_USE_HDF5_VOL:STRING=OFF -HDF5_DIR:PATH=C:/hdf5/HDF5-1.14.2.1-win64/cmake +HDF5_ROOT:PATH=C:/hdf5/HDF5-1.14.2.1-win64 ") set(CTEST_CMAKE_GENERATOR "Visual Studio 17 2022") diff --git a/scripts/ci/cmake/ci-win2022-vs2022-serial.cmake b/scripts/ci/cmake/ci-win2022-vs2022-serial.cmake index a078f1ee58..96fb1339b3 100644 --- a/scripts/ci/cmake/ci-win2022-vs2022-serial.cmake +++ b/scripts/ci/cmake/ci-win2022-vs2022-serial.cmake @@ -8,7 +8,7 @@ ADIOS2_USE_Fortran:BOOL=OFF ADIOS2_USE_MPI:BOOL=OFF ADIOS2_USE_HDF5:STRING=ON ADIOS2_USE_HDF5_VOL:STRING=OFF -HDF5_DIR:PATH=C:/hdf5/HDF5-1.14.2.1-win64/cmake +HDF5_ROOT:PATH=C:/hdf5/HDF5-1.14.2.1-win64 ") set(CTEST_CMAKE_GENERATOR "Visual Studio 17 2022") From ea587280ca7c7f3aa68ca8fcada5339f742d656d Mon Sep 17 00:00:00 2001 From: Scott Wittenburg Date: Tue, 29 Aug 2023 18:12:20 -0600 Subject: [PATCH 3/8] Allow building with Visual Studio and HDF5 shared libs --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8836679e75..f0f6941024 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -287,6 +287,11 @@ if(BUILD_SHARED_LIBS AND ADIOS2_RUN_INSTALL_TEST) endif() endif() +if(MSVC AND BUILD_SHARED_LIBS AND ADIOS2_HAVE_HDF5) + # See note about building with visual studio and shared libs, here: + # https://github.com/HDFGroup/hdf5/blob/develop/release_docs/USING_HDF5_VS.txt + add_definitions(-DH5_BUILT_AS_DYNAMIC_LIB=1) +endif() #------------------------------------------------------------------------------# # Third party libraries From 15626a3fa080825a16685c22545faf1c87119789 Mon Sep 17 00:00:00 2001 From: Scott Wittenburg Date: Tue, 29 Aug 2023 18:12:40 -0600 Subject: [PATCH 4/8] Fix size_t -> int conversion warnings --- .../hdf5Reader/helloHDF5Reader_nompi.cpp | 2 +- source/adios2/engine/hdf5/HDF5ReaderP.cpp | 14 +++++++-- .../toolkit/interop/hdf5/HDF5Common.cpp | 31 ++++++++++++------- .../adios2/toolkit/interop/hdf5/HDF5Common.h | 2 +- .../toolkit/interop/hdf5/HDF5Common.tcc | 26 +++++++++++++--- testing/adios2/engine/SmallTestData.h | 24 +++++++------- 6 files changed, 67 insertions(+), 32 deletions(-) diff --git a/examples/hello/hdf5Reader/helloHDF5Reader_nompi.cpp b/examples/hello/hdf5Reader/helloHDF5Reader_nompi.cpp index 120c12ebc5..a7645f5298 100644 --- a/examples/hello/hdf5Reader/helloHDF5Reader_nompi.cpp +++ b/examples/hello/hdf5Reader/helloHDF5Reader_nompi.cpp @@ -22,7 +22,7 @@ void ReadData(adios2::IO h5IO, adios2::Engine h5Reader, const std::string &name) if (var) { - int nDims = var.Shape().size(); + size_t nDims = var.Shape().size(); size_t totalSize = 1; for (int i = 0; i < nDims; i++) { diff --git a/source/adios2/engine/hdf5/HDF5ReaderP.cpp b/source/adios2/engine/hdf5/HDF5ReaderP.cpp index 0d2a88fc02..1344208d8e 100644 --- a/source/adios2/engine/hdf5/HDF5ReaderP.cpp +++ b/source/adios2/engine/hdf5/HDF5ReaderP.cpp @@ -13,6 +13,8 @@ #include "adios2/helper/adiosFunctions.h" //CSVToVector #include "adios2/helper/adiosFunctions.h" //IsHDF5 +#include +#include #include namespace adios2 @@ -145,10 +147,18 @@ size_t HDF5ReaderP::ReadDataset(hid_t dataSetId, hid_t h5Type, Variable &vari if (ret < 0) return 0; - hid_t memDataSpace = H5Screate_simple(ndims, count.data(), NULL); + size_t max_int = static_cast(std::numeric_limits::max()); + if (ndims > max_int) + { + helper::Throw("Engine", "HDF5ReaderP", "ReadDataset", + "Number of dimensions is too large to be " + "represented by an int"); + } + + hid_t memDataSpace = H5Screate_simple(static_cast(ndims), count.data(), NULL); interop::HDF5TypeGuard g_mds(memDataSpace, interop::E_H5_SPACE); - int elementsRead = 1; + size_t elementsRead = 1; for (size_t i = 0u; i < ndims; i++) { elementsRead *= count[i]; diff --git a/source/adios2/toolkit/interop/hdf5/HDF5Common.cpp b/source/adios2/toolkit/interop/hdf5/HDF5Common.cpp index d19b78e92b..c07360ce2b 100644 --- a/source/adios2/toolkit/interop/hdf5/HDF5Common.cpp +++ b/source/adios2/toolkit/interop/hdf5/HDF5Common.cpp @@ -135,8 +135,17 @@ void HDF5Common::ParseParameters(core::IO &io) m_ChunkPID = H5Pcreate(H5P_DATASET_CREATE); m_ChunkDim = chunkDim.size(); + + size_t max_int = static_cast(std::numeric_limits::max()); + if (m_ChunkDim > max_int) + { + helper::Throw("Toolkit", "interop::hdf5::HDF5Common", + "ParseParameters", "chunkDim.size() is " + "too large to be represented by an int"); + } + if (m_ChunkDim > 0) - H5Pset_chunk(m_ChunkPID, chunkDim.size(), chunkDim.data()); + H5Pset_chunk(m_ChunkPID, static_cast(m_ChunkDim), chunkDim.data()); } } @@ -383,8 +392,8 @@ void HDF5Common::FindVarsFromH5(core::IO &io, hid_t top_id, const char *gname, c char name[100]; for (k = 0; k < numObj; k++) { - ret = H5Gget_objname_by_idx(gid, (hsize_t)k, name, sizeof(name)); - if (ret >= 0) + ssize_t result = H5Gget_objname_by_idx(gid, (hsize_t)k, name, sizeof(name)); + if (result >= 0) { int currType = H5Gget_objtype_by_idx(gid, k); if ((currType == H5G_DATASET) || (currType == H5G_TYPE)) @@ -447,8 +456,8 @@ void HDF5Common::ReadVariables(size_t ts, core::IO &io) char name[50]; for (k = 0; k < numObj; k++) { - ret = H5Gget_objname_by_idx(gid, (hsize_t)k, name, sizeof(name)); - if (ret >= 0) + ssize_t result = H5Gget_objname_by_idx(gid, (hsize_t)k, name, sizeof(name)); + if (result >= 0) { int currType = H5Gget_objtype_by_idx(gid, k); if (currType == H5G_GROUP) @@ -497,8 +506,8 @@ void HDF5Common::AddSingleString(core::IO &io, std::string const &name, hid_t da { // invalid variable, do not define printf("WARNING: IO is not accepting definition of variable: %s. " - "Skipping. \n", - name.c_str()); + "\nException: %s. \nSkipping. \n", + name.c_str(), e.what()); } } @@ -568,9 +577,9 @@ void HDF5Common::AddVarString(core::IO &io, std::string const &name, hid_t datas { // invalid variable, do not define printf("WARNING: IO is not accepting definition of " - "variable: %s. " + "variable: %s. \nException: %s. \n" "Skipping. \n", - name.c_str()); + name.c_str(), e.what()); } } return; @@ -632,8 +641,8 @@ void HDF5Common::AddVar(core::IO &io, std::string const &name, hid_t datasetId, { // invalid variable, do not define printf("WARNING: IO is not accepting definition of variable: %s. " - "Skipping. \n", - name.c_str()); + "\nException: %s. \nSkipping. \n", + name.c_str(), e.what()); } } else diff --git a/source/adios2/toolkit/interop/hdf5/HDF5Common.h b/source/adios2/toolkit/interop/hdf5/HDF5Common.h index 91cfac34b8..1fe2ffa5ca 100644 --- a/source/adios2/toolkit/interop/hdf5/HDF5Common.h +++ b/source/adios2/toolkit/interop/hdf5/HDF5Common.h @@ -261,7 +261,7 @@ class HDF5Common hid_t m_TimeStepH5T = H5T_NATIVE_ULLONG; ; hid_t m_ChunkPID; - int m_ChunkDim; + size_t m_ChunkDim; std::set m_ChunkVarNames; bool m_OrderByC = true; // C or fortran diff --git a/source/adios2/toolkit/interop/hdf5/HDF5Common.tcc b/source/adios2/toolkit/interop/hdf5/HDF5Common.tcc index ed1328e792..f19205f112 100644 --- a/source/adios2/toolkit/interop/hdf5/HDF5Common.tcc +++ b/source/adios2/toolkit/interop/hdf5/HDF5Common.tcc @@ -25,7 +25,7 @@ namespace interop template void HDF5Common::DefineDataset(core::Variable &variable) { - int dimSize = std::max(variable.m_Shape.size(), variable.m_Count.size()); + size_t dimSize = std::max(variable.m_Shape.size(), variable.m_Count.size()); hid_t h5Type = GetHDF5Type(); if (dimSize == 0) @@ -43,7 +43,15 @@ void HDF5Common::DefineDataset(core::Variable &variable) std::vector dimsf, count, offset; GetHDF5SpaceSpec(variable, dimsf, count, offset); - hid_t fileSpace = H5Screate_simple(dimSize, dimsf.data(), NULL); + size_t max_int = static_cast(std::numeric_limits::max()); + if (dimSize > max_int) + { + helper::Throw("Toolkit", "interop::hdf5::HDF5Common", + "DefineDataset", "dimSize is too large " + "to be represented by an int"); + } + + hid_t fileSpace = H5Screate_simple(static_cast(dimSize), dimsf.data(), NULL); HDF5TypeGuard fs(fileSpace, E_H5_SPACE); std::vector chain; @@ -110,7 +118,7 @@ template void HDF5Common::Write(core::Variable &variable, const T *values) { CheckWriteGroup(); - int dimSize = std::max(variable.m_Shape.size(), variable.m_Count.size()); + size_t dimSize = std::max(variable.m_Shape.size(), variable.m_Count.size()); hid_t h5Type = GetHDF5Type(); if (std::is_same::value) @@ -173,7 +181,15 @@ void HDF5Common::Write(core::Variable &variable, const T *values) std::vector dimsf, count, offset; GetHDF5SpaceSpec(variable, dimsf, count, offset); - hid_t fileSpace = H5Screate_simple(dimSize, dimsf.data(), NULL); + size_t max_int = static_cast(std::numeric_limits::max()); + if (dimSize > max_int) + { + helper::Throw("Toolkit", "interop::hdf5::HDF5Common", + "Write", "dimSize is too large " + "to be represented by an int"); + } + + hid_t fileSpace = H5Screate_simple(static_cast(dimSize), dimsf.data(), NULL); #ifndef RELAY_DEFINE_TO_HDF5 // RELAY_DEFINE_TO_HDF5 = variables in io are // created at begin_step std::vector chain; @@ -187,7 +203,7 @@ void HDF5Common::Write(core::Variable &variable, const T *values) { } #endif - hid_t memSpace = H5Screate_simple(dimSize, count.data(), NULL); + hid_t memSpace = H5Screate_simple(static_cast(dimSize), count.data(), NULL); // Select hyperslab fileSpace = H5Dget_space(dsetID); diff --git a/testing/adios2/engine/SmallTestData.h b/testing/adios2/engine/SmallTestData.h index 41a119eb2c..2bbb126aef 100644 --- a/testing/adios2/engine/SmallTestData.h +++ b/testing/adios2/engine/SmallTestData.h @@ -68,19 +68,19 @@ struct SmallTestData std::array TF = {{true, false, true, true, false, false, true, false, false, true}}; }; -SmallTestData generateNewSmallTestData(SmallTestData in, int step, int rank, int size) +SmallTestData generateNewSmallTestData(SmallTestData in, size_t step, size_t rank, size_t size) { - int j = rank + 1 + step * size; - std::for_each(in.I8.begin(), in.I8.end(), [&](int8_t &v) { v += j; }); - std::for_each(in.I16.begin(), in.I16.end(), [&](int16_t &v) { v += j; }); - std::for_each(in.I32.begin(), in.I32.end(), [&](int32_t &v) { v += j; }); - std::for_each(in.I64.begin(), in.I64.end(), [&](int64_t &v) { v += j; }); - std::for_each(in.U8.begin(), in.U8.end(), [&](uint8_t &v) { v += j; }); - std::for_each(in.U16.begin(), in.U16.end(), [&](uint16_t &v) { v += j; }); - std::for_each(in.U32.begin(), in.U32.end(), [&](uint32_t &v) { v += j; }); - std::for_each(in.U64.begin(), in.U64.end(), [&](uint64_t &v) { v += j; }); - std::for_each(in.R32.begin(), in.R32.end(), [&](float &v) { v += j; }); - std::for_each(in.R64.begin(), in.R64.end(), [&](double &v) { v += j; }); + size_t j = rank + 1 + step * size; + std::for_each(in.I8.begin(), in.I8.end(), [&](int8_t &v) { v += static_cast(j); }); + std::for_each(in.I16.begin(), in.I16.end(), [&](int16_t &v) { v += static_cast(j); }); + std::for_each(in.I32.begin(), in.I32.end(), [&](int32_t &v) { v += static_cast(j); }); + std::for_each(in.I64.begin(), in.I64.end(), [&](int64_t &v) { v += static_cast(j); }); + std::for_each(in.U8.begin(), in.U8.end(), [&](uint8_t &v) { v += static_cast(j); }); + std::for_each(in.U16.begin(), in.U16.end(), [&](uint16_t &v) { v += static_cast(j); }); + std::for_each(in.U32.begin(), in.U32.end(), [&](uint32_t &v) { v += static_cast(j); }); + std::for_each(in.U64.begin(), in.U64.end(), [&](uint64_t &v) { v += static_cast(j); }); + std::for_each(in.R32.begin(), in.R32.end(), [&](float &v) { v += static_cast(j); }); + std::for_each(in.R64.begin(), in.R64.end(), [&](double &v) { v += static_cast(j); }); std::for_each(in.R128.begin(), in.R128.end(), [&](long double &v) { v += j; }); std::for_each(in.CR32.begin(), in.CR32.end(), [&](std::complex &v) { From cc807f5768c7dfaed7456c9d8f8e2e48ed6b5667 Mon Sep 17 00:00:00 2001 From: Scott Wittenburg Date: Wed, 30 Aug 2023 09:56:33 -0600 Subject: [PATCH 5/8] clang format --- source/adios2/toolkit/interop/hdf5/HDF5Common.cpp | 5 +++-- source/adios2/toolkit/interop/hdf5/HDF5Common.tcc | 8 ++++---- testing/adios2/engine/SmallTestData.h | 9 ++++++--- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/source/adios2/toolkit/interop/hdf5/HDF5Common.cpp b/source/adios2/toolkit/interop/hdf5/HDF5Common.cpp index c07360ce2b..e96fc2bdc0 100644 --- a/source/adios2/toolkit/interop/hdf5/HDF5Common.cpp +++ b/source/adios2/toolkit/interop/hdf5/HDF5Common.cpp @@ -139,8 +139,9 @@ void HDF5Common::ParseParameters(core::IO &io) size_t max_int = static_cast(std::numeric_limits::max()); if (m_ChunkDim > max_int) { - helper::Throw("Toolkit", "interop::hdf5::HDF5Common", - "ParseParameters", "chunkDim.size() is " + helper::Throw("Toolkit", "interop::hdf5::HDF5Common", + "ParseParameters", + "chunkDim.size() is " "too large to be represented by an int"); } diff --git a/source/adios2/toolkit/interop/hdf5/HDF5Common.tcc b/source/adios2/toolkit/interop/hdf5/HDF5Common.tcc index f19205f112..77f946f799 100644 --- a/source/adios2/toolkit/interop/hdf5/HDF5Common.tcc +++ b/source/adios2/toolkit/interop/hdf5/HDF5Common.tcc @@ -46,8 +46,8 @@ void HDF5Common::DefineDataset(core::Variable &variable) size_t max_int = static_cast(std::numeric_limits::max()); if (dimSize > max_int) { - helper::Throw("Toolkit", "interop::hdf5::HDF5Common", - "DefineDataset", "dimSize is too large " + helper::Throw("Toolkit", "interop::hdf5::HDF5Common", "DefineDataset", + "dimSize is too large " "to be represented by an int"); } @@ -184,8 +184,8 @@ void HDF5Common::Write(core::Variable &variable, const T *values) size_t max_int = static_cast(std::numeric_limits::max()); if (dimSize > max_int) { - helper::Throw("Toolkit", "interop::hdf5::HDF5Common", - "Write", "dimSize is too large " + helper::Throw("Toolkit", "interop::hdf5::HDF5Common", "Write", + "dimSize is too large " "to be represented by an int"); } diff --git a/testing/adios2/engine/SmallTestData.h b/testing/adios2/engine/SmallTestData.h index 2bbb126aef..c090dd8f89 100644 --- a/testing/adios2/engine/SmallTestData.h +++ b/testing/adios2/engine/SmallTestData.h @@ -76,9 +76,12 @@ SmallTestData generateNewSmallTestData(SmallTestData in, size_t step, size_t ran std::for_each(in.I32.begin(), in.I32.end(), [&](int32_t &v) { v += static_cast(j); }); std::for_each(in.I64.begin(), in.I64.end(), [&](int64_t &v) { v += static_cast(j); }); std::for_each(in.U8.begin(), in.U8.end(), [&](uint8_t &v) { v += static_cast(j); }); - std::for_each(in.U16.begin(), in.U16.end(), [&](uint16_t &v) { v += static_cast(j); }); - std::for_each(in.U32.begin(), in.U32.end(), [&](uint32_t &v) { v += static_cast(j); }); - std::for_each(in.U64.begin(), in.U64.end(), [&](uint64_t &v) { v += static_cast(j); }); + std::for_each(in.U16.begin(), in.U16.end(), + [&](uint16_t &v) { v += static_cast(j); }); + std::for_each(in.U32.begin(), in.U32.end(), + [&](uint32_t &v) { v += static_cast(j); }); + std::for_each(in.U64.begin(), in.U64.end(), + [&](uint64_t &v) { v += static_cast(j); }); std::for_each(in.R32.begin(), in.R32.end(), [&](float &v) { v += static_cast(j); }); std::for_each(in.R64.begin(), in.R64.end(), [&](double &v) { v += static_cast(j); }); std::for_each(in.R128.begin(), in.R128.end(), [&](long double &v) { v += j; }); From 716e52cc8a369ab33fb89f07d0cd3c4e2f0d987a Mon Sep 17 00:00:00 2001 From: Scott Wittenburg Date: Wed, 30 Aug 2023 12:55:51 -0600 Subject: [PATCH 6/8] Fix more compiler warnings from ompi build --- examples/heatTransfer/write/IO_hdf5_a.cpp | 2 +- examples/hello/hdf5Reader/helloHDF5Reader.cpp | 4 ++-- examples/hello/hdf5Reader/helloHDF5Reader_nompi.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/heatTransfer/write/IO_hdf5_a.cpp b/examples/heatTransfer/write/IO_hdf5_a.cpp index 0ebedb1ef0..2546e03e23 100644 --- a/examples/heatTransfer/write/IO_hdf5_a.cpp +++ b/examples/heatTransfer/write/IO_hdf5_a.cpp @@ -49,7 +49,7 @@ void IO::write(int step, const HeatTransfer &ht, const Settings &s, MPI_Comm com double total_time = MPI_Wtime() - time_start; uint64_t adios_totalsize = 2 * sizeof(int) + 2 * s.ndx * s.ndy * sizeof(double); uint64_t sizeMB = adios_totalsize * s.nproc / 1024 / 1024 / 1024; // size in MB - uint64_t mbs = sizeMB / total_time; + double mbs = sizeMB / total_time; if (s.rank == 0) std::cout << "Step " << step << ": " << m_outputfilename << " " << sizeMB << " " << total_time << "" << mbs << std::endl; diff --git a/examples/hello/hdf5Reader/helloHDF5Reader.cpp b/examples/hello/hdf5Reader/helloHDF5Reader.cpp index d5ade54e72..33a2b7fb01 100644 --- a/examples/hello/hdf5Reader/helloHDF5Reader.cpp +++ b/examples/hello/hdf5Reader/helloHDF5Reader.cpp @@ -23,9 +23,9 @@ void ReadData(adios2::IO h5IO, adios2::Engine &h5Reader, const std::string &name if (var) { - int nDims = var.Shape().size(); + size_t nDims = var.Shape().size(); size_t totalSize = 1; - for (int i = 0; i < nDims; i++) + for (size_t i = 0; i < nDims; i++) { totalSize *= var.Shape()[i]; } diff --git a/examples/hello/hdf5Reader/helloHDF5Reader_nompi.cpp b/examples/hello/hdf5Reader/helloHDF5Reader_nompi.cpp index a7645f5298..c52d7515e0 100644 --- a/examples/hello/hdf5Reader/helloHDF5Reader_nompi.cpp +++ b/examples/hello/hdf5Reader/helloHDF5Reader_nompi.cpp @@ -24,7 +24,7 @@ void ReadData(adios2::IO h5IO, adios2::Engine h5Reader, const std::string &name) { size_t nDims = var.Shape().size(); size_t totalSize = 1; - for (int i = 0; i < nDims; i++) + for (size_t i = 0; i < nDims; i++) { totalSize *= var.Shape()[i]; } From b21d7bdc8c3f462ed2547f833f1531086bdf54ca Mon Sep 17 00:00:00 2001 From: Scott Wittenburg Date: Wed, 30 Aug 2023 14:14:37 -0600 Subject: [PATCH 7/8] Add location of hdf5.dll to PATH for windows tests --- scripts/ci/cmake/ci-win2022-vs2022-ompi.cmake | 3 +++ scripts/ci/cmake/ci-win2022-vs2022-serial.cmake | 3 +++ 2 files changed, 6 insertions(+) diff --git a/scripts/ci/cmake/ci-win2022-vs2022-ompi.cmake b/scripts/ci/cmake/ci-win2022-vs2022-ompi.cmake index 66ce4ea851..8f161ea2cd 100644 --- a/scripts/ci/cmake/ci-win2022-vs2022-ompi.cmake +++ b/scripts/ci/cmake/ci-win2022-vs2022-ompi.cmake @@ -3,6 +3,9 @@ set(ENV{CXX} cl) set(ENV{CFLAGS} /WX) set(ENV{CXXFLAGS} /WX) +# Tests need to find hdf5.dll +set(ENV{PATH} "$ENV{PATH};C:/hdf5/HDF5-1.14.2.1-win64/bin") + set(dashboard_cache " ADIOS2_USE_Fortran:BOOL=OFF ADIOS2_USE_MPI:BOOL=ON diff --git a/scripts/ci/cmake/ci-win2022-vs2022-serial.cmake b/scripts/ci/cmake/ci-win2022-vs2022-serial.cmake index 96fb1339b3..a6d06fc702 100644 --- a/scripts/ci/cmake/ci-win2022-vs2022-serial.cmake +++ b/scripts/ci/cmake/ci-win2022-vs2022-serial.cmake @@ -3,6 +3,9 @@ set(ENV{CXX} cl) set(ENV{CFLAGS} /WX) set(ENV{CXXFLAGS} /WX) +# Tests need to find hdf5.dll +set(ENV{PATH} "$ENV{PATH};C:/hdf5/HDF5-1.14.2.1-win64/bin") + set(dashboard_cache " ADIOS2_USE_Fortran:BOOL=OFF ADIOS2_USE_MPI:BOOL=OFF From 2e37421e23e3211a5dcffa1672b870b82fa54fe6 Mon Sep 17 00:00:00 2001 From: Scott Wittenburg Date: Thu, 31 Aug 2023 12:13:40 -0600 Subject: [PATCH 8/8] tests: fix windows 64bit type issues --- .../engine/hdf5/TestNativeHDF5WriteRead.cpp | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/testing/adios2/engine/hdf5/TestNativeHDF5WriteRead.cpp b/testing/adios2/engine/hdf5/TestNativeHDF5WriteRead.cpp index e75ef25c20..0e2bf580a5 100644 --- a/testing/adios2/engine/hdf5/TestNativeHDF5WriteRead.cpp +++ b/testing/adios2/engine/hdf5/TestNativeHDF5WriteRead.cpp @@ -626,7 +626,11 @@ TEST_F(HDF5WriteReadTest, ADIOS2HDF5WriteHDF5Read1D8) hdf5Reader.ReadVar("i32", I32.data(), offset, count, arraySize); hdf5Reader.GetVarInfo("i64", gDims, h5Type); +#ifdef _WIN32 + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_LLONG), 1); +#else ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_LONG), 1); +#endif ASSERT_EQ(gDims.size(), 1); ASSERT_EQ(gDims[0], globalArraySize); hdf5Reader.ReadVar("i64", I64.data(), offset, count, arraySize); @@ -650,7 +654,11 @@ TEST_F(HDF5WriteReadTest, ADIOS2HDF5WriteHDF5Read1D8) hdf5Reader.ReadVar("u32", U32.data(), offset, count, arraySize); hdf5Reader.GetVarInfo("u64", gDims, h5Type); +#ifdef _WIN32 + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_ULLONG), 1); +#else ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_ULONG), 1); +#endif ASSERT_EQ(gDims.size(), 1); ASSERT_EQ(gDims[0], globalArraySize); hdf5Reader.ReadVar("u64", U64.data(), offset, count, arraySize); @@ -1018,16 +1026,26 @@ TEST_F(HDF5WriteReadTest, HDF5WriteADIOS2HDF5Read1D8) currentTestData.I16.data()); h5writer.CreateAndStoreVar("i32", dimSize, H5T_NATIVE_INT, global_dims, offset, count, currentTestData.I32.data()); +#ifdef _WIN32 + h5writer.CreateAndStoreVar("i64", dimSize, H5T_NATIVE_LLONG, global_dims, offset, count, + currentTestData.I64.data()); +#else h5writer.CreateAndStoreVar("i64", dimSize, H5T_NATIVE_LONG, global_dims, offset, count, currentTestData.I64.data()); +#endif h5writer.CreateAndStoreVar("u8", dimSize, H5T_NATIVE_UCHAR, global_dims, offset, count, currentTestData.U8.data()); h5writer.CreateAndStoreVar("u16", dimSize, H5T_NATIVE_USHORT, global_dims, offset, count, currentTestData.U16.data()); h5writer.CreateAndStoreVar("u32", dimSize, H5T_NATIVE_UINT, global_dims, offset, count, currentTestData.U32.data()); +#ifdef _WIN32 + h5writer.CreateAndStoreVar("u64", dimSize, H5T_NATIVE_ULLONG, global_dims, offset, + count, currentTestData.U64.data()); +#else h5writer.CreateAndStoreVar("u64", dimSize, H5T_NATIVE_ULONG, global_dims, offset, count, currentTestData.U64.data()); +#endif h5writer.CreateAndStoreVar("r32", dimSize, H5T_NATIVE_FLOAT, global_dims, offset, count, currentTestData.R32.data()); h5writer.CreateAndStoreVar("r64", dimSize, H5T_NATIVE_DOUBLE, global_dims, offset, @@ -1419,7 +1437,11 @@ TEST_F(HDF5WriteReadTest, ADIOS2HDF5WriteHDF5Read2D2x4) hdf5Reader.ReadVar("i32", I32.data(), offset, count, arraySize); hdf5Reader.GetVarInfo("i64", gDims, h5Type); +#ifdef _WIN32 + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_LLONG), 1); +#else ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_LONG), 1); +#endif ASSERT_EQ(gDims.size(), 2); ASSERT_EQ(gDims[0], 2); ASSERT_EQ(gDims[1], globalArraySize); @@ -1447,7 +1469,11 @@ TEST_F(HDF5WriteReadTest, ADIOS2HDF5WriteHDF5Read2D2x4) hdf5Reader.ReadVar("u32", U32.data(), offset, count, arraySize); hdf5Reader.GetVarInfo("u64", gDims, h5Type); +#ifdef _WIN32 + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_ULLONG), 1); +#else ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_ULONG), 1); +#endif ASSERT_EQ(gDims.size(), 2); ASSERT_EQ(gDims[0], 2); ASSERT_EQ(gDims[1], globalArraySize); @@ -1833,16 +1859,26 @@ TEST_F(HDF5WriteReadTest, HDF5WriteADIOS2HDF5Read2D2x4) currentTestData.I16.data()); h5writer.CreateAndStoreVar("i32", dimSize, H5T_NATIVE_INT, global_dims, offset, count, currentTestData.I32.data()); +#ifdef _WIN32 + h5writer.CreateAndStoreVar("i64", dimSize, H5T_NATIVE_LLONG, global_dims, offset, count, + currentTestData.I64.data()); +#else h5writer.CreateAndStoreVar("i64", dimSize, H5T_NATIVE_LONG, global_dims, offset, count, currentTestData.I64.data()); +#endif h5writer.CreateAndStoreVar("u8", dimSize, H5T_NATIVE_UCHAR, global_dims, offset, count, currentTestData.U8.data()); h5writer.CreateAndStoreVar("u16", dimSize, H5T_NATIVE_USHORT, global_dims, offset, count, currentTestData.U16.data()); h5writer.CreateAndStoreVar("u32", dimSize, H5T_NATIVE_UINT, global_dims, offset, count, currentTestData.U32.data()); +#ifdef _WIN32 + h5writer.CreateAndStoreVar("u64", dimSize, H5T_NATIVE_ULLONG, global_dims, offset, + count, currentTestData.U64.data()); +#else h5writer.CreateAndStoreVar("u64", dimSize, H5T_NATIVE_ULONG, global_dims, offset, count, currentTestData.U64.data()); +#endif h5writer.CreateAndStoreVar("r32", dimSize, H5T_NATIVE_FLOAT, global_dims, offset, count, currentTestData.R32.data()); h5writer.CreateAndStoreVar("r64", dimSize, H5T_NATIVE_DOUBLE, global_dims, offset, @@ -2229,7 +2265,11 @@ TEST_F(HDF5WriteReadTest, ADIOS2HDF5WriteHDF5Read2D4x2) hdf5Reader.ReadVar("i32", I32.data(), offset, count, arraySize); hdf5Reader.GetVarInfo("i64", gDims, h5Type); +#ifdef _WIN32 + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_LLONG), 1); +#else ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_LONG), 1); +#endif ASSERT_EQ(gDims.size(), 2); ASSERT_EQ(gDims[0], 4); ASSERT_EQ(gDims[1], globalArraySize); @@ -2257,7 +2297,11 @@ TEST_F(HDF5WriteReadTest, ADIOS2HDF5WriteHDF5Read2D4x2) hdf5Reader.ReadVar("u32", U32.data(), offset, count, arraySize); hdf5Reader.GetVarInfo("u64", gDims, h5Type); +#ifdef _WIN32 + ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_ULLONG), 1); +#else ASSERT_EQ(H5Tequal(h5Type, H5T_NATIVE_ULONG), 1); +#endif ASSERT_EQ(gDims.size(), 2); ASSERT_EQ(gDims[0], 4); ASSERT_EQ(gDims[1], globalArraySize); @@ -2639,16 +2683,26 @@ TEST_F(HDF5WriteReadTest, HDF5WriteADIOS2HDF5Read2D4x2) currentTestData.I16.data()); h5writer.CreateAndStoreVar("i32", dimSize, H5T_NATIVE_INT, global_dims, offset, count, currentTestData.I32.data()); +#ifdef _WIN32 + h5writer.CreateAndStoreVar("i64", dimSize, H5T_NATIVE_LLONG, global_dims, offset, count, + currentTestData.I64.data()); +#else h5writer.CreateAndStoreVar("i64", dimSize, H5T_NATIVE_LONG, global_dims, offset, count, currentTestData.I64.data()); +#endif h5writer.CreateAndStoreVar("u8", dimSize, H5T_NATIVE_UCHAR, global_dims, offset, count, currentTestData.U8.data()); h5writer.CreateAndStoreVar("u16", dimSize, H5T_NATIVE_USHORT, global_dims, offset, count, currentTestData.U16.data()); h5writer.CreateAndStoreVar("u32", dimSize, H5T_NATIVE_UINT, global_dims, offset, count, currentTestData.U32.data()); +#ifdef _WIN32 + h5writer.CreateAndStoreVar("u64", dimSize, H5T_NATIVE_ULLONG, global_dims, offset, + count, currentTestData.U64.data()); +#else h5writer.CreateAndStoreVar("u64", dimSize, H5T_NATIVE_ULONG, global_dims, offset, count, currentTestData.U64.data()); +#endif h5writer.CreateAndStoreVar("r32", dimSize, H5T_NATIVE_FLOAT, global_dims, offset, count, currentTestData.R32.data()); h5writer.CreateAndStoreVar("r64", dimSize, H5T_NATIVE_DOUBLE, global_dims, offset,