diff --git a/var/spack/repos/builtin/packages/root/package.py b/var/spack/repos/builtin/packages/root/package.py index 9d5e8dc2bb..5fba621082 100644 --- a/var/spack/repos/builtin/packages/root/package.py +++ b/var/spack/repos/builtin/packages/root/package.py @@ -32,6 +32,7 @@ class Root(CMakePackage): version("master", branch="master") # Development version (when more recent than production). + version("develop", branch="master") # Production version version("6.30.02", sha256="7965a456d1ad1ee0d5fe4769bf5a8fec291af684ed93db0f3080a9c362435183") @@ -48,6 +49,7 @@ class Root(CMakePackage): version("6.26.04", sha256="a271cf82782d6ed2c87ea5eef6681803f2e69e17b3036df9d863636e9358421e") version("6.26.02", sha256="7ba96772271a726079506c5bf629c3ceb21bf0682567ed6145be30606d7cd9bb") version("6.26.00", sha256="5fb9be71fdf0c0b5e5951f89c2f03fcb5e74291d043f6240fb86f5ca977d4b31") + version("6.24.08", sha256="882c41fe36e94456fb10443d08ef9152375a90d1f910a10add1793d6e838bc44") version("6.24.06", sha256="907f69f4baca1e4f30eeb4979598ca7599b6aa803ca046e80e25b6bbaa0ef522") version("6.24.02", sha256="0507e1095e279ccc7240f651d25966024325179fa85a1259b694b56723ad7c1c") version("6.24.00", sha256="9da30548a289211c3122d47dacb07e85d35e61067fac2be6c5a5ff7bda979989") @@ -108,6 +110,10 @@ class Root(CMakePackage): sha256="397f2de7db95a445afdb311fc91c40725fcfad485d58b4d72e6c3cdd0d0c5de7", when="@6.26:6.26.06 +root7 ^nlohmann-json@3.11:", ) + # Support recent versions of protobuf with their own CMake config + # (provided the CMake being used supports targets), _cf_ + # https://github.com/root-project/root/commit/f6cfe3bdab544e5f7fd49514562147ebd5d67d7c + patch("protobuf-config.patch", level=0, when="@:6.30.02 ^protobuf ^cmake@3.9:") patch("webgui.patch", level=0, when="@6.26.00:6.26.10,6.28.00:6.28.08,6.30.00 +webgui") @@ -125,6 +131,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") @@ -186,6 +194,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") @@ -220,7 +253,6 @@ class Root(CMakePackage): depends_on("cmake@3.19:", 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") @@ -241,6 +273,9 @@ class Root(CMakePackage): depends_on("libxft", when="+x") depends_on("libxpm", when="+x") depends_on("libsm", when="+x") + depends_on("fontconfig", when="+x", type="build") + depends_on("xproto", when="+x", type="build") + depends_on("xextproto", when="+x", type="build") # OpenGL depends_on("ftgl@2.4.0:", when="+opengl") @@ -255,14 +290,20 @@ class Root(CMakePackage): # Python depends_on("python@2.7:", when="+python", type=("build", "run")) depends_on("python@2.7: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") @@ -327,6 +368,12 @@ 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") conflicts("cxxstd=14", when="@6.30.00:", msg="This version of root requires at least C++17") @@ -348,6 +395,13 @@ class Root(CMakePackage): # See https://github.com/root-project/root/issues/11135 conflicts("+ipo", msg="LTO is not a supported configuration for building ROOT") + def patch(self): + filter_file( + r"#include ", + "#include \n#include ", + "graf3d/eve7/inc/ROOT/REveTypes.hxx", + ) + @classmethod def filter_detected_exes(cls, prefix, exes_in_prefix): result = [] @@ -436,6 +490,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") @@ -457,7 +515,6 @@ def cmake_args(self): # Options controlling gross build / config behavior. options += [ - define("cxxmodules", False), define("exceptions", True), define("explicitlink", True), define("fail-on-missing", True), @@ -478,6 +535,9 @@ def cmake_args(self): define("CLING_CXX_PATH", self.compiler.cxx), ] + if self.spec.satisfies("@:6.28.99"): + options.append(define("cxxmodules", False)) + # Options related to ROOT's ability to download and build its own # dependencies. Per Spack convention, this should generally be avoided. @@ -585,6 +645,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"): @@ -593,11 +656,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": @@ -659,6 +733,8 @@ def add_include_path(dep_name): # override with an empty value even though it may lead to link # warnings when building against ROOT env.unset("MACOSX_DEPLOYMENT_TARGET") + # Cleanup. + self.sanitize_environments(env) def setup_run_environment(self, env): env.set("ROOTSYS", self.prefix) @@ -667,8 +743,12 @@ def setup_run_environment(self, env): # the following vars are copied from thisroot.sh; silence a cppyy warning env.set("CLING_STANDARD_PCH", "none") env.set("CPPYY_API_PATH", "none") + # Cleanup. + self.sanitize_environments(env) - def setup_dependent_build_environment(self, env, dependent_spec): + def setup_dependent_build_environment( + self, env: spack.util.environment.EnvironmentModifications, dependent_spec + ): env.set("ROOTSYS", self.prefix) env.set("ROOT_VERSION", "v{0}".format(self.version.up_to(1))) env.prepend_path("PYTHONPATH", self.prefix.lib.root) @@ -680,8 +760,12 @@ def setup_dependent_build_environment(self, env, dependent_spec): if "platform=darwin" in self.spec: # Newer deployment targets cause fatal errors in rootcling env.unset("MACOSX_DEPLOYMENT_TARGET") + # Cleanup. + self.sanitize_environments(env) - def setup_dependent_run_environment(self, env, dependent_spec): + def setup_dependent_run_environment( + self, env: spack.util.environment.EnvironmentModifications, dependent_spec + ): env.set("ROOTSYS", self.prefix) env.set("ROOT_VERSION", "v{0}".format(self.version.up_to(1))) env.prepend_path("PYTHONPATH", self.prefix.lib.root) @@ -689,3 +773,28 @@ def setup_dependent_run_environment(self, env, dependent_spec): env.prepend_path("ROOT_INCLUDE_PATH", dependent_spec.prefix.include) if "+rpath" not in self.spec: env.prepend_path("LD_LIBRARY_PATH", self.prefix.lib.root) + # Cleanup. + self.sanitize_environments(env) + + def sanitize_environments(self, env: spack.util.environment.EnvironmentModifications, *vars): + target = self.spec.target + special_separators = {"LDSHARED": " -L"} + if not vars: + vars = ( + "PATH", + "LDSHARED", + "LD_LIBRARY_PATH", + "DYLD_LIBRARY_PATH", + "LIBRARY_PATH", + "CMAKE_PREFIX_PATH", + "ROOT_INCLUDE_PATH", + ) + for var in vars: + kwargs = {} + if var in special_separators: + kwargs["separator"] = special_separators[var] + env.prune_duplicate_paths(var, **kwargs) + if var == "PATH": + env.deprioritize_system_paths(var, target=target, **kwargs) + else: + env.remove_system_paths(var, **kwargs) diff --git a/var/spack/repos/builtin/packages/root/protobuf-config.patch b/var/spack/repos/builtin/packages/root/protobuf-config.patch new file mode 100644 index 0000000000..da02b775f6 --- /dev/null +++ b/var/spack/repos/builtin/packages/root/protobuf-config.patch @@ -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 + $) +-target_include_directories(ROOTTMVASofieParser PUBLIC +- ${Protobuf_INCLUDE_DIRS}) + set_target_properties(ROOTTMVASofieParser PROPERTIES + POSITION_INDEPENDENT_CODE TRUE) diff --git a/var/spack/repos/builtin/packages/root/webgui.patch b/var/spack/repos/builtin/packages/root/webgui.patch index 932bb1023f..54233d514f 100644 --- a/var/spack/repos/builtin/packages/root/webgui.patch +++ b/var/spack/repos/builtin/packages/root/webgui.patch @@ -22,4 +22,4 @@ +WebGui.HttpLoopback: yes # Use https protocol for the http server (default - no) WebGui.UseHttps: no - WebGui.ServerCert: rootserver.pem \ No newline at end of file + WebGui.ServerCert: rootserver.pem