Skip to content

Commit

Permalink
Merge branch 'dqwu/add_hdf5_iotype' into master (PR E3SM-Project#6046)
Browse files Browse the repository at this point in the history
Adding support for the HDF5 I/O format which is already available
in SCORPIO.

Also using HDF5_ROOT in buildlib.spio to turn on HDF5 support.

[BFB]
  • Loading branch information
jgfouca committed Dec 6, 2023
2 parents e9c6718 + 34b0875 commit d1e4786
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion driver-mct/cime_config/config_component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2629,7 +2629,7 @@

<entry id="PIO_TYPENAME">
<type>char</type>
<valid_values>netcdf,pnetcdf,netcdf4p,netcdf4c,adios,default</valid_values>
<valid_values>netcdf,pnetcdf,netcdf4p,netcdf4c,adios,hdf5,default</valid_values>
<group>run_pio</group>
<file>env_run.xml</file>
<desc>pio io type</desc>
Expand Down
2 changes: 1 addition & 1 deletion driver-moab/cime_config/config_component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2480,7 +2480,7 @@

<entry id="PIO_TYPENAME">
<type>char</type>
<valid_values>netcdf,pnetcdf,netcdf4p,netcdf4c,adios,default</valid_values>
<valid_values>netcdf,pnetcdf,netcdf4p,netcdf4c,adios,hdf5,default</valid_values>
<group>run_pio</group>
<file>env_run.xml</file>
<desc>pio io type</desc>
Expand Down
12 changes: 10 additions & 2 deletions share/build/buildlib.spio
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,10 @@ def buildlib(bldroot, installpath, case):
# elif which_h5dump is not None:
# os.environ["HDF5"] = os.path.dirname(os.path.dirname(which_h5dump))

if "WITH_HDF5_SCORPIO" in os.environ:
cmake_opts += "-DWITH_HDF5:BOOL=ON "
# Before E3SM upgrades scorpio submodule to 1.5.0 or higher, keep WITH_HDF5
# CMake option OFF by default.
# if "HDF5_ROOT" in os.environ:
# cmake_opts += "-DWITH_HDF5:BOOL=ON "

# Same deal with libz and szip
if "ZLIB_ROOT" in os.environ:
Expand Down Expand Up @@ -197,10 +199,12 @@ def buildlib(bldroot, installpath, case):
netcdf4_string = "NetCDF_C_HAS_PARALLEL:BOOL=TRUE"

adios_string = "WITH_ADIOS2:BOOL=ON"
hdf5_string = "WITH_HDF5:BOOL=ON"
expect_string_found = False
pnetcdf_found = False
netcdf4_parallel_found = False
adios_found = False
hdf5_found = False

cache_file = open(os.path.join(pio_bld_dir,"CMakeCache.txt"), "r")
for line in cache_file:
Expand All @@ -212,6 +216,8 @@ def buildlib(bldroot, installpath, case):
netcdf4_parallel_found = True
if re.search(adios_string, line):
adios_found = True
if re.search(hdf5_string, line):
hdf5_found = True

if pio_version == 1:
installed_lib = os.path.join(installpath, "lib", "libpio.a")
Expand Down Expand Up @@ -268,6 +274,8 @@ def buildlib(bldroot, installpath, case):
valid_values += ",netcdf4p,netcdf4c"
if adios_found:
valid_values += ",adios"
if hdf5_found:
valid_values += ",hdf5"

_set_pio_valid_values(case, valid_values)

Expand Down
2 changes: 2 additions & 0 deletions share/util/shr_pio_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,8 @@ subroutine shr_pio_getiotypefromname(typename, iotype, defaulttype)
#ifndef PIO1
else if ( typename .eq. 'ADIOS') then
iotype = pio_iotype_adios
else if ( typename .eq. 'HDF5') then
iotype = pio_iotype_hdf5
#endif
else if ( typename .eq. 'NOTHING') then
iotype = defaulttype
Expand Down

0 comments on commit d1e4786

Please sign in to comment.