-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b46fbb3
commit 414f528
Showing
7 changed files
with
124 additions
and
25 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,7 @@ | ||
|
||
if (ENABLE_CUDA OR ENABLE_HIP OR ENABLE_SYCL) | ||
add_subdirectory(GPU) | ||
else() | ||
add_subdirectory(Parser) | ||
add_subdirectory(Parser2) | ||
endif() |
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,19 @@ | ||
add_executable(test_gpu main.cpp) | ||
|
||
target_link_libraries(test_gpu PRIVATE amrexpr) | ||
|
||
target_include_directories(test_gpu PRIVATE | ||
$<TARGET_PROPERTY:amrexpr,INTERFACE_INCLUDE_DIRECTORIES> | ||
) | ||
|
||
target_compile_features(test_gpu PRIVATE cxx_std_17) | ||
|
||
if (ENABLE_CUDA) | ||
set_source_files_properties(main.cpp PROPERTIES LANGUAGE CUDA) | ||
set_target_properties(test_gpu PROPERTIES | ||
CUDA_SEPARABLE_COMPILATION ON | ||
) | ||
target_compile_options(test_gpu PRIVATE $<TARGET_PROPERTY:amrexpr>) | ||
endif() | ||
|
||
add_test(NAME test_gpu COMMAND test_gpu) |
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,11 @@ | ||
add_executable(test_parser main.cpp) | ||
|
||
target_link_libraries(test_parser PRIVATE amrexpr) | ||
|
||
target_include_directories(test_parser PRIVATE | ||
$<TARGET_PROPERTY:amrexpr,INTERFACE_INCLUDE_DIRECTORIES> | ||
) | ||
|
||
target_compile_features(test_parser PRIVATE cxx_std_17) | ||
|
||
add_test(NAME test_parser COMMAND test_parser) |
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,18 @@ | ||
add_executable(test_parser2 main.cpp fn.cpp) | ||
|
||
set(TEST_PARSER2_WORK_DIRECTORY $<TARGET_FILE_DIR:test_parser2>) | ||
add_custom_command(TARGET test_parser2 PRE_BUILD | ||
COMMAND ${CMAKE_COMMAND} -E copy_if_different | ||
${CMAKE_CURRENT_SOURCE_DIR}/fn.cpp | ||
${TEST_PARSER2_WORK_DIRECTORY}/fn.cpp | ||
) | ||
|
||
target_link_libraries(test_parser2 PRIVATE amrexpr) | ||
|
||
target_include_directories(test_parser2 PRIVATE | ||
$<TARGET_PROPERTY:amrexpr,INTERFACE_INCLUDE_DIRECTORIES> | ||
) | ||
|
||
target_compile_features(test_parser2 PRIVATE cxx_std_17) | ||
|
||
add_test(NAME test_parser2 COMMAND test_parser2) |
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,51 @@ | ||
cmake_minimum_required(VERSION 3.24) | ||
|
||
option(ENABLE_CUDA "Enable CUDA support" OFF) | ||
option(ENABLE_HIP "Enable HIP support" OFF) | ||
option(ENABLE_SYCL "Enable SYCL support" OFF) | ||
|
||
if (ENABLE_CUDA) | ||
set(PROJECT_LANGUAGES CXX CUDA) | ||
elseif (ENABLE_HIP) | ||
set(PROJECT_LANGUAGES CXX HIP) | ||
else() | ||
set(PROJECT_LANGUAGES CXX) | ||
endif() | ||
|
||
project(amrexpr_test LANGUAGES ${PROJECT_LANGUAGES}) | ||
|
||
if (NOT CMAKE_BUILD_TYPE) | ||
set(CMAKE_CONFIGURATION_TYPES "Release;Debug;MinSizeRel;RelWithDebInfo") | ||
set(CMAKE_BUILD_TYPE Release | ||
CACHE STRING | ||
"Choose the build type, e.g. Release, Debug, or RelWithDebInfo." FORCE) | ||
endif() | ||
|
||
if (ENABLE_CUDA) | ||
find_package(CUDAToolkit REQUIRED) | ||
endif() | ||
|
||
if (ENABLE_HIP) | ||
find_package(hip REQUIRED) | ||
endif() | ||
|
||
if (ENABLE_SYCL) | ||
set(CMAKE_CXX_COMPILER icpx) | ||
endif() | ||
|
||
find_package(amrexpr REQUIRED) | ||
|
||
add_executable(parser_test main.cpp) | ||
|
||
if (ENABLE_CUDA) | ||
set_source_files_properties(main.cpp PROPERTIES LANGUAGE CUDA) | ||
if (NOT DEFINED CUDA_ARCHITECTURES) | ||
message(STATUS "No CUDA architectures specified. Native will be used.") | ||
set_target_properties(parser_test PROPERTIES CUDA_ARCHITECTURES native) | ||
endif() | ||
set_target_properties(parser_test PROPERTIES | ||
CUDA_SEPARABLE_COMPILATION ON | ||
) | ||
endif() | ||
|
||
target_link_libraries(parser_test PRIVATE amrexpr::amrexpr) |