Skip to content

Commit 4d0f43b

Browse files
author
Albert-Jan Yzelman
committed
Bump to version 0.4
1 parent f5a158d commit 4d0f43b

File tree

198 files changed

+32220
-6973
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+32220
-6973
lines changed

.clang-format

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ AllowAllParametersOfDeclarationOnNextLine: false
3636
#AllowShortEnumsOnASingleLine: false
3737
AllowShortBlocksOnASingleLine: Empty
3838
AllowShortCaseLabelsOnASingleLine: false
39-
AllowShortFunctionsOnASingleLine: Empty
39+
AllowShortFunctionsOnASingleLine: Empty
4040
AllowShortIfStatementsOnASingleLine: Never
41-
AllowShortLambdasOnASingleLine: Empty
41+
AllowShortLambdasOnASingleLine: Empty
4242
AllowShortLoopsOnASingleLine: false
4343
AlwaysBreakAfterDefinitionReturnType: None
4444
AlwaysBreakAfterReturnType: None

CMakeLists.txt

Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
#
2+
# Copyright 2021 Huawei Technologies Co., Ltd.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
#[===================================================================[
18+
#
19+
# ROOT FILE FOR THE GraphBLAS project
20+
# content:
21+
# - project options and related logic
22+
# - dependencies checks
23+
# - definition of compilation options
24+
#
25+
#]===================================================================]
26+
27+
cmake_minimum_required( VERSION 3.13 )
28+
29+
set( MAJORVERSION 0 )
30+
set( MINORVERSION 4 )
31+
set( BUGVERSION 0 )
32+
set( VERSION "${MAJORVERSION}.${MINORVERSION}.${BUGVERSION}" )
33+
34+
# set the project name
35+
project( GraphBLAS
36+
VERSION ${VERSION}
37+
DESCRIPTION "The ultimate engine for sparse computation"
38+
LANGUAGES CXX C
39+
)
40+
set( CMAKE_CXX_STANDARD 11 )
41+
set( CMAKE_CXX_STANDARD_REQUIRED ON )
42+
43+
# install within the build directory by default (NOT to /usr/local or the likes)
44+
if( CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT )
45+
set( CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "default install path" FORCE )
46+
message( STATUS "setting install directory to ${CMAKE_INSTALL_PREFIX}" )
47+
endif()
48+
49+
50+
### CONFIGURATION OPTIONS
51+
# to choose backends and dependencies
52+
option( WITH_REFERENCE_BACKEND "With Reference backend" ON )
53+
option( WITH_OMP_BACKEND "With OMP backend" ON )
54+
option( WITH_NUMA "With NUMA support" ON )
55+
option( LPF_INSTALL_PATH "Path to the LPF tools for the BSP1D and Hybrid backends" OFF )
56+
# the following options depend on LPF_INSTALL_PATH being set
57+
include(CMakeDependentOption)
58+
cmake_dependent_option( WITH_BSP1D_BACKEND "Build the BSP1D backend (needs \
59+
LPF_INSTALL_PATH set)" ON LPF_INSTALL_PATH OFF
60+
)
61+
cmake_dependent_option( WITH_HYBRID_BACKEND "Also build the Hybrid backend \
62+
(needs LPF_INSTALL_PATH set)" ON LPF_INSTALL_PATH OFF
63+
)
64+
# to customize build flags for either backends or tests
65+
option( COMMON_COMPILE_DEFINITIONS
66+
"Compilation definitions for BOTH backends and tests; they override the defaults"
67+
OFF
68+
)
69+
option( COMMON_COMPILE_OPTIONS
70+
"Compilation options for BOTH backends and tests; they override the defaults"
71+
OFF
72+
)
73+
option( ADDITIONAL_BACKEND_DEFINITIONS
74+
"Compilation definitions added to default definitions (or common definitions, \
75+
if set) of backends only; they are ALWAYS APPENDED and never override the defaults"
76+
OFF
77+
)
78+
option( ADDITIONAL_BACKEND_OPTIONS
79+
"Compilation options added to default options (or common options, if set) of backends \
80+
only; they are ALWAYS APPENDED and never override the defaults" OFF
81+
)
82+
option( ADDITIONAL_TEST_DEFINITIONS
83+
"Compilation definitions added to default definitions (or common definitions, if set) \
84+
of tests only; they are ALWAYS APPENDED and never override the defaults" OFF
85+
)
86+
option( ADDITIONAL_TEST_OPTIONS
87+
"Compilation options added to default options (or common options, if set) of tests only; \
88+
they are ALWAYS APPENDED and never override the defaults" OFF
89+
)
90+
option( TEST_PERFORMANCE_DEFINITIONS
91+
"Compilation definitions for tests, for performance-related tunings; they override the \
92+
defaults" OFF
93+
)
94+
option( TEST_PERFORMANCE_OPTIONS
95+
"Compilation options for tests, for performance-related tunings; they override the defaults"
96+
OFF
97+
)
98+
99+
# to select the directories with the datasets: a value MUST be provided for DATASETS_DIR
100+
option( DATASETS_DIR "Directory with datasets for tests" )
101+
option( GNN_DATASET_PATH "Directory with the GraphChallengeDataset dataset" )
102+
103+
### CHECK THE OPTIONS ARE COHERENT
104+
list( APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" )
105+
include( Utils )
106+
107+
assert_valid_directory( DATASETS_DIR "${PROJECT_SOURCE_DIR}/datasets" )
108+
assert_valid_directory( GNN_DATASET_PATH "" ) # do NOT run GNN tests by default (slow!)
109+
110+
# check whether the user forced distributed backends without providing LPF
111+
if( NOT LPF_INSTALL_PATH AND
112+
( WITH_BSP1D_BACKEND OR WITH_HYBRID_BACKEND ) )
113+
message( SEND_ERROR "The BSP1D and Hybrid backends require LPF" )
114+
message( SEND_ERROR "Hence, you should set LPF_INSTALL_PATH" )
115+
message( FATAL_ERROR "or not enable WITH_BSP1D_BACKEND or WITH_HYBRID_BACKEND")
116+
endif()
117+
118+
if( NOT WITH_REFERENCE_BACKEND AND
119+
NOT WITH_OMP_BACKEND AND
120+
NOT WITH_BSP1D_BACKEND AND
121+
NOT WITH_HYBRID_BACKEND )
122+
message( FATAL_ERROR "At least one backend should be enabled")
123+
endif()
124+
125+
# set LPF_INSTALL_PATH as FILEPATH inside the cache
126+
if( LPF_INSTALL_PATH )
127+
set( LPF_INSTALL_PATH "${LPF_INSTALL_PATH}" CACHE FILEPATH "Path to LPF installation" FORCE )
128+
endif()
129+
130+
if( WITH_BSP1D_BACKEND OR WITH_HYBRID_BACKEND AND ( NOT WITH_NUMA ) )
131+
message( FATAL_ERROR "BSP1D and Hybrid backends require NUMA support" )
132+
endif()
133+
134+
### CHECK DEPENDENCIES
135+
136+
# always look for math and rt libraries
137+
find_package( LibM REQUIRED )
138+
find_library( LIBRT rt REQUIRED )
139+
140+
# pthreads is needed for hpparser
141+
find_package( Threads REQUIRED )
142+
if( NOT Threads_FOUND AND NOT CMAKE_USE_PTHREADS_INIT )
143+
message( FATAL_ERROR "A pthread-compatible threading library is needed" )
144+
endif()
145+
146+
# OpenMP is needed to compile the shared memory backend
147+
# TODO remove when dis-entangling (internal issue #290)
148+
find_package( OpenMP REQUIRED )
149+
150+
if( WITH_NUMA )
151+
find_package( Numa REQUIRED )
152+
endif( )
153+
154+
155+
### CHECK DEPENDENCIES W.R.T. BACKENDS
156+
if( WITH_BSP1D_BACKEND OR WITH_HYBRID_BACKEND )
157+
find_package( MPI REQUIRED )
158+
# this MUST find a dedicated .cmake file with a function to compile against LPF
159+
find_package( LPF REQUIRED )
160+
endif( )
161+
162+
163+
### SETTINGS FOR COMPILATION
164+
165+
set( TEST_CATEGORIES "unit" "smoke" "performance" )
166+
167+
### ADD GRB VARIABLES FOR BUILDING, TESTING AND INSTALLATION
168+
169+
# like compile-time definitions, LPF options and so on
170+
# variables inside AddGRBVars are not cached, hence AddGRBVars MUST be included
171+
# (NOT imported via 'add_subdirectory()') here for variables to be in the same
172+
# scope and propagate down to the other files
173+
include( AddGRBVars )
174+
175+
# here, add information for wrappers generated during installation
176+
include( AddGRBInstall )
177+
178+
# compilation flags for all targets
179+
include( CompileFlags )
180+
181+
if( WITH_BSP1D_BACKEND OR WITH_HYBRID_BACKEND )
182+
# required to create targets against LPF (provides dedicated functions)
183+
include( AddLPFTargets )
184+
endif()
185+
186+
### BACKEND HEADERS
187+
188+
# by default no headers are built
189+
set( WITH_REFERENCE_BACKEND_HEADERS OFF )
190+
set( WITH_OMP_BACKEND_HEADERS OFF )
191+
192+
# activate headers based on requested backends
193+
if( WITH_REFERENCE_BACKEND OR WITH_BSP1D_BACKEND )
194+
# both reference and bsp1d backends need reference headers
195+
set( WITH_REFERENCE_BACKEND_HEADERS ON )
196+
endif()
197+
198+
if( WITH_OMP_BACKEND OR WITH_HYBRID_BACKEND )
199+
# both reference_omp and hynrid backends need reference headers
200+
set( WITH_OMP_BACKEND_HEADERS ON )
201+
endif()
202+
203+
add_subdirectory( include )
204+
205+
### BACKEND IMPLEMENTATIONS
206+
add_subdirectory( src )
207+
208+
### TESTS and EXAMPLES
209+
210+
# specify test categories and the directory where ALL tests are stored
211+
set( TESTS_EXE_OUTPUT_DIR "${PROJECT_BINARY_DIR}/tests" )
212+
213+
include( AddGRBTests )
214+
215+
add_subdirectory( tests )
216+
217+
add_subdirectory( examples )
218+
219+
### DOXYGEN DOCUMENTATION GENERATION
220+
221+
set( DOCS_DIR "${PROJECT_SOURCE_DIR}/docs/code" )
222+
add_custom_command( OUTPUT "${DOCS_DIR}"
223+
COMMAND bash -c "if [[ ! -d docs/code ]]; then doxygen docs/doxy.conf &> doxygen.log; fi"
224+
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
225+
DEPENDS "${PROJECT_SOURCE_DIR}/docs/doxy.conf"
226+
COMMENT "producing code documentation in ${DOCS_DIR}"
227+
VERBATIM
228+
#USES_TERMINAL
229+
)
230+
add_custom_target( docs DEPENDS "${DOCS_DIR}" )

DEVELOPMENT.md

Lines changed: 0 additions & 86 deletions
This file was deleted.

0 commit comments

Comments
 (0)