Skip to content

Commit 7b16f56

Browse files
committed
Restore the superbuild
1 parent d7c5780 commit 7b16f56

28 files changed

+3035
-0
lines changed

Diff for: scripts/superbuild/CMakeLists.txt

+180
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
################################################################################
2+
## Copyright (c) 2014-2022, Lawrence Livermore National Security, LLC.
3+
## Produced at the Lawrence Livermore National Laboratory.
4+
## Written by the LBANN Research Team (B. Van Essen, et al.) listed in
5+
## the CONTRIBUTORS file. <[email protected]>
6+
##
7+
## LLNL-CODE-697807.
8+
## All rights reserved.
9+
##
10+
## This file is part of LBANN: Livermore Big Artificial Neural Network
11+
## Toolkit. For details, see http://software.llnl.gov/LBANN or
12+
## https://github.com/LLNL/LBANN.
13+
##
14+
## Licensed under the Apache License, Version 2.0 (the "Licensee"); you
15+
## may not use this file except in compliance with the License. You may
16+
## obtain a copy of the License at:
17+
##
18+
## http://www.apache.org/licenses/LICENSE-2.0
19+
##
20+
## Unless required by applicable law or agreed to in writing, software
21+
## distributed under the License is distributed on an "AS IS" BASIS,
22+
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
23+
## implied. See the License for the specific language governing
24+
## permissions and limitations under the license.
25+
################################################################################
26+
cmake_minimum_required(VERSION 3.22)
27+
project(LBANN_SuperBuild NONE)
28+
29+
cmake_policy(SET CMP0097 NEW)
30+
31+
message("\nWelcome to the LBANN SuperBuild system.\n\nGood luck!\n")
32+
33+
if (PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
34+
message(FATAL_ERROR "In-source builds are not permitted.")
35+
endif ()
36+
37+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
38+
include(LBANNSuperBuildAddCMakeExternPkg)
39+
include(LBANNSuperBuildAddPackages)
40+
include(LBANNSuperBuildCreateCMakeArguments)
41+
include(LBANNSuperBuildInitExternPkg)
42+
43+
# SuperBuild options
44+
option(LBANN_SB_DEFAULT_CUDA_OPTS
45+
"Set Tom's preferred default options for CUDA builds."
46+
OFF)
47+
48+
option(LBANN_SB_DEFAULT_ROCM_OPTS
49+
"Set Tom's preferred default options for ROCm builds."
50+
OFF)
51+
52+
option(LBANN_SB_CLONE_VIA_SSH
53+
"Use SSH protocol instead of HTTPS for github." OFF)
54+
55+
set(LBANN_SB_DEFAULT_INSTALL_PATH_STRATEGY "COMMON"
56+
CACHE STRING "Package prefix selection strategy. [COMMON, PKG, PKG_LC].")
57+
58+
# List packages that we can build. The names are chosen first to align
59+
# with variables specific to the package (e.g., Aluminum uses
60+
# "ALUMINUM_" as its variable prefix, so we simplify our lives by
61+
# using "ALUMINUM" as the package name). When the variable names do
62+
# not include the package, we fall back on however the package refers
63+
# to itself.
64+
#
65+
# NOTE: This list is ORDERED. "Second-order" dependencies come before
66+
# "first-order" dependencies.
67+
#
68+
# FIXME: Address the above node so that the packages are known before
69+
# descending into subdirectories.
70+
lbann_sb_add_packages(
71+
# Ack, a "third-order" dependency
72+
RCCL
73+
74+
# These are "second-order" dependencies
75+
adiak # Caliper
76+
Caliper # Aluminum, LBANN
77+
Aluminum # Hydrogen, DiHydrogen
78+
Catch2 # Hydrogen, DiHydrogen
79+
HDF5 # Conduit
80+
JPEG-TURBO # OpenCV
81+
OpenBLAS # Hydrogen
82+
spdlog # DiHydrogen, LBANN
83+
84+
# These are the "first-order" dependencies
85+
cereal
86+
Clara
87+
CNPY
88+
Conduit
89+
Hydrogen # DiHydrogen depends on H.
90+
DiHydrogen
91+
OpenCV
92+
protobuf
93+
zstr
94+
95+
# And finally add the option to build LBANN
96+
LBANN)
97+
98+
# Note: This changes things around slightly from the original
99+
# version. I have flattened this list to IGNORE the dependency
100+
# graph. This makes it slightly more general-purpose (that is, I don't
101+
# care WHY you want to build {HDF5, JPEG-turbo, OpenBLAS} but not
102+
# {Conduit, OpenCV, Hydrogen}, so I'm just going to let you do that).
103+
104+
# Add the TPL subdirectories
105+
set(_GIT_REPOSITORY_TAG "GIT_REPOSITORY")
106+
set(_GIT_TAG_TAG "GIT_TAG")
107+
foreach (pkg ${LBANN_SB_BUILD_PKGS})
108+
if (LBANN_SB_BUILD_${pkg})
109+
string(TOLOWER "${pkg}" pkg_lower)
110+
add_subdirectory(${pkg_lower})
111+
endif ()
112+
endforeach ()
113+
114+
# Print a helpful(?) message
115+
set(LBANN_SB_SUGG_CMAKE_PREFIX_PATH_TMP "\$\{CMAKE_PREFIX_PATH\}")
116+
message("\n-----------------------------------------------------------------\n")
117+
message("LBANN SuperBuild will build the following packages:\n")
118+
foreach (pkg ${LBANN_SB_BUILD_PKGS})
119+
if (${pkg}_CMAKE_INSTALL_PREFIX)
120+
message(" -- ${pkg} (${${pkg}_CMAKE_INSTALL_PREFIX})")
121+
list(PREPEND LBANN_SB_SUGG_CMAKE_PREFIX_PATH_TMP
122+
"${${pkg}_CMAKE_INSTALL_PREFIX}")
123+
elseif (LBANN_SB_${pkg}_PREFIX)
124+
message(" -- ${pkg} (${LBANN_SB_${pkg}_PREFIX})")
125+
list(PREPEND LBANN_SB_SUGG_CMAKE_PREFIX_PATH_TMP
126+
"${LBANN_SB_${pkg}_PREFIX}")
127+
else ()
128+
message(" -- ${pkg} (??????)")
129+
endif ()
130+
endforeach ()
131+
list(REMOVE_DUPLICATES LBANN_SB_SUGG_CMAKE_PREFIX_PATH_TMP)
132+
string(REPLACE ";" ":" LBANN_SB_SUGG_CMAKE_PREFIX_PATH
133+
"${LBANN_SB_SUGG_CMAKE_PREFIX_PATH_TMP}")
134+
message("\nIt may be useful to do the following:\n")
135+
message("export CMAKE_PREFIX_PATH=${LBANN_SB_SUGG_CMAKE_PREFIX_PATH}\n")
136+
message("or\n")
137+
message("source lbann_sb_suggested_cmake_prefix_path.sh\n")
138+
message("Note that these assume a Bourne-compatible shell.")
139+
message("\n-----------------------------------------------------------------\n")
140+
file(WRITE "${CMAKE_BINARY_DIR}/lbann_sb_suggested_cmake_prefix_path.sh"
141+
"export CMAKE_PREFIX_PATH=${LBANN_SB_SUGG_CMAKE_PREFIX_PATH}\n")
142+
143+
# Add a custom target for bundling all things up
144+
if (UNIX)
145+
find_program(__FIND_EXE find)
146+
mark_as_advanced(__FIND_EXE)
147+
set(__WORKING_DIR "${CMAKE_BINARY_DIR}")
148+
if (__FIND_EXE)
149+
set(__cmd "${__FIND_EXE};.;\(;-ipath;*/stamp/*.log;-o;-ipath;*/CMakeFiles/CMake*.log;-o;-name;CMakeCache.txt;\);-exec;${CMAKE_COMMAND};-E;tar;czf;all_output_logs.tar.gz;--;{};+")
150+
add_custom_target(gather-logs
151+
COMMAND "${__cmd}"
152+
BYPRODUCTS "${__WORKING_DIR}/all_output_logs.tar.gz"
153+
WORKING_DIRECTORY "${__WORKING_DIR}"
154+
COMMENT "Gathering all output logs."
155+
VERBATIM
156+
COMMAND_EXPAND_LISTS
157+
USES_TERMINAL)
158+
159+
add_custom_target(gather-all)
160+
add_dependencies(gather-all gather-logs)
161+
if (CMAKE_GENERATOR STREQUAL "Ninja")
162+
set(__cmd "${__FIND_EXE};.;-name;*.ninja;-exec;${CMAKE_COMMAND};-E;tar;czf;all_build_files.tar.gz;{};+")
163+
elseif (CMAKE_GENERATOR STREQUAL "Unix Makefiles")
164+
set(__cmd "${__FIND_EXE};.;\(;-name;link.txt;-o;-name;build.make;-o;-name;flags.make;\);-exec;${CMAKE_COMMAND};-E;tar;czf;all_build_files.tar.gz;{};+")
165+
else ()
166+
set(__cmd)
167+
endif ()
168+
if (__cmd)
169+
add_custom_target(gather-build
170+
COMMAND "${__cmd}"
171+
BYPRODUCTS "${__WORKING_DIR}/all_build_files.tar.gz"
172+
WORKING_DIRECTORY "${__WORKING_DIR}"
173+
COMMENT "Gathering all build files."
174+
VERBATIM
175+
COMMAND_EXPAND_LISTS
176+
USES_TERMINAL)
177+
add_dependencies(gather-all gather-build)
178+
endif ()
179+
endif (__FIND_EXE)
180+
endif (UNIX)

0 commit comments

Comments
 (0)