-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from arcaneframework/dev/gg-handle-hip-tests
Use the right accelerator runtime for GPU tests.
- Loading branch information
Showing
3 changed files
with
53 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
unset(ARCANE_ACCELERATOR_RUNTIME) | ||
if(ARCANE_HAS_ACCELERATOR) | ||
if(ARCANE_HAS_CUDA) | ||
message(STATUS "Arcane has been compiled with CUDA.") | ||
set(ARCANE_ACCELERATOR_RUNTIME "cuda") | ||
endif() | ||
if(ARCANE_HAS_HIP) | ||
message(STATUS "Arcane has been compiled with ROCM/HIP.") | ||
set(ARCANE_ACCELERATOR_RUNTIME "hip") | ||
endif() | ||
endif() | ||
|
||
# ---------------------------------------------------------------------------- | ||
# Usage: | ||
# | ||
# arcanefem_add_gpu_test(NAME test_name [NB_MPI n] COMMAND exe_fileARGS exe_args) | ||
# | ||
macro(arcanefem_add_gpu_test) | ||
set(options NB_MPI) | ||
set(oneValueArgs NAME COMMAND) | ||
set(multiValueArgs ARGS) | ||
cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) | ||
if (NOT ARGS_NAME) | ||
message(FATAL_ERROR "No arg NAME for macro 'arcanefem_add_gpu_test'") | ||
endif() | ||
if (NOT ARGS_COMMAND) | ||
message(FATAL_ERROR "No arg COMMAND for macro 'arcanefem_add_gpu_test'") | ||
endif() | ||
if(ARCANE_HAS_ACCELERATOR) | ||
set(_RUNTIME_ARGS "-A,AcceleratorRuntime=${ARCANE_ACCELERATOR_RUNTIME}") | ||
if (ARGS_NB_MPI) | ||
if (MPIEXEC_EXECUTABLE) | ||
add_test(NAME ${ARGS_NAME} COMMAND ${MPIEXEC_EXECUTABLE} -n ${ARGS_NB_MPI} ${ARGS_COMMAND} ${_RUNTIME_ARGS} ${ARGS_ARGS}) | ||
endif() | ||
else() | ||
add_test(NAME ${ARGS_NAME} COMMAND ${ARGS_COMMAND} ${_RUNTIME_ARGS} ${ARGS_ARGS}) | ||
endif() | ||
endif() | ||
endmacro() | ||
|
||
# ---------------------------------------------------------------------------- | ||
# Local Variables: | ||
# tab-width: 2 | ||
# indent-tabs-mode: nil | ||
# coding: utf-8-with-signature | ||
# End: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters