-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
57 lines (43 loc) · 1.82 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
cmake_minimum_required(VERSION 3.25 FATAL_ERROR)
set (CMAKE_CXX_STANDARD 20)
project(nvshmem-db LANGUAGES CXX CUDA)
find_package(CUDAToolkit 12.0)
set(CUDA_TOOLKIT_ROOT_DIR /usr/local/cuda-12)
set(CUDA_INCLUDE_DIR ${CUDA_TOOLKIT_ROOT_DIR}/include)
set(NVSHMEM_PREFIX /opt/nvshmem)
set(NVSHMEM_INCLUDE_DIR ${NVSHMEM_PREFIX}/include)
set(CMAKE_CUDA_COMPILER ${CUDA_TOOLKIT_ROOT_DIR}/bin/nvcc)
set(CMAKE_CUDA_ARCHITECTURES 70)
MESSAGE("env:CUDA_PATH = '$ENV{CUDA_PATH}'")
MESSAGE("env:PATH = '$ENV{PATH}'")
MESSAGE("env:LD_LIBRARY_PATH = '$ENV{LD_LIBRARY_PATH}'")
MESSAGE("env:LIBRARY_PATH = '$ENV{LIBRARY_PATH}'")
MESSAGE("CUDA_INCLUDE_DIR = ${CUDA_INCLUDE_DIR}")
MESSAGE("NVSHMEM_INCLUDE_DIR = ${NVSHMEM_INCLUDE_DIR}")
if (NOT DEFINED CMAKE_CUDA_STANDARD)
set(CMAKE_CUDA_STANDARD 20)
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
endif ()
link_directories(${NVSHMEM_PREFIX}/lib)
find_package(NVSHMEM REQUIRED HINTS ${NVSHMEM_PREFIX}/lib/cmake/nvshmem)
add_library(nvshmem ALIAS nvshmem::nvshmem)
# add include directory to all subdirectories recursively
include_directories(inc
librdmapp/rdmapp
${NVSHMEM_INCLUDE_DIR}
${CUDA_INCLUDE_DIR})
add_subdirectory(src)
add_subdirectory(librdmapp)
# Only build tests and benchmarks if this is the top level cmake file i.e. we build this stand alone without user code
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
enable_testing()
add_subdirectory(test/src)
add_subdirectory(benchmarks)
endif ()
if (${CMAKE_BUILD_TYPE} STREQUAL "Debug")
MESSAGE("Setting debug build options.")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -ggdb -DDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -ggdb -DDEBUG -Wall -Wextra -Wconversion")
add_compile_options( "$<$<AND:$<CONFIG:Debug>,$<COMPILE_LANGUAGE:CUDA>>:-src-in-ptx;-lineinfo;-G>")
add_compile_definitions(-DDEBUG)
endif ()