Skip to content

Commit

Permalink
Make HDF5 optional (#64)
Browse files Browse the repository at this point in the history
* make hdf5 optional

* mention conda env
  • Loading branch information
arnav-singhal authored Jul 20, 2024
1 parent b1fa4ee commit d67ad05
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ set(AMReX_TINY_PROFILE ON)
set(AMReX_SPACEDIM 2 CACHE INTERNAL "")
set(AMReX_PRECISION SINGLE CACHE INTERNAL "")
set(AMReX_PARTICLES_PRECISION SINGLE CACHE INTERNAL "")
set(AMReX_HDF5 TRUE)

#
# Fetch amrex repo
Expand Down
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,18 @@ This demo uses CMake version 3.14 or higher. To build it:

To build with GPU support, use the `-DAMReX_GPU_BACKEND=CUDA` CMake option.

For convenience, a script for setting up the module environment for Perlmutter is
provided in etc/perlmutter_environment.sh. To use it, do:
To write output as (compressed) HDF5, use the `-DAMReX_HDF5=TRUE` CMake option.
Parallel HDF5 installation is required. On perlmutter, a conda environment is
available at:

conda activate /global/common/software/m3623/exaepi

Compression level can be altered in src/IO.cpp file. The environment variable
HDF5_CHUNK_SIZE controls the chunk size if compression is used. A value of
around 100,000 is recommended to start.

For convenience, a script for setting up the module environment without HDF5
for Perlmutter is provided in etc/perlmutter_environment.sh. To use it, do:

source etc/perlmutter_environment.sh

Expand Down
18 changes: 18 additions & 0 deletions src/IO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,22 @@ void writePlotFile (const AgentContainer& pc, /*!< Agent (particle) container */
plt_varnames.push_back("Tract");
plt_varnames.push_back("comm");

#ifdef AMREX_USE_HDF5
WriteSingleLevelPlotfileHDF5MultiDset( amrex::Concatenate("plt", step, 5),
output_mf,
plt_varnames,
pc.ParticleGeom(0),
cur_time,
step,
"ZLIB@3" );
#else
WriteSingleLevelPlotfile( amrex::Concatenate("plt", step, 5),
output_mf,
plt_varnames,
pc.ParticleGeom(0),
cur_time,
step );
#endif
}

{
Expand Down Expand Up @@ -136,13 +145,22 @@ void writePlotFile (const AgentContainer& pc, /*!< Agent (particle) container */
}
}

#ifdef AMREX_USE_HDF5
pc.WritePlotFileHDF5( amrex::Concatenate("plt", step, 5),
"agents",
write_real_comp,
write_int_comp,
real_varnames,
int_varnames,
"ZLIB@3" );
#else
pc.WritePlotFile( amrex::Concatenate("plt", step, 5),
"agents",
write_real_comp,
write_int_comp,
real_varnames,
int_varnames );
#endif
}
}

Expand Down

0 comments on commit d67ad05

Please sign in to comment.