diff --git a/cmake/MFCTargets.cmake b/cmake/MFCTargets.cmake index 20b1a2dfd..07b9cdb16 100644 --- a/cmake/MFCTargets.cmake +++ b/cmake/MFCTargets.cmake @@ -23,7 +23,7 @@ function(MFC_SETUP_TARGET) set(IPO_TARGETS ${ARGS_TARGET}) # Here we need to split into "library" and "executable" to perform IPO on the NVIDIA compiler. # A little hacky, but it *is* an edge-case for *one* compiler. - if (NVHPC_USE_TWO_PASS_IPO AND NOT(MFC_OpenMP AND ARGS_OpenMP)) + if (NVHPC_USE_TWO_PASS_IPO) # nvfortran -Mextract does not produce .o files, only inline library # data. An OBJECT library with -Mextract causes CMake to rebuild # everything on every build because the expected .o outputs never @@ -70,7 +70,14 @@ exit 0 # six-equation relaxation kernel silently drops the # internal-energy update, leaving alpha and # alpha_rho correct and int_en zero. - foreach(_no_inline_file m_start_up m_cbc m_pressure_relaxation) + set(_no_inline_files m_start_up m_cbc m_pressure_relaxation) + # OpenMP offload additionally segfaults fort2 (signal 11) inlining into + # m_data_output, which OpenACC compiles cleanly. Scoped so the OpenACC + # build keeps full inlining there. + if (MFC_OpenMP AND ARGS_OpenMP) + list(APPEND _no_inline_files m_data_output) + endif() + foreach(_no_inline_file ${_no_inline_files}) set_source_files_properties( "${CMAKE_BINARY_DIR}/fypp/${ARGS_TARGET}/${_no_inline_file}.fpp.f90" TARGET_DIRECTORY ${ARGS_TARGET}