-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
129 lines (110 loc) · 3.35 KB
/
CMakeLists.txt
File metadata and controls
129 lines (110 loc) · 3.35 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
cmake_minimum_required(VERSION 3.24)
project(HPC-AI-Optimization-Lab LANGUAGES CXX CUDA)
# C++20 and CUDA standards
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CUDA_STANDARD 20)
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
# Export compile commands for IDE support
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# CUDA settings
set(CMAKE_CUDA_SEPARABLE_COMPILATION ON)
# Auto-detect GPU architecture (CMake 3.24+ supports 'native')
if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
set(CMAKE_CUDA_ARCHITECTURES native)
message(STATUS "Using native CUDA architecture detection")
endif()
# FetchContent for dependencies
include(FetchContent)
# GoogleTest
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG v1.14.0
)
# fmt library
FetchContent_Declare(
fmt
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
GIT_TAG 10.2.1
)
# RapidCheck for property-based testing
FetchContent_Declare(
rapidcheck
GIT_REPOSITORY https://github.com/emil-e/rapidcheck.git
GIT_TAG ff6af6fc683159deb51c543b065eba14dfcf329b
)
FetchContent_MakeAvailable(googletest fmt rapidcheck)
# CUTLASS (header-only)
FetchContent_Declare(
cutlass
GIT_REPOSITORY https://github.com/NVIDIA/cutlass.git
GIT_TAG v3.5.0
)
FetchContent_GetProperties(cutlass)
if(NOT cutlass_POPULATED)
FetchContent_Populate(cutlass)
endif()
# Nanobind (optional, for Python bindings)
option(BUILD_PYTHON_BINDINGS "Build Python bindings" OFF)
option(BUILD_EXAMPLES "Build example programs" OFF)
if(BUILD_PYTHON_BINDINGS)
find_package(Python 3.8 COMPONENTS Interpreter Development.Module REQUIRED)
FetchContent_Declare(
nanobind
GIT_REPOSITORY https://github.com/wjakob/nanobind.git
GIT_TAG v2.0.0
)
FetchContent_MakeAvailable(nanobind)
endif()
# Common library (header-only)
add_library(hpc_common INTERFACE)
target_include_directories(hpc_common INTERFACE
${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/src/common
${cutlass_SOURCE_DIR}/include
)
target_link_libraries(hpc_common INTERFACE fmt::fmt)
# CUDA compile options
function(hpc_add_cuda_library target)
add_library(${target} ${ARGN})
target_link_libraries(${target} PUBLIC hpc_common)
target_compile_options(${target} PRIVATE
$<$<COMPILE_LANGUAGE:CUDA>:
--expt-relaxed-constexpr
--extended-lambda
-Xcompiler=-Wall
>
)
set_target_properties(${target} PROPERTIES
CUDA_SEPARABLE_COMPILATION ON
POSITION_INDEPENDENT_CODE ON
)
endfunction()
# Kernel modules
add_subdirectory(src/elementwise)
add_subdirectory(src/reduction)
add_subdirectory(src/gemm)
add_subdirectory(src/convolution)
add_subdirectory(src/attention)
add_subdirectory(src/quantization)
add_subdirectory(src/cuda13)
# Python bindings
if(BUILD_PYTHON_BINDINGS)
add_subdirectory(python)
endif()
# Examples
if(BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
# Tests
enable_testing()
add_subdirectory(tests)
# Summary
message(STATUS "")
message(STATUS "=== HPC-AI-Optimization-Lab Configuration ===")
message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}")
message(STATUS "CUDA Standard: ${CMAKE_CUDA_STANDARD}")
message(STATUS "CUDA Architectures: ${CMAKE_CUDA_ARCHITECTURES}")
message(STATUS "Python Bindings: ${BUILD_PYTHON_BINDINGS}")
message(STATUS "==============================================")