-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
71 lines (65 loc) · 2.17 KB
/
Copy pathCMakeLists.txt
File metadata and controls
71 lines (65 loc) · 2.17 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
cmake_minimum_required(VERSION 3.21)
project(tensor_engine LANGUAGES CXX)
# 尝试启用CUDA
include(CheckLanguage)
check_language(CUDA)
set(CMAKE_CUDA_ARCHITECTURES 75)
if(CMAKE_CUDA_COMPILER)
file(GLOB_RECURSE CPP_LIST "${PROJECT_SOURCE_DIR}/src/*.cpp")
set_source_files_properties(
${CPP_LIST}
main.cpp
PROPERTIES LANGUAGE CUDA
)
add_definitions(-DUSE_CUDA)
enable_language(CUDA)
message(STATUS "CUDA detected: ${CMAKE_CUDA_COMPILER}")
else()
message(STATUS "CUDA NOT FOUND, building without CUDA support.")
endif()
set(CMAKE_CXX_STANDARD 20)
#file(GLOB_RECURSE HEADER_LIST "${PROJECT_SOURCE_DIR}/include/*.h")
#
#set(HEADER_TEST_TARGETS "")
#
#foreach(header_file ${HEADER_LIST})
# get_filename_component(header_name ${header_file} NAME_WE)
# set(test_src "${CMAKE_BINARY_DIR}/test_header_${header_name}.cpp")
# file(WRITE ${test_src} "#include \"${header_file}\"\n")
# add_library(test_header_${header_name} STATIC ${test_src})
# list(APPEND HEADER_TEST_TARGETS test_header_${header_name})
#endforeach()
# 定义一个伪目标,执行这句可以检测所有头文件
#add_custom_target(check_headers ALL DEPENDS ${HEADER_TEST_TARGETS})
#add_compile_options(-Wall -Wextra -pedantic)
add_executable(tensor_engine main.cpp
include/parser.h
include/graph.h
include/memory.h
include/engine.h
include/tensor.h
include/device.h
include/type.h
src/parser/onnx_parser.cpp
include/config.h
src/test/config.cpp
include/operator.h
include/enum.h
src/execution/engine.cpp
include/util.h
src/util/util.cpp
src/graph/graph.cpp
src/device/device.cpp
src/util/logger.cpp
src/kernels/operator.cpp
src/kernels/gpu/add_fp16.cu
include/kernel/cuda/mm.cuh
include/kernel/cuda/mma.cuh
include/kernel/cuda/relu.cuh
include/kernel/cpu/simple_operator.tpp
include/kernel/cuda/add.cuh
src/kernels/gpu/mm_fp16.cu
src/kernels/gpu/relu_fp16.cu
src/kernels/gpu/mma_fp16.cu
src/graph/tensor.cpp
src/device/CUDADevice.cu)