forked from eth-cscs/DLA-Future
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
155 lines (130 loc) · 4.67 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#
# Distributed Linear Algebra with Future (DLAF)
#
# Copyright (c) 2018-2022, ETH Zurich
# All rights reserved.
#
# Please, refer to the LICENSE file in the root directory.
# SPDX-License-Identifier: BSD-3-Clause
#
cmake_minimum_required(VERSION 3.22)
project(DLAF VERSION 0.1.0)
# ---------------------------------------------------------------------------
# CMake configurations
# ---------------------------------------------------------------------------
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
include(CTest)
include(DLAF)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Build Type" FORCE)
endif()
include(CMakeDependentOption)
option(BUILD_SHARED_LIBS "Build shared libraries." OFF)
option(DLAF_WITH_MKL "Enable MKL as provider for LAPACK" OFF)
option(DLAF_WITH_CUDA "Enable CUDA support" OFF)
option(DLAF_WITH_HIP "Enable HIP support" OFF)
cmake_dependent_option(DLAF_WITH_CUDA_MPI_RDMA "Enable MPI CUDA RDMA" OFF "DLAF_WITH_CUDA" OFF)
option(DLAF_WITH_COVERAGE "Enable coverage" OFF)
option(DLAF_BUILD_MINIAPPS "Build miniapps" ON)
option(DLAF_BUILD_TESTING "Build tests" ON)
option(DLAF_BUILD_DOC "Build documentation" OFF)
option(DLAF_WITH_PRECOMPILED_HEADERS "Use precompiled headers." OFF)
# Add color to ninja output
if(CMAKE_GENERATOR MATCHES "Ninja")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_compile_options(-fdiagnostics-color=always)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_compile_options(-fcolor-diagnostics)
endif()
endif()
# ---------------------------------------------------------------------------
# Languages
# ---------------------------------------------------------------------------
# ----- C
enable_language(C)
# ----- CXX
enable_language(CXX)
# ---- CUDA/HIP
if (DLAF_WITH_CUDA AND DLAF_WITH_HIP)
message(FATAL_ERROR "DLAF_WITH_CUDA=ON and DLAF_WITH_HIP=ON. Only one of "
"them can be enabled at the same time.")
endif()
if (DLAF_WITH_CUDA)
if (NOT CMAKE_CUDA_ARCHITECTURES)
set(CMAKE_CUDA_ARCHITECTURES "60;70;80" CACHE STRING "Cuda architectures" FORCE)
endif()
enable_language(CUDA)
find_package(CUDALIBS REQUIRED)
set(DLAF_WITH_GPU ON)
elseif(DLAF_WITH_HIP)
set(CMAKE_HIP_EXTENSIONS OFF)
enable_language(HIP)
find_package(hipblas HINTS $ENV{HIPBLAS_ROOT} REQUIRED)
find_package(rocsolver HINTS $ENV{ROCSOLVER_ROOT} REQUIRED)
set(DLAF_WITH_GPU ON)
endif()
# ---------------------------------------------------------------------------
# Coverage
# ---------------------------------------------------------------------------
if(DLAF_WITH_COVERAGE)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_options(-O0 -fprofile-arcs -ftest-coverage)
add_link_options(-fprofile-arcs -ftest-coverage)
else()
message(FATAL_ERROR "Coverage can be enabled only for Debug builds")
endif()
endif()
# ---------------------------------------------------------------------------
# Libraries configuration
# ---------------------------------------------------------------------------
# ----- MPI
find_package(MPI REQUIRED)
# ----- LAPACK/SCALAPACK
if(DLAF_WITH_MKL)
find_package(MKL REQUIRED)
set(MKL_LAPACK_TARGET "mkl::mkl_intel_32bit_seq_dyn"
CACHE STRING "MKL LAPACK target (see FindMKL for details)"
)
# Note:
# If specified targets are found, "standardize" them
if(TARGET ${MKL_LAPACK_TARGET})
set(LAPACK_FOUND TRUE)
add_library(LAPACK::LAPACK INTERFACE IMPORTED GLOBAL)
target_link_libraries(LAPACK::LAPACK INTERFACE ${MKL_LAPACK_TARGET})
else()
message(FATAL_ERROR "${MKL_LAPACK_TARGET} as LAPACK target has not been found")
endif()
else()
find_package(LAPACK REQUIRED)
endif()
# ----- pika
find_package(pika 0.8.0 REQUIRED)
# ----- BLASPP/LAPACKPP
find_package(blaspp REQUIRED)
find_package(lapackpp REQUIRED)
# ----- UMPIRE
find_package(Umpire REQUIRED)
# ----- EXTERNAL
add_subdirectory(external)
# ---------------------------------------------------------------------------
# DLAF library
# ---------------------------------------------------------------------------
add_subdirectory(src)
# ---------------------------------------------------------------------------
# mini Apps
# ---------------------------------------------------------------------------
if(DLAF_BUILD_MINIAPPS)
add_subdirectory(miniapp)
endif()
# ---------------------------------------------------------------------------
# Test
# ---------------------------------------------------------------------------
if(DLAF_BUILD_TESTING)
add_subdirectory(test)
endif()
# ---------------------------------------------------------------------------
# Docs
# ---------------------------------------------------------------------------
if(DLAF_BUILD_DOC)
add_subdirectory(doc)
endif()