From 05c72f5fe5cddd6f620fb5c3265985d0b62cf7e3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Eric=20M=C3=BCller?= <mueller@kip.uni-heidelberg.de>
Date: Wed, 3 Apr 2024 12:54:32 +0200
Subject: [PATCH 1/2] chore(hxtorch): provide list of hxtorch.core's
 dependencies for jaxsnn

This still includes all the deps, but we now can look at minimizing the
set of requirements.
---
 packages/hxtorch/package.py | 90 ++++++++++++++++++++-----------------
 packages/jaxsnn/package.py  |  9 ++--
 2 files changed, 52 insertions(+), 47 deletions(-)

diff --git a/packages/hxtorch/package.py b/packages/hxtorch/package.py
index 4e4652dc..e8c3bbae 100644
--- a/packages/hxtorch/package.py
+++ b/packages/hxtorch/package.py
@@ -30,49 +30,55 @@ class Hxtorch(build_brainscales.BuildBrainscales):
     version('7.0-rc1-fixup2', tag='hxtorch-7.0-rc1-fixup2')
     version('7.0-rc1-fixup1', branch='waf')
 
-    # compiler for the BrainScaleS-2 embedded processor ("PPU"); needed for
-    # building/linking, at runtime and for testing
-    depends_on('oppulance@8.0-a3', when='@8.0-a3', type=('build', 'link', 'run', 'test'))
-    depends_on('oppulance@8.0-a2', when='@8.0-a2', type=('build', 'link', 'run', 'test'))
-    depends_on('oppulance@8.0-a1', when='@8.0-a1', type=('build', 'link', 'run', 'test'))
-    depends_on('oppulance@7.0-rc1-fixup3', when='@7.0-rc1-fixup3', type=('build', 'link', 'run', 'test'))
-    depends_on('oppulance@7.0-rc1-fixup2', when='@7.0-rc1-fixup2', type=('build', 'link', 'run', 'test'))
-    depends_on('oppulance@7.0-rc1-fixup1', when='@7.0-rc1-fixup1', type=('build', 'link', 'run', 'test'))
+    deps_hxtorch_core = [
+        # compiler for the BrainScaleS-2 embedded processor ("PPU"); needed for
+        # building/linking, at runtime and for testing
+        ('oppulance@8.0-a3', { "when":'@8.0-a3', "type": ('build', 'link', 'run', 'test') } ),
+        ('oppulance@8.0-a2', { "when":'@8.0-a2', "type": ('build', 'link', 'run', 'test') } ),
+        ('oppulance@8.0-a1', { "when":'@8.0-a1', "type": ('build', 'link', 'run', 'test') } ),
+        ('oppulance@7.0-rc1-fixup3', { "when":'@7.0-rc1-fixup3', "type": ('build', 'link', 'run', 'test') } ),
+        ('oppulance@7.0-rc1-fixup2', { "when":'@7.0-rc1-fixup2', "type": ('build', 'link', 'run', 'test') } ),
+        ('oppulance@7.0-rc1-fixup1', { "when":'@7.0-rc1-fixup1', "type": ('build', 'link', 'run', 'test') } ),
+
+        # host software dependencies
+        ('bitsery', { "type": ('build', 'link', 'run', 'test') } ),
+        ('binutils+gold+ld+plugins', { "type": ('build', 'link', 'run') } ), # specialize
+        ('boost@1.69.0: +graph+icu+mpi+numpy+coroutine+context+filesystem+python+serialization+system+thread+program_options cxxstd=17', { "type": ('build', 'link', 'run', 'test') } ),
+        ('cereal', { "type": ('build', 'link', 'run', 'test') } ),
+        ('cppcheck', { "type": ('build', 'link', 'run') } ),
+        ('genpybind@ebrains', { "type": ('build', 'link') } ),
+        ('gflags', { "type": ('build', 'link', 'run') } ),
+        ('googletest@1.11.0:+gmock', { "type": ('build', 'link', 'run') } ), # variadic templates needed
+        ('inja', { "type": ('build', 'link', 'run', 'test')  } ),# template engine for PPU source jit generation
+        ('intel-tbb', { "type": ('build', 'link', 'run') } ), # ppu gdbserver
+        ('libelf', { "type": ('build', 'link', 'run') } ),
+        ('liblockfile', { "type": ('build', 'link', 'run') } ),
+        ('log4cxx@0.12.1:', { "type": ('build', 'link', 'run') } ),
+        ('pkgconfig', { "type": ('build', 'link', 'run') } ),
+        ('psmisc', { "type": ('run', 'test') } ),
+        ('python@3.7.0:', { "type": ('build', 'link', 'run') } ), # BrainScaleS-2 only supports Python >= 3.7
+        ('py-h5py', { "type": ('build', 'link', 'run') } ), # PyNN tests need it
+        ('py-matplotlib', { "type": ('build', 'link', 'run') } ),
+        ('py-networkx', { "type": ('build', 'link', 'run') } ),
+        ('py-nose', { "type": ('build', 'link', 'run') } ),
+        ('py-numpy', { "type": ('build', 'link', 'run') } ),
+        ('py-pybind11', { "type": ('build', 'link', 'run') } ),
+        ('py-pybind11-stubgen', { "type": ('build', 'link', 'run') } ),
+        ('py-pycodestyle', { "type": ('build', 'link', 'run') } ),
+        ('py-pyelftools', { "type": ('build', 'link', 'run') } ),
+        ('py-pylint', { "type": ('build', 'link', 'run') } ),
+        ('py-torch@1.9.1:', { "type": ('build', 'link', 'run', 'test') } ),
+        ('py-torchvision', { "type": ('run') } ), # for demos
+        ('py-pyyaml', { "type": ('build', 'link', 'run') } ),
+        ('py-scipy', { "type": ('build', 'link', 'run') } ),
+        ('py-sqlalchemy', { "type": ('build', 'link', 'run') } ),
+        ('util-linux', { "type": ('build', 'link', 'run') } ),
+        ('yaml-cpp+shared', { "type": ('build', 'link', 'run') } ),
+    ]
+
+    for dep, dep_kw in deps_hxtorch_core:
+        depends_on(dep, **dep_kw)
 
