Skip to content

Commit

Permalink
Set NVHPC maximum optimization level to -O1 for now
Browse files Browse the repository at this point in the history
Compiling HDF5 with NVHPC 23.5 - 23.9 results in test failures in
4 different test files that need to be resolved. Since those tests
pass with an optimization level of -O1 (and -O0) and it is currently
unclear whether the test failures are due to issues in HDF5 or issues
in the 'nvc' compiler, set the maximum optimization level for NVHPC
to -O1 until the test failures are resolved.
  • Loading branch information
jhendersonHDF committed Oct 31, 2023
1 parent 39c0284 commit cea46a0
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 7 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/nvhpc-cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ jobs:
working-directory: ${{ runner.workspace }}/build

# RUN TESTS
# - name: CMake Run Tests
# shell: bash
# run: |
# ctest . --parallel 2 -C ${{ inputs.build_mode }} -V
# working-directory: ${{ runner.workspace }}/build
- name: CMake Run Tests
shell: bash
run: |
ctest . --parallel 2 -C ${{ inputs.build_mode }} -V
working-directory: ${{ runner.workspace }}/build
38 changes: 38 additions & 0 deletions config/cmake/HDFCompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,44 @@ if (CMAKE_C_COMPILER_ID STREQUAL "NVHPC" )
else ()
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Mbounds -g")
endif ()

# With at least NVHPC 23.5 - 23.9, compiling with -O2 or higher and -DNDEBUG
# appears to have issues that manifest in the tests as incorrect metadata
# checksums being read or memory being corrupted. Compiling without -DNDEBUG
# does not appear to have these issues, but is not ideal due to compiling in
# asserts and other library debug code. Compiling with -O1 also does not appear
# to have these issues, so set maximum optimization level to -O1 for now until
# it can be determined whether these issues are compiler-specific or issues
# in the library.
set (cmake_c_flags_minsizerel_edited "${CMAKE_C_FLAGS_MINSIZEREL}")
string (REPLACE "-O2" "" cmake_c_flags_minsizerel_edited "${cmake_c_flags_minsizerel_edited}")
string (REPLACE "-O3" "" cmake_c_flags_minsizerel_edited "${cmake_c_flags_minsizerel_edited}")
string (REPLACE "-O4" "" cmake_c_flags_minsizerel_edited "${cmake_c_flags_minsizerel_edited}")
string (REPLACE "-Ofast" "" cmake_c_flags_minsizerel_edited "${cmake_c_flags_minsizerel_edited}")
string (REPLACE "-fast" "" cmake_c_flags_minsizerel_edited "${cmake_c_flags_minsizerel_edited}")
string (STRIP "${cmake_c_flags_minsizerel_edited}" cmake_c_flags_minsizerel_edited)
string (PREPEND cmake_c_flags_minsizerel_edited "-O1 ")
set (CMAKE_C_FLAGS_MINSIZEREL "${cmake_c_flags_minsizerel_edited}")

set (cmake_c_flags_release_edited "${CMAKE_C_FLAGS_RELEASE}")
string (REPLACE "-O2" "" cmake_c_flags_release_edited "${cmake_c_flags_release_edited}")
string (REPLACE "-O3" "" cmake_c_flags_release_edited "${cmake_c_flags_release_edited}")
string (REPLACE "-O4" "" cmake_c_flags_release_edited "${cmake_c_flags_release_edited}")
string (REPLACE "-Ofast" "" cmake_c_flags_release_edited "${cmake_c_flags_release_edited}")
string (REPLACE "-fast" "" cmake_c_flags_release_edited "${cmake_c_flags_release_edited}")
string (STRIP "${cmake_c_flags_release_edited}" cmake_c_flags_release_edited)
string (PREPEND cmake_c_flags_release_edited "-O1 ")
set (CMAKE_C_FLAGS_RELEASE "${cmake_c_flags_release_edited}")

set (cmake_c_flags_relwithdebinfo_edited "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
string (REPLACE "-O2" "" cmake_c_flags_relwithdebinfo_edited "${cmake_c_flags_relwithdebinfo_edited}")
string (REPLACE "-O3" "" cmake_c_flags_relwithdebinfo_edited "${cmake_c_flags_relwithdebinfo_edited}")
string (REPLACE "-O4" "" cmake_c_flags_relwithdebinfo_edited "${cmake_c_flags_relwithdebinfo_edited}")
string (REPLACE "-Ofast" "" cmake_c_flags_relwithdebinfo_edited "${cmake_c_flags_relwithdebinfo_edited}")
string (REPLACE "-fast" "" cmake_c_flags_relwithdebinfo_edited "${cmake_c_flags_relwithdebinfo_edited}")
string (STRIP "${cmake_c_flags_relwithdebinfo_edited}" cmake_c_flags_relwithdebinfo_edited)
string (PREPEND cmake_c_flags_relwithdebinfo_edited "-O1 ")
set (CMAKE_C_FLAGS_RELWITHDEBINFO "${cmake_c_flags_relwithdebinfo_edited}")
endif ()

if (CMAKE_COMPILER_IS_GNUCC)
Expand Down
6 changes: 4 additions & 2 deletions config/nvidia-flags
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ if test "X-nvc" = "X-$cc_vendor" -o "X-nvcc" = "X-$cc_vendor"; then
##############

# NDEBUG is handled explicitly by the configure script
PROD_CFLAGS="-fast"
#PROD_CFLAGS="-fast"
PROD_CFLAGS="" # -fast implies -O2 and -O2+ currently has test failures.

#########
# Debug #
Expand Down Expand Up @@ -106,7 +107,8 @@ if test "X-nvc" = "X-$cc_vendor" -o "X-nvcc" = "X-$cc_vendor"; then
################

HIGH_OPT_CFLAGS="-O1" # -O2+ currently has test failures.
DEBUG_OPT_CFLAGS="-gopt -O2"
#DEBUG_OPT_CFLAGS="-gopt -O2"
DEBUG_OPT_CFLAGS="-gopt -O1" # -O2+ currently has test failures.
NO_OPT_CFLAGS="-O0"

#################
Expand Down
14 changes: 14 additions & 0 deletions release_docs/RELEASE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1158,6 +1158,20 @@ Platforms Tested
Known Problems
==============

When HDF5 is compiled with NVHPC versions 23.5 - 23.9 (additional versions may
also be applicable) and with -O2 (or higher) and -DNDEBUG, test failures occur
in the following tests:

H5PLUGIN-filter_plugin
H5TEST-flush2
H5TEST-testhdf5-base
MPI_TEST_t_filters_parallel

Since these tests pass with an optimization level of -O1 (and -O0) and it is
currently unclear whether the test failures are due to issues in HDF5 or issues
in the 'nvc' compiler, the maximum optimization level for NVHPC has been set
to -O1 until the test failures can be resolved.

IEEE standard arithmetic enables software to raise exceptions such as overflow,
division by zero, and other illegal operations without interrupting or halting
the program flow. The HDF5 C library intentionally performs these exceptions.
Expand Down

0 comments on commit cea46a0

Please sign in to comment.