Skip to content

Commit

Permalink
Debug NVHPC GPU & Chemistry GPU fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
henryleberre committed Aug 12, 2024
1 parent 38cde06 commit 6e10be4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
17 changes: 9 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,25 @@ compiler (or a different version thereof), please:\n\
- Install the compiler or load its module. (e.g. module load gcc/10.1)\n\
- Set/Export the C, CXX, and FC environment variables. (e.g. 'export CC=gcc', \
'export CXX=g++', and 'export FC=gfortran'.\n\
- If using mfc.sh, delete the build/<code name> directory and try again. (e.g. 'rm -rf build/pre_process')\n")
- If using mfc.sh, delete the build/<code name> directory and try again. (e.g. 'rm -rf build/pre_process')")

if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
if (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 5)
message(FATAL_ERROR "${__err_msg}ERROR: GNU v5.0 or newer is required to build MFC.")
message(FATAL_ERROR "ERROR: GNU v5.0 or newer is required to build MFC.\n${__err_msg}")
endif()
if (MFC_OpenACC)
message(FATAL_ERROR "${__err_msg}ERROR: MFC with GPU processing is not currently compatible with GNU compilers. Please use NVIDIA or Cray compilers.")
message(FATAL_ERROR "ERROR: MFC with GPU processing is not currently compatible with GNU compilers. Please use NVIDIA or Cray compilers.\n${__err_msg}")
endif()
elseif ((CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC") OR (CMAKE_Fortran_COMPILER_ID STREQUAL "PGI"))
if (CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 21.7)
message(FATAL_ERROR "${__err_msg}ERROR: When using NVHPC, v21.7 or newer is required to build MFC.")
message(FATAL_ERROR "ERROR: When using NVHPC, v21.7 or newer is required to build MFC.\n${__err_msg}")
endif()
if ((CMAKE_BUILD_TYPE STREQUAL "Debug") AND MFC_OpenACC)
message(FATAL_ERROR "${__err_msg}ERROR: When using NVHPC, MFC with Debug and GPU options is unavailable.")

if ((CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 23.11) AND (CMAKE_BUILD_TYPE STREQUAL "Debug") AND MFC_OpenACC)
message(FATAL_ERROR "ERROR: When using NVHPC, MFC with Debug and GPU options requires NVHPC v23.11 or newer.\n${__err_msg}")
endif()
elseif (CMAKE_Fortran_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_C_COMPILER_ID STREQUAL "AppleClang")
message(FATAL_ERROR "${__err_msg}ERROR: MFC does not support the Apple Clang compilers. Please consult the documentation.")
message(FATAL_ERROR "ERROR: MFC does not support the Apple Clang compilers. Please consult the documentation.\n${__err_msg}")
endif()

# Fypp is required to build MFC. We try to locate it. The path to the binary is
Expand Down Expand Up @@ -188,7 +189,7 @@ elseif ((CMAKE_Fortran_COMPILER_ID STREQUAL "NVHPC") OR (CMAKE_Fortran_COMPILER_
endif()

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_options(-C -g -O0 -traceback -Mchkptr -Minform=inform -Mbounds)
add_compile_options(-C -g -O0 -traceback -Minform=inform -Mbounds)
endif()

if (DEFINED ENV{MFC_CUDA_CC})
Expand Down
4 changes: 3 additions & 1 deletion src/common/m_variables_conversion.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ contains
end if

#:else
!$acc loop seq
do i = 1, num_species
Y_rs(i) = rhoYks(i)/rho
end do
Expand Down Expand Up @@ -905,7 +906,7 @@ contains
end if
#:endif

!$acc parallel loop collapse(3) gang vector default(present) private(alpha_K, alpha_rho_K, Re_K, nRtmp, rho_K, gamma_K, pi_inf_K, qv_K, dyn_pres_K, R3tmp)
!$acc parallel loop collapse(3) gang vector default(present) private(alpha_K, alpha_rho_K, Re_K, nRtmp, rho_K, gamma_K, pi_inf_K, qv_K, dyn_pres_K, R3tmp, rhoyks)
do l = izb, ize
do k = iyb, iye
do j = ixb, ixe
Expand Down Expand Up @@ -993,6 +994,7 @@ contains
end do

if (chemistry) then
!$acc loop seq
do i = 1, num_species
rhoYks(i) = qK_cons_vf(chemxb + i - 1)%sf(j, k, l)
end do
Expand Down
2 changes: 1 addition & 1 deletion src/simulation/m_rhs.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ contains
end do
end do

!$acc parallel loop collapse(4) gang vector default(present)
!$acc parallel loop default(present)
do i = 1, sys_size
rhs_vf(i)%sf(:, :, :) = 0d0
end do
Expand Down

0 comments on commit 6e10be4

Please sign in to comment.