-    # host software dependencies
-    depends_on('bitsery', type=('build', 'link', 'run', 'test'))
-    depends_on('binutils+gold+ld+plugins', type=('build', 'link', 'run')) # specialize
-    depends_on('boost@1.69.0: +graph+icu+mpi+numpy+coroutine+context+filesystem+python+serialization+system+thread+program_options cxxstd=17', type=('build', 'link', 'run', 'test'))
-    depends_on('cereal', type=('build', 'link', 'run', 'test'))
-    depends_on('cppcheck', type=('build', 'link', 'run'))
-    depends_on('genpybind@ebrains', type=('build', 'link'))
-    depends_on('gflags', type=('build', 'link', 'run'))
-    depends_on('googletest@1.11.0:+gmock', type=('build', 'link', 'run')) # variadic templates needed
-    depends_on('inja', type=('build', 'link', 'run', 'test')) # template engine for PPU source jit generation
-    depends_on('intel-tbb', type=('build', 'link', 'run'))  # ppu gdbserver
-    depends_on('libelf', type=('build', 'link', 'run'))
-    depends_on('liblockfile', type=('build', 'link', 'run'))
-    depends_on('log4cxx@0.12.1:', type=('build', 'link', 'run'))
-    depends_on('pkgconfig', type=('build', 'link', 'run'))
-    depends_on('psmisc', type=('run', 'test'))
-    depends_on('python@3.7.0:', type=('build', 'link', 'run')) # BrainScaleS-2 only supports Python >= 3.7
-    depends_on('py-h5py', type=('build', 'link', 'run')) # PyNN tests need it
-    depends_on('py-matplotlib', type=('build', 'link', 'run'))
-    depends_on('py-networkx', type=('build', 'link', 'run'))
-    depends_on('py-nose', type=('build', 'link', 'run'))
-    depends_on('py-numpy', type=('build', 'link', 'run'))
-    depends_on('py-pybind11', type=('build', 'link', 'run'))
-    depends_on('py-pybind11-stubgen', type=('build', 'link', 'run'))
-    depends_on('py-pycodestyle', type=('build', 'link', 'run'))
-    depends_on('py-pyelftools', type=('build', 'link', 'run'))
-    depends_on('py-pylint', type=('build', 'link', 'run'))
-    depends_on('py-torch@1.9.1:', type=('build', 'link', 'run', 'test'))
-    depends_on('py-torchvision', type=('run')) # for demos
-    depends_on('py-pyyaml', type=('build', 'link', 'run'))
-    depends_on('py-scipy', type=('build', 'link', 'run'))
-    depends_on('py-sqlalchemy', type=('build', 'link', 'run'))
-    depends_on('util-linux', type=('build', 'link', 'run'))
-    depends_on('yaml-cpp+shared', type=('build', 'link', 'run'))
     extends('python')
 
     def install_test(self):
