forked from ROCm/rccl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
124 lines (101 loc) · 3.81 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
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
################################################################################
#
# MIT License
#
# Copyright (c) 2017 - Present Advanced Micro Devices, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
################################################################################
cmake_minimum_required( VERSION 2.8.12 )
set(CMAKE_INSTALL_PREFIX "/opt/rocm" CACHE PATH "")
project ( rccl C CXX)
find_package(ROCM REQUIRED PATHS /opt/rocm)
include(ROCMInstallTargets)
include(ROCMPackageConfigHelpers)
include(ROCMSetupVersion)
include(ROCMInstallSymlinks)
include(ROCMCreatePackage)
rocm_setup_version(
VERSION 0.7.1
)
list(APPEND CMAKE_PREFIX_PATH /opt/rocm /opt/rocm/hip /opt/rocm/hcc)
find_package(hip REQUIRED)
link_libraries(-amdgpu-target=gfx803 -amdgpu-target=gfx900 -amdgpu-target=gfx906)
option( BUILD_SHARED_LIBS "Build as a shared library" ON )
# configure a header file to pass the CMake version settings to the source, and package the header files in the output archive
configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/inc/rccl-version.h.in" "${PROJECT_BINARY_DIR}/inc/rccl-version.h" )
add_library( rccl
src/rccl.cpp
src/rcclAllReduce.cpp
src/rcclBcast.cpp
src/rcclReduce.cpp
src/rcclTracker.cpp
src/rcclAllGather.cpp
src/rcclReduceScatter.cpp
)
if( TARGET hip::device )
target_link_libraries( rccl PRIVATE hip::device )
target_link_libraries( rccl INTERFACE hip::host )
else()
target_link_libraries( rccl PUBLIC hip::hip_hcc ${hcc_LIBRARIES} )
endif()
rocm_install_targets(
TARGETS rccl
PREFIX rccl
INCLUDE
${PROJECT_SOURCE_DIR}/inc
${PROJECT_BINARY_DIR}/inc
)
rocm_export_targets(
NAMESPACE roc::
PREFIX rccl
TARGETS rccl
DEPENDS hip
)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "hip_hcc")
set(CPACK_RPM_PACKAGE_REQUIRES "hip_hcc")
rocm_create_package(
NAME rccl
DESCRIPTION "AMD's multi-gpu MPI implementation"
MAINTAINER "Aditya Aturi <Aditya.Atluri@amd.com>"
LDCONFIG
)
rocm_install_symlink_subdir(rccl)
option(BUILD_DOC "Build Documentation" ON)
if(BUILD_DOC)
find_package(Doxygen)
if(DOXYGEN_FOUND)
set(BUILD_DOC_DIR ${PROJECT_BINARY_DIR}/docs)
if(NOT EXISTS ${BUILD_DOC_DIR})
file(MAKE_DIRECTORY ${BUILD_DOC_DIR})
endif()
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile)
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
message("Doxygen build started")
add_custom_target(Doxygen ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM)
else(DOXYGEN_FOUND)
message("Doxygen needs to be installed to generate the documentation")
endif(DOXYGEN_FOUND)
endif(BUILD_DOC)