Skip to content

Commit

Permalink
Add ZFP compression support for HDF5 plot files (Exawind#616)
Browse files Browse the repository at this point in the history
* Add ZFP compression support for HDF5 plot files.

* Update amrex.
  • Loading branch information
jrood-nrel authored May 11, 2022
1 parent 1906446 commit bcb8041
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 11 deletions.
17 changes: 9 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ option(AMR_WIND_ENABLE_TINY_PROFILE "Enable AMReX TinyProfile support" OFF)
option(AMR_WIND_USE_INTERNAL_AMREX "Add AMReX as subproject" ON)
option(AMR_WIND_USE_INTERNAL_AMREX_HYDRO "Add AMReX-Hydro as subproject" ON)
option(AMR_WIND_ENABLE_HDF5 "Enable HDF5 library" OFF)
option(AMR_WIND_ENABLE_HDF5_ZFP "Enable ZFP compression in HDF5 library" OFF)
option(AMR_WIND_ENABLE_NETCDF "Enable NetCDF library" OFF)
option(AMR_WIND_ENABLE_MASA "Enable MASA library" OFF)
option(AMR_WIND_ENABLE_HYPRE "Enable HYPRE integration" OFF)
Expand Down Expand Up @@ -122,15 +123,15 @@ endif()

if(AMR_WIND_ENABLE_HDF5)
set(CMAKE_PREFIX_PATH ${HDF5_DIR} ${CMAKE_PREFIX_PATH})
if(AMR_WIND_ENABLE_MPI)
set(HDF5_PREFER_PARALLEL TRUE)
endif()
find_package(HDF5 1.10.4 REQUIRED)
if(AMR_WIND_ENABLE_MPI AND (NOT HDF5_IS_PARALLEL))
message(FATAL_ERROR "MPI enabled but HDF5 library does not support parallel I/O")
endif()
target_compile_definitions(${amr_wind_lib_name} PUBLIC AMR_WIND_USE_HDF5)
target_link_libraries_system(${amr_wind_lib_name} PUBLIC HDF5::HDF5)
endif()

if(AMR_WIND_ENABLE_HDF5_ZFP)
if(NOT AMR_WIND_ENABLE_HDF5)
message(FATAL_ERROR "HDF5 must be enabled to use ZFP compression in HDF5 plot files")
endif()
set(CMAKE_PREFIX_PATH ${H5Z_ZFP_DIR} ${CMAKE_PREFIX_PATH})
target_compile_definitions(${amr_wind_lib_name} PUBLIC AMR_WIND_USE_HDF5_ZFP)
endif()

if(AMR_WIND_ENABLE_MASA)
Expand Down
4 changes: 4 additions & 0 deletions amr-wind/utilities/IOManager.H
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ private:
#ifdef AMR_WIND_USE_HDF5
//! Flag indicating whether or not to output HDF5 plot files
bool m_output_hdf5_plotfile{false};
#ifdef AMR_WIND_USE_HDF5_ZFP
//! String for requesting a particular ZFP compression in HDF5 plot files
std::string m_hdf5_compression{"None@0"};
#endif
#endif
};

Expand Down
12 changes: 10 additions & 2 deletions amr-wind/utilities/IOManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ void IOManager::initialize_io()
pp.query("allow_missing_restart_fields", m_allow_missing_restart_fields);
#ifdef AMR_WIND_USE_HDF5
pp.query("output_hdf5_plotfile", m_output_hdf5_plotfile);
#ifdef AMR_WIND_USE_HDF5_ZFP
pp.query("hdf5_compression", m_hdf5_compression);
#endif
#endif