diff --git a/packages/jaxsnn/package.py b/packages/jaxsnn/package.py
index cd66a377..3fe246b4 100644
--- a/packages/jaxsnn/package.py
+++ b/packages/jaxsnn/package.py
@@ -12,7 +12,7 @@ import spack.build_environment
 
 import importlib
 build_brainscales = importlib.import_module("spack.pkg.ebrains-spack-builds.build_brainscales")
-
+hxtorch = importlib.import_module("spack.pkg.ebrains-spack-builds.hxtorch")
 
 class Jaxsnn(build_brainscales.BuildBrainscales):
     """jaxsnn is an event-based approach to machine-learning-inspired training
@@ -29,10 +29,9 @@ class Jaxsnn(build_brainscales.BuildBrainscales):
     version('8.0-a2', tag='jaxsnn-8.0-a2')
     version('8.0-a1', tag='jaxsnn-8.0-a1')
 
-    # for now, this is still "on top" of hxtorch…
-    depends_on('hxtorch@8.0-a3', when='@8.0-a3', type=('build', 'link', 'run', 'test'))
-    depends_on('hxtorch@8.0-a2', when='@8.0-a2', type=('build', 'link', 'run', 'test'))
-    depends_on('hxtorch@8.0-a1', when='@8.0-a1', type=('build', 'link', 'run', 'test'))
+    # dependencies inherited from hxtorch.core
+    for dep, dep_kw in hxtorch.Hxtorch.deps_hxtorch_core:
+        depends_on(dep, **dep_kw)
 
     # main dependencies w/o hxtorch.core dependencies (those come via hxtorch above)
     depends_on('py-jax@0.4.13:', type=('build', 'link', 'run'))
-- 
GitLab


From 2aacb41f1c320f451181f3360f09ac0e4bfeedbd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Eric=20M=C3=BCller?= <mueller@kip.uni-heidelberg.de>
Date: Wed, 3 Apr 2024 12:56:29 +0200
Subject: [PATCH 2/2] chore(build-brainscales): drop hack

---
 packages/build-brainscales/package.py | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/packages/build-brainscales/package.py b/packages/build-brainscales/package.py
index 4fc13e34..a919b949 100644
--- a/packages/build-brainscales/package.py
+++ b/packages/build-brainscales/package.py
@@ -18,9 +18,6 @@ class BuildBrainscales(WafPackage):
     depends_on('git', type=('build', 'link'))
     depends_on('py-git-review', type=('build', 'link'))
 
-    # hack to provide genpybind PATH in all brainscales-style builds
-    depends_on('genpybind@ebrains', type=('build', 'link'))
-
     def do_fetch(self, mirror_only=False):
         """Setup the project."""
 
-- 
GitLab