Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable CUDA in CMakeList.txt for Spack smoke test. #2581

Merged
merged 1 commit into from
Jan 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 46 additions & 28 deletions Tests/SpackSmokeTest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,43 +17,61 @@ set(_src_dir ${_base_dir}/Source)
set(_input_dir ${_base_dir}/Exec)


# Use installed version of AMReX
find_package(AMReX REQUIRED)
if (AMReX_GPU_BACKEND STREQUAL "CUDA")
enable_language(CUDA)
find_package(AMReX REQUIRED CUDA)
else()
# Use installed version of AMReX
find_package(AMReX REQUIRED)
endif()

if (AMReX_3D_FOUND)
set(_dim 3)
set(_dim 3)
elseif (AMReX_2D_FOUND)
set(_dim 2)
set(_dim 2)
else ()
message(FATAL_ERROR "Cannot find a 2D or 3D version of AMReX")
message(FATAL_ERROR "Cannot find a 2D or 3D version of AMReX")
endif ()


add_executable(install_test)

target_link_libraries(install_test PUBLIC AMReX::amrex)

target_include_directories(install_test
PUBLIC
${_src_dir}
${_src_dir}/Src_K/
${_input_dir}
)
PUBLIC
${_src_dir}
${_src_dir}/Src_K/
${_input_dir}
)

target_sources(install_test
PRIVATE
${_src_dir}/AdvancePhiAllLevels.cpp
${_src_dir}/AdvancePhiAtLevel.cpp
${_src_dir}/AmrCoreAdv.cpp
${_src_dir}/AmrCoreAdv.H
${_src_dir}/bc_fill.H
${_src_dir}/DefineVelocity.cpp
${_src_dir}/face_velocity.H
${_src_dir}/Kernels.H
${_src_dir}/main.cpp
${_src_dir}/Tagging.H
${_src_dir}/Src_K/Adv_K.H
${_src_dir}/Src_K/compute_flux_2D_K.H
${_src_dir}/Src_K/slope_K.H
${_input_dir}/Prob.H
)
PRIVATE
${_src_dir}/AdvancePhiAllLevels.cpp
${_src_dir}/AdvancePhiAtLevel.cpp
${_src_dir}/AmrCoreAdv.cpp
${_src_dir}/AmrCoreAdv.H
${_src_dir}/bc_fill.H
${_src_dir}/DefineVelocity.cpp
${_src_dir}/face_velocity.H
${_src_dir}/Kernels.H
${_src_dir}/main.cpp
${_src_dir}/Tagging.H
${_src_dir}/Src_K/Adv_K.H
${_src_dir}/Src_K/compute_flux_2D_K.H
${_src_dir}/Src_K/slope_K.H
${_input_dir}/Prob.H
)

target_link_libraries(install_test PUBLIC AMReX::amrex)


# Additional CUDA configuration commands
if (AMReX_GPU_BACKEND STREQUAL "CUDA")
set_target_properties(install_test PROPERTIES
LANGUAGE CUDA
CUDA_ARCHITECTURES "${AMREX_CUDA_ARCHS}"
CUDA_SEPARABLE_COMPILATION ON)

get_target_property(Source_Files install_test SOURCES)
list(FILTER Source_Files INCLUDE REGEX "\\.cpp$")
set_source_files_properties(${Source_Files} PROPERTIES LANGUAGE CUDA)
endif()