forked from spack/spack
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[root] New variants
cuda
, cudnn
, tmva-X
* New variants: * `cuda` * `cudnn` * `tmva-cpu` * `tmva-gpu` * `tmva-pymva` * `tmva-sofie` * Patch to support newer `protobuf` with its own CMake config file. * Use correct level when applying patch for Protobuf
- Loading branch information
1 parent
ff9a461
commit 6ef2026
Showing
2 changed files
with
118 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,6 +110,8 @@ class Root(CMakePackage): | |
sha256="397f2de7db95a445afdb311fc91c40725fcfad485d58b4d72e6c3cdd0d0c5de7", | ||
when="@6.26:6.26.06 +root7 ^[email protected]:", | ||
) | ||
# Support recent versions of protobuf with their own CMake config | ||
patch("protobuf-config.patch", level=0, when="^protobuf") | ||
|
||
patch("webgui.patch", level=0, when="@6.26.00:6.26.10,6.28.00:6.28.08,6.30.00 +webgui") | ||
|
||
|
@@ -127,6 +129,8 @@ class Root(CMakePackage): | |
|
||
variant("aqua", default=False, description="Enable Aqua interface") | ||
variant("arrow", default=False, description="Enable Arrow interface") | ||
variant("cuda", when="@6.08.00:", default=False, description="Enable CUDA support") | ||
variant("cudnn", when="@6.20.02:", default=False, description="Enable cuDNN support") | ||
variant("davix", default=True, description="Compile with external Davix") | ||
variant("dcache", default=False, description="Enable support for dCache") | ||
variant("emacs", default=False, description="Enable Emacs support") | ||
|
@@ -188,6 +192,31 @@ class Root(CMakePackage): | |
variant("tbb", default=True, description="TBB multi-threading support") | ||
variant("threads", default=True, description="Enable using thread library") | ||
variant("tmva", default=False, description="Build TMVA multi variate analysis library") | ||
variant( | ||
"tmva-cpu", | ||
when="@6.15.02:", | ||
default=True, | ||
description="Build TMVA with CPU support for deep learning (requires BLAS)", | ||
) | ||
variant( | ||
"tmva-gpu", | ||
when="@6.15.02:", | ||
default=False, | ||
description="Build TMVA with GPU support for deep learning (requries CUDA)", | ||
) | ||
variant( | ||
"tmva-pymva", | ||
when="@6.17.02:", | ||
default=False, | ||
description="Enable support for Python in TMVA (requires numpy)", | ||
) | ||
variant( | ||
"tmva-sofie", | ||
when="@6.25.02:", | ||
default=False, | ||
description="Build TMVA with support for sofie - " | ||
"fast inference code generation (requires protobuf 3)", | ||
) | ||
variant("unuran", default=True, description="Use UNURAN for random number generation") | ||
variant("vc", default=False, description="Enable Vc for adding new types for SIMD programming") | ||
variant("vdt", default=True, description="Enable set of fast and vectorisable math functions") | ||
|
@@ -222,7 +251,6 @@ class Root(CMakePackage): | |
depends_on("[email protected]:", type="build", when="@6.28.00: platform=darwin") | ||
depends_on("pkgconfig", type="build") | ||
|
||
depends_on("blas") | ||
depends_on("freetype") | ||
depends_on("jpeg") | ||
depends_on("libice") | ||
|
@@ -260,14 +288,20 @@ class Root(CMakePackage): | |
# Python | ||
depends_on("[email protected]:", when="+python", type=("build", "run")) | ||
depends_on("[email protected]:3.10", when="@:6.26.09 +python", type=("build", "run")) | ||
depends_on("py-numpy", type=("build", "run"), when="+tmva") | ||
# This numpy dependency was not intended and will hopefully | ||
# be fixed in 6.20.06. | ||
depends_on("py-numpy", type=("build", "run"), when="+tmva-pymva") | ||
# See: https://sft.its.cern.ch/jira/browse/ROOT-10626 | ||
depends_on("py-numpy", type=("build", "run"), when="@6.20.00:6.20.05 +python") | ||
|
||
# TMVA | ||
depends_on("blas", when="+tmva-cpu") | ||
depends_on("cuda", when="+tmva-gpu") | ||
depends_on("protobuf@3:", when="+tmva-sofie") | ||
|
||
# Optional dependencies | ||
depends_on("arrow", when="+arrow") | ||
depends_on("cuda", when="+cuda") | ||
depends_on("cuda", when="+cudnn") | ||
depends_on("cudnn", when="+cudnn") | ||
depends_on("davix @0.7.1:", when="+davix") | ||
depends_on("dcap", when="+dcache") | ||
depends_on("cfitsio", when="+fits") | ||
|
@@ -332,6 +366,11 @@ class Root(CMakePackage): | |
conflicts("+math", when="~gsl", msg="root+math requires GSL") | ||
conflicts("+tmva", when="~gsl", msg="root+tmva requires GSL") | ||
conflicts("+tmva", when="~mlp", msg="root+tmva requires MLP") | ||
conflicts("+tmva-cpu", when="~tmva", msg="root+tmva-cpu requires TMVA") | ||
conflicts("+tmva-gpu", when="~tmva", msg="root+tmva-gpu requires TMVA") | ||
conflicts("+tmva-gpu", when="~cuda", msg="root+tmva-gpu requires CUDA") | ||
conflicts("+tmva-pymva", when="~tmva", msg="root+tmva-pymva requires TMVA") | ||
conflicts("+tmva-sofie", when="~tmva", msg="root+tmva-sofie requires TMVA") | ||
conflicts("~http", when="@6.29.00: +webgui", msg="root+webgui requires HTTP") | ||
conflicts("cxxstd=11", when="+root7", msg="root7 requires at least C++14") | ||
conflicts("cxxstd=11", when="@6.25.02:", msg="This version of root requires at least C++14") | ||
|
@@ -449,6 +488,10 @@ def _add_variant(variants, features, featurename, variantname): | |
_add_variant(v, f, "table", "+table") | ||
_add_variant(v, f, "thread", "+threads") | ||
_add_variant(v, f, "tmva", "+tmva") | ||
_add_variant(v, f, "tmva-cpu", "+tmva-cpu") | ||
_add_variant(v, f, "tmva-gpu", "+tmva-gpu") | ||
_add_variant(v, f, "tmva-pymva", "+tmva-pymva") | ||
_add_variant(v, f, "tmva-sofie", "+tmva-sofie") | ||
_add_variant(v, f, "unuran", "+unuran") | ||
_add_variant(v, f, "vc", "+vc") | ||
_add_variant(v, f, "vdt", "+vdt") | ||
|
@@ -600,6 +643,9 @@ def cmake_args(self): | |
define_from_variant("xrootd"), | ||
] | ||
|
||
if self.spec.satisfies("@6.08.00:"): | ||
options.append(define_from_variant("cuda")) | ||
|
||
# Necessary due to name change of variant (webui->webgui) | ||
# https://github.com/root-project/root/commit/d631c542909f2f793ca7b06abc622e292dfc4934 | ||
if self.spec.satisfies("@:6.17.02"): | ||
|
@@ -608,11 +654,22 @@ def cmake_args(self): | |
options.append(define_from_variant("webgui", "webgui")) | ||
|
||
# Some special features | ||
if self.spec.satisfies("@6.15.02:"): | ||
options.append(define_from_variant("tmva-cpu")) | ||
options.append(define_from_variant("tmva-gpu")) | ||
|
||
if self.spec.satisfies("@6.17.02:"): | ||
options.append(define_from_variant("tmva-pymva")) | ||
|
||
if self.spec.satisfies("@6.20.02:"): | ||
options.append(define_from_variant("cudnn")) | ||
options.append(define_from_variant("pyroot", "python")) | ||
else: | ||
options.append(define_from_variant("python")) | ||
|
||
if self.spec.satisfies("@6.25.02:"): | ||
options.append(define_from_variant("tmva-sofie")) | ||
|
||
# #################### Compiler options #################### | ||
|
||
if sys.platform == "darwin" and self.compiler.cc == "gcc": | ||
|
57 changes: 57 additions & 0 deletions
57
var/spack/repos/builtin/packages/root/protobuf-config.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- cmake/modules/SearchInstalledSoftware.cmake 2023-08-28 06:26:43.000000000 -0500 | ||
+++ cmake/modules/SearchInstalledSoftware.cmake 2023-11-03 10:26:13.383171830 -0500 | ||
@@ -1711,8 +1711,12 @@ | ||
|
||
if(tmva-sofie) | ||
message(STATUS "Looking for Protobuf") | ||
- find_package(Protobuf) | ||
+ set(protobuf_MODULE_COMPATIBLE TRUE) | ||
+ find_package(Protobuf CONFIG) | ||
if(NOT Protobuf_FOUND) | ||
+ find_package(Protobuf MODULE) | ||
+ endif() | ||
+ if(NOT Protobuf_FOUND) | ||
if(fail-on-missing) | ||
message(FATAL_ERROR "Protobuf libraries not found and they are required (tmva-sofie option enabled)") | ||
else() | ||
--- tmva/sofie/test/CMakeLists.txt 2023-08-28 06:26:43.000000000 -0500 | ||
+++ tmva/sofie/test/CMakeLists.txt 2023-11-03 10:41:04.048362415 -0500 | ||
@@ -46,7 +46,7 @@ | ||
${CMAKE_BINARY_DIR}/ginclude # this is for RConfigure.h | ||
) | ||
|
||
-target_link_libraries(emitFromONNX ${Protobuf_LIBRARIES} ROOTTMVASofie ROOTTMVASofieParser) | ||
+target_link_libraries(emitFromONNX protobuf::libprotobuf ROOTTMVASofie ROOTTMVASofieParser) | ||
set_target_properties(emitFromONNX PROPERTIES POSITION_INDEPENDENT_CODE TRUE) | ||
## silence protobuf warnings seen in version 3.0 and 3.6. Not needed from protobuf version 3.17 | ||
target_compile_options(emitFromONNX PRIVATE -Wno-unused-parameter -Wno-array-bounds) | ||
@@ -88,7 +88,7 @@ | ||
${CMAKE_SOURCE_DIR}/core/foundation/inc | ||
${CMAKE_BINARY_DIR}/ginclude # this is for RConfigure.h | ||
) | ||
-target_link_libraries(emitFromROOT ${Protobuf_LIBRARIES} ROOTTMVASofie ROOTTMVASofieParser) | ||
+target_link_libraries(emitFromROOT protobuf::libprotobuf ROOTTMVASofie ROOTTMVASofieParser) | ||
set_target_properties(emitFromROOT PROPERTIES POSITION_INDEPENDENT_CODE TRUE) | ||
## silence protobuf warnings seen in version 3.0 and 3.6. Not needed from protobuf version 3.17 | ||
target_compile_options(emitFromROOT PRIVATE -Wno-unused-parameter -Wno-array-bounds) | ||
--- tmva/sofie_parsers/CMakeLists.txt 2023-08-28 06:26:43.000000000 -0500 | ||
+++ tmva/sofie_parsers/CMakeLists.txt 2023-11-03 10:46:44.101759248 -0500 | ||
@@ -55,8 +55,8 @@ | ||
src/ParseFuseConvTransposeAdd.cxx | ||
src/ParseFuseMatMulAdd.cxx | ||
${PROTO_SRCS} | ||
- LIBRARIES | ||
- ${Protobuf_LIBRARIES} | ||
+ LIBRARIES PUBLIC | ||
+ protobuf::libprotobuf | ||
DEPENDENCIES | ||
TMVA | ||
ROOTTMVASofie | ||
@@ -64,7 +64,5 @@ | ||
|
||
target_include_directories(ROOTTMVASofieParser PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>) | ||
-target_include_directories(ROOTTMVASofieParser PUBLIC | ||
- ${Protobuf_INCLUDE_DIRS}) | ||
set_target_properties(ROOTTMVASofieParser PROPERTIES | ||
POSITION_INDEPENDENT_CODE TRUE) |