// ParmParse requires us to read in a vector
Expand Down Expand Up @@ -159,9 +162,14 @@ void IOManager::write_plot_file()
<< m_sim.time().new_time() << std::endl;
#ifdef AMR_WIND_USE_HDF5
if (m_output_hdf5_plotfile) {
amrex::WriteMultiLevelPlotfileHDF5(
amrex::WriteMultiLevelPlotfileHDF5SingleDset(
plt_filename, nlevels, outfield->vec_const_ptrs(), m_plt_var_names,
mesh.Geom(), m_sim.time().new_time(), istep, mesh.refRatio());
mesh.Geom(), m_sim.time().new_time(), istep, mesh.refRatio()
#ifdef AMR_WIND_USE_HDF5_ZFP
,
m_hdf5_compression
#endif
);
} else {
#endif
amrex::WriteMultiLevelPlotfile(
Expand Down
1 change: 1 addition & 0 deletions cmake/set_amrex_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ set(AMReX_SUNDIALS OFF)
set(AMReX_TINY_PROFILE ${AMR_WIND_ENABLE_TINY_PROFILE})
set(AMReX_TRACE_PROFILE OFF)
set(AMReX_HDF5 ${AMR_WIND_ENABLE_HDF5})
set(AMReX_HDF5_ZFP ${AMR_WIND_ENABLE_HDF5_ZFP})

if (AMR_WIND_ENABLE_CUDA)
set(AMReX_GPU_BACKEND CUDA CACHE STRING "AMReX GPU type" FORCE)
Expand Down
2 changes: 1 addition & 1 deletion submods/amrex
Submodule amrex updated 69 files
+5 −5 .github/workflows/cuda.yml
+30 −0 .github/workflows/dependencies/dependencies_nvcc10.sh
+1 −7 .github/workflows/dependencies/dependencies_nvcc11.sh
+0 −38 .github/workflows/dependencies/dependencies_nvcc9.sh
+56 −0 CHANGES
+4 −4 Docs/sphinx_documentation/source/Basics.rst
+2 −0 Docs/sphinx_documentation/source/BuildingAMReX.rst
+18 −7 Docs/sphinx_documentation/source/EB.rst
+5 −16 Docs/sphinx_documentation/source/GPU.rst
+2 −2 Docs/sphinx_documentation/source/GPU_Chapter.rst
+2 −2 Src/Base/AMReX_Algorithm.H
+0 −6 Src/Base/AMReX_AsyncOut.cpp
+0 −5 Src/Base/AMReX_BaseFab.H
+1 −1 Src/Base/AMReX_CudaGraph.H
+0 −2 Src/Base/AMReX_FArrayBox.cpp
+4 −4 Src/Base/AMReX_FBI.H
+2 −2 Src/Base/AMReX_FabArray.H
+1 −1 Src/Base/AMReX_FabArrayBase.H
+4 −4 Src/Base/AMReX_FabArrayCommI.H
+2 −7 Src/Base/AMReX_GpuAsyncArray.H
+1 −3 Src/Base/AMReX_GpuAsyncArray.cpp
+1 −1 Src/Base/AMReX_GpuDevice.H
+8 −12 Src/Base/AMReX_GpuDevice.cpp
+2 −7 Src/Base/AMReX_GpuElixir.cpp
+2 −2 Src/Base/AMReX_IntConv.H
+0 −8 Src/Base/AMReX_IntVect.H
+19 −0 Src/EB/AMReX_EB2.cpp
+9 −9 Src/EB/AMReX_EB2_GeometryShop.H
+0 −4 Src/EB/AMReX_EB2_IF_Box.H
+47 −0 Src/EB/AMReX_EB2_IndexSpace_STL.H
+85 −0 Src/EB/AMReX_EB2_IndexSpace_STL.cpp
+18 −2 Src/EB/AMReX_EB2_Level.H
+25 −0 Src/EB/AMReX_EB2_Level_STL.H
+19 −0 Src/EB/AMReX_EB2_Level_STL.cpp
+55 −27 Src/EB/AMReX_EB_STL_utils.H
+694 −119 Src/EB/AMReX_EB_STL_utils.cpp
+3 −1 Src/EB/AMReX_EB_triGeomOps_K.H
+0 −20 Src/EB/AMReX_EB_utils.cpp
+0 −8 Src/EB/AMReX_algoim_K.H
+4 −0 Src/EB/CMakeLists.txt
+3 −0 Src/EB/Make.package
+0 −4 Src/Extern/SUNDIALS/AMReX_NVector_MultiFab.cpp
+6 −2 Src/LinearSolvers/MLMG/AMReX_MLEBNodeFDLaplacian.H
+20 −4 Src/LinearSolvers/MLMG/AMReX_MLEBNodeFDLaplacian.cpp
+1 −0 Src/LinearSolvers/MLMG/AMReX_MLEBTensorOp.H
+15 −2 Src/LinearSolvers/MLMG/AMReX_MLEBTensorOp.cpp
+4 −5 Src/LinearSolvers/MLMG/AMReX_MLEBTensor_2D_K.H
+5 −5 Src/LinearSolvers/MLMG/AMReX_MLEBTensor_3D_K.H
+1 −1 Src/Particle/AMReX_NeighborParticlesI.H
+52 −2 Src/Particle/AMReX_ParticleContainerBase.H
+29 −0 Src/Particle/AMReX_ParticleContainerBase.cpp
+3 −3 Src/Particle/AMReX_Particles.H
+4 −3 Tests/Amr/Advection_AmrCore/Exec/GNUmakefile
+2 −2 Tests/Amr/Advection_AmrCore/Exec/Make.Adv
+11 −6 Tests/Amr/Advection_AmrCore/Exec/inputs
+10 −6 Tests/Amr/Advection_AmrCore/Exec/inputs-ci
+11 −6 Tests/Amr/Advection_AmrCore/Exec/inputs_for_scaling
+28 −7 Tests/Amr/Advection_AmrCore/Source/AmrCoreAdv.H
+122 −18 Tests/Amr/Advection_AmrCore/Source/AmrCoreAdv.cpp
+3 −3 Tests/Amr/Advection_AmrCore/Source/DefineVelocity.cpp
+0 −4 Tests/GPU/CNS/Source/CNS_K.H
+7 −1 Tools/CMake/AMReXConfig.cmake.in
+4 −0 Tools/CMake/AMReXOptions.cmake
+3 −0 Tools/CMake/AMReXParallelBackends.cmake
+1 −0 Tools/CMake/AMReXSetDefines.cmake
+25 −3 Tools/CMake/AMReXThirdPartyLibraries.cmake
+1 −0 Tools/CMake/AMReX_Config.H.in
+1 −1 Tools/CMake/AMReX_SetupCUDA.cmake
+4 −11 Tools/GNUMake/comps/nvcc.mak
3 changes: 3 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ endif()

if(AMR_WIND_ENABLE_HDF5)
add_test_re(abl_stable_hdf5)
if(AMR_WIND_ENABLE_HDF5_ZFP)
add_test_re(abl_stable_hdf5_zfp)
endif()
endif()

#=============================================================================
Expand Down
78 changes: 78 additions & 0 deletions test/test_files/abl_stable_hdf5_zfp/abl_stable_hdf5_zfp.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# SIMULATION STOP #
#.......................................#
time.stop_time = 28800.0 # Max (simulated) time to evolve
time.max_step = 10 # Max number of time steps
#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# TIME STEP COMPUTATION #
#.......................................#
time.fixed_dt = 0.25 # Use this constant dt if > 0
time.cfl = 0.95 # CFL factor
#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# INPUT AND OUTPUT #
#.......................................#
time.plot_interval = 10 # Steps between plot files
time.checkpoint_interval = -1 # Steps between checkpoint files
#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# PHYSICS #
#.......................................#
incflo.gravity = 0.0 0.0 -9.81 # Gravitational force (3D)
incflo.density = 1.3223 # Reference density
incflo.use_godunov = 1
incflo.godunov_type = "ppm_nolim"
transport.viscosity = 0.0
transport.laminar_prandtl = 0.7
transport.turbulent_prandtl = 0.3333
turbulence.model = OneEqKsgsM84
incflo.physics = ABL
ICNS.source_terms = BoussinesqBuoyancy CoriolisForcing GeostrophicForcing
TKE.source_terms = KsgsM84Src
BoussinesqBuoyancy.reference_temperature = 263.5
CoriolisForcing.east_vector = 1.0 0.0 0.0
CoriolisForcing.north_vector = 0.0 1.0 0.0
CoriolisForcing.latitude = 90.0
CoriolisForcing.rotational_time_period = 90405.5439881955
GeostrophicForcing.geostrophic_wind = 8.0 0.0 0.0
incflo.velocity = 8.0 0.0 0.0
ABL.reference_temperature = 263.5
ABL.temperature_heights = 0.0 100 400.0
ABL.temperature_values = 265.0 265.0 268.0
ABL.perturb_temperature = false
ABL.cutoff_height = 50.0
ABL.perturb_velocity = true
ABL.perturb_ref_height = 50.0
ABL.Uperiods = 4.0
ABL.Vperiods = 4.0
ABL.deltaU = 1e-5
ABL.deltaV = 1e-5
ABL.kappa = .40
ABL.mo_gamma_m = 4.8
ABL.mo_gamma_h = 7.8
ABL.surface_roughness_z0 = 0.1
ABL.surface_temp_rate = -0.25
ABL.surface_temp_init = 265.0
ABL.normal_direction = 2
ABL.stats_output_frequency = 100
#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# ADAPTIVE MESH REFINEMENT #
#.......................................#
amr.n_cell = 48 48 48 # Grid cells at coarsest AMRlevel
amr.max_level = 0 # Max AMR level in hierarchy
#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨#
# GEOMETRY #
#.......................................#
geometry.prob_lo = 0. 0. 0. # Lo corner coordinates
geometry.prob_hi = 400. 400. 400. # Hi corner coordinates
geometry.is_periodic = 1 1 0 # Periodicity x y z (0/1)
# Boundary conditions
zlo.type = "wall_model"
zlo.temperature_type = "wall_model"
zhi.type = "slip_wall"
zhi.temperature_type = "fixed_gradient"
zhi.temperature = 0.01
zlo.tke_type = "zero_gradient"
#zhi.tke_type = "zero_gradient"
incflo.verbose = 0

io.output_hdf5_plotfile = true
io.hdf5_compression="[email protected]"

0 comments on commit bcb8041

Please sign in to comment.