-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
executable file
·71 lines (55 loc) · 1.92 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
69
70
71
# Copyright 2023. All Rights Reserved.
# Author: Bruce-Lee-LY
# Date: 20:42:28 on Sun, Feb 12, 2023
#
# Description: cmake for cuda back2back hgemm
cmake_minimum_required (VERSION 3.12)
project (cuda_back2back_hgemm LANGUAGES C CXX CUDA)
set (CMAKE_VERBOSE_MAKEFILE ${HGEMM_VERBOSE_MAKEFILE})
set (CMAKE_C_FLAGS "-std=c11")
set (CMAKE_C_FLAGS_DEBUG "$ENV{CFLAGS} -O0 -g2 -ggdb")
set (CMAKE_C_FLAGS_RELEASE "$ENV{CFLAGS} -O3")
set (CMAKE_CXX_FLAGS "-std=c++11")
set (CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -g2 -ggdb")
set (CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3")
set (CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
add_compile_options (
-Wall
-Werror
-Wextra
-Wswitch-default
-Wfloat-equal
-Wshadow
-Wcast-qual
)
# Nvidia GPU
find_package (CUDA REQUIRED)
unset (CUDA_USE_STATIC_CUDA_RUNTIME CACHE)
option (CUDA_USE_STATIC_CUDA_RUNTIME OFF)
set (CUDA_VERBOSE_BUILD ${HGEMM_VERBOSE_MAKEFILE})
set (CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -std=c++11 -Xptxas=-v -Xcompiler -fopenmp")
if (${CMAKE_BUILD_TYPE} MATCHES "Debug")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -arch=sm_${CMAKE_CUDA_ARCHITECTURES} -g -lineinfo -O0")
else ()
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -gencode arch=compute_${CMAKE_CUDA_ARCHITECTURES},code=sm_${CMAKE_CUDA_ARCHITECTURES} --use_fast_math -O3")
endif ()
set (SYS_CUDART_PATH "/usr/local/cuda")
set (SYS_CUDA_DRIVER_PATH "/usr/lib/x86_64-linux-gnu")
find_package(gflags REQUIRED)
find_package(OpenMP REQUIRED)
include_directories (
${PROJECT_SOURCE_DIR}/src/common
${SYS_CUDART_PATH}/include
${GFLAGS_INCLUDE_DIR}
)
link_directories (
${SYS_CUDART_PATH}/lib64
${SYS_CUDA_DRIVER_PATH}
)
file (GLOB B2B_HGEMM_SRCS
${PROJECT_SOURCE_DIR}/src/*.cu
${PROJECT_SOURCE_DIR}/src/mma/*.cu
)
cuda_add_executable (b2b_hgemm ${B2B_HGEMM_SRCS})
target_link_libraries (b2b_hgemm -lcublas OpenMP::OpenMP_CXX ${GFLAGS_LIBRARIES})
install (TARGETS b2b_hgemm RUNTIME DESTINATION bin)