-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
38 lines (31 loc) · 1.16 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
cmake_minimum_required (VERSION 3.12)
project(matvec
LANGUAGES C CXX
)
# don't allow in-source builds
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(STATUS "Warning! Building from the source directory is not allow")
message(STATUS "Remove 'CMakeCache.txt' and 'CMakeFiles' and build from a separate directory")
message(ERROR "In-source build")
endif()
SET(MyTarget test_snap)
FILE(GLOB sources
${CMAKE_SOURCE_DIR}/src/*.cpp
${CMAKE_SOURCE_DIR}/src/*.h
)
ADD_EXECUTABLE(
${MyTarget}
${sources}
)
target_compile_definitions(${MyTarget} PRIVATE REFDATA_TWOJ=${ref_data})
### NVIDIA GPU ###
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "NVHPC")
find_package(CUDA REQUIRED)
add_subdirectory(NVTX/c)
set(CMAKE_CXX_FLAGS "-O3 -Wall -gpu=cc80 -stdpar=gpu -gpu=mem:unified -std=c++20") #-g -gpu=debug") # -Minfo")
target_link_libraries(${MyTarget} PRIVATE nvtx3-cpp) # use nvtx tool
endif()
### AMD GPU ###
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "HIP")
set(CMAKE_CXX_FLAGS "-O3 -Wall -std=c++17 --hipstdpar --hipstdpar-path=/home/gp.sc.cc.tohoku.ac.jp/joanna/research/himeno/stdpar/roc-stdpar/include --offload-arch=gfx90a:xnack+")
endif()