-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
68 lines (46 loc) · 1.79 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
cmake_minimum_required(VERSION 3.10)
# Set the project name and specify C++ standard
project(AMG_EVAL LANGUAGES CXX CUDA)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# ---- Ginkgo
# Add the Ginkgo library (adjust the path to the installed Ginkgo)
set(GINKGO_DIR "${CMAKE_SOURCE_DIR}/lib/ginkgo/build/install")
# Add the Ginkgo library include and library paths
find_package(Ginkgo REQUIRED HINTS ${GINKGO_DIR})
# Add an executable target for the ginkgo_eval file
add_executable(ginkgo_eval ginkgo_eval.cpp)
# Include the Ginkgo header files
target_include_directories(ginkgo_eval PRIVATE ${GINKGO_DIR}/include)
# Include mynvtx header file directory
target_include_directories(ginkgo_eval PRIVATE ${CMAKE_SOURCE_DIR}/lib/mynvtx)
# Link the Ginkgo library to the executable
target_link_libraries(ginkgo_eval PRIVATE Ginkgo::ginkgo)
# ---- AMGX
# Point CMake to AMGX headers
include_directories("${CMAKE_SOURCE_DIR}/lib/AMGX/include")
# Point CMake to AMGX libraries
link_directories("${CMAKE_SOURCE_DIR}/lib/AMGX/build")
# Create the executable from your source file
add_executable(AMGX_eval AMGX_eval.cpp)
# Link against the AMGX shared library (AMGXsh).
# If your library name differs, adjust accordingly (e.g., AMGX, libAMGXsh, etc.).
target_link_libraries(AMGX_eval amgxsh)
# ---- amgcl-cuda
# Tell CMake that we need CUDA language:
enable_language(CUDA)
find_package(CUDAToolkit REQUIRED)
# E.g. for Volta (sm_70) or Turing (sm_75) or Ampere (sm_80) etc.
set(CMAKE_CUDA_ARCHITECTURES 70 75 80) # or just "75", etc.
add_subdirectory(lib/amgcl)
set_source_files_properties(
amgcl_cuda_eval.cpp
PROPERTIES
LANGUAGE CUDA
)
add_executable(amgcl_cuda_eval amgcl_cuda_eval.cpp)
target_link_libraries(amgcl_cuda_eval
PRIVATE
amgcl::amgcl
CUDA::cusparse
)