Skip to content

Commit

Permalink
Merge branch 'jgfouca/fix_pio1_build' into master (PR E3SM-Project#6069)
Browse files Browse the repository at this point in the history
Fix SCORPIO CLASSIC build

Fixing SCORPIO CLASSIC (PIO_VERSION=1) builds

Fixes location of genf90 for SCORPIO CLASSIC
Also avoids ADIOS I/O type when using SCORPIO CLASSIC

Fixes E3SM-Project#6066

[BFB]
  • Loading branch information
jgfouca committed Dec 1, 2023
2 parents 88488dc + 11fc34c commit 5d5f15c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 16 deletions.
4 changes: 4 additions & 0 deletions components/cmake/common_setup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ endif()
if (PIO_VERSION STREQUAL "1")
set(CPPDEFS "${CPPDEFS} -DPIO1")
endif()
# The code below is what we actually want but it's currently broken.
# Once fixes are in place, uncomment the line below and remove the 3
# lines above.
# set(CPPDEFS "${CPPDEFS} -DPIO${PIO_VERSION}")

# Not clear how to escape commas for libraries with their own configure
# script, and they don't need this defined anyway, so leave this out of
Expand Down
9 changes: 8 additions & 1 deletion components/mpas-framework/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,14 @@ set(FILE_OFFSET "-DOFFSET64BIT")
if (CPPDEFS)
separate_arguments(CPPDEFS UNIX_COMMAND "${CPPDEFS}")
endif()
list(APPEND CPPDEFS "-DMPAS_NO_LOG_REDIRECT" "-DUSE_PIO2" "-DHAVE_ADIOS" "-DMPAS_NO_ESMF_INIT" "-DMPAS_ESM_SHR_CONST" "-DMPAS_PERF_MOD_TIMERS" "${MODEL_FORMULATION}" "${FILE_OFFSET}" "${ZOLTAN_DEFINE}" "-D_MPI" "-DMPAS_NAMELIST_SUFFIX=${NAMELIST_SUFFIX}" "-DMPAS_EXE_NAME=${EXE_NAME}")
list(APPEND CPPDEFS "-DMPAS_NO_LOG_REDIRECT" "-DMPAS_NO_ESMF_INIT" "-DMPAS_ESM_SHR_CONST" "-DMPAS_PERF_MOD_TIMERS" "${MODEL_FORMULATION}" "${FILE_OFFSET}" "${ZOLTAN_DEFINE}" "-D_MPI" "-DMPAS_NAMELIST_SUFFIX=${NAMELIST_SUFFIX}" "-DMPAS_EXE_NAME=${EXE_NAME}")
if (PIO_VERSION STREQUAL "2")
list(APPEND CPPDEFS "-DUSE_PIO2")
if (TARGET adios2::adios2)
list(APPEND CPPDEFS "-DHAVE_ADIOS")
endif()
endif()

if (DEBUG)
list(APPEND CPPDEFS "-DMPAS_DEBUG")
endif()
Expand Down
15 changes: 1 addition & 14 deletions components/mpas-framework/src/framework/mpas_io.F
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,13 @@ module mpas_io
integer, parameter :: PIO_REALKIND = PIO_DOUBLE
#endif

#ifdef USE_PIO2
integer, parameter :: MPAS_INT_FILLVAL = PIO_FILL_INT
character, parameter :: MPAS_CHAR_FILLVAL = achar(0) ! TODO: To be replaced with PIO_FILL_CHAR once PIO2 provides this variable
#else
integer, parameter :: MPAS_INT_FILLVAL = NF_FILL_INT
character, parameter :: MPAS_CHAR_FILLVAL = achar(NF_FILL_CHAR)
#endif
character, parameter :: MPAS_CHAR_FILLVAL = achar(PIO_FILL_CHAR)

#ifdef USE_PIO2
#ifdef SINGLE_PRECISION
real (kind=RKIND), parameter :: MPAS_REAL_FILLVAL = PIO_FILL_FLOAT
#else
real (kind=RKIND), parameter :: MPAS_REAL_FILLVAL = PIO_FILL_DOUBLE
#endif
#else
#ifdef SINGLE_PRECISION
real (kind=RKIND), parameter :: MPAS_REAL_FILLVAL = NF_FILL_FLOAT
#else
real (kind=RKIND), parameter :: MPAS_REAL_FILLVAL = NF_FILL_DOUBLE
#endif
#endif

interface MPAS_io_get_var
Expand Down
6 changes: 5 additions & 1 deletion share/build/buildlib.spio
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ def buildlib(bldroot, installpath, case):
# Compute cmake args
# Use old genf90 until "short" type is supported
cmake_opts = "-Wno-dev "
cmake_opts += f"-DGENF90_PATH={scorpio_src_dir}/src/genf90 "
if pio_version == 1:
cmake_opts += f"-DGENF90_PATH={scorpio_src_dir}/pio/bin "
else:
cmake_opts += f"-DGENF90_PATH={scorpio_src_dir}/src/genf90 "

if "ADIOS2_ROOT" in os.environ:
cmake_opts += "-DWITH_ADIOS2:BOOL=ON "
if debug:
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 @@ -669,8 +669,10 @@ subroutine shr_pio_getiotypefromname(typename, iotype, defaulttype)
iotype = pio_iotype_netcdf4p
else if ( typename .eq. 'NETCDF4C') then
iotype = pio_iotype_netcdf4c
#ifndef PIO1
else if ( typename .eq. 'ADIOS') then
iotype = pio_iotype_adios
#endif
else if ( typename .eq. 'NOTHING') then
iotype = defaulttype
else if ( typename .eq. 'DEFAULT') then
Expand Down

0 comments on commit 5d5f15c

Please sign in to comment.