diff --git a/packages.yaml b/packages.yaml
index 96017412328b57843eb222ac1d8db60a51b2086e..1dd5e099c40089e3fe392b8c10520693e83dc82b 100644
--- a/packages.yaml
+++ b/packages.yaml
@@ -4,3 +4,6 @@ packages:
         compiler: [gcc@10.3.0]
     python:
         version: [3.8.11]
+    py-torch:
+        version: [1.11.0]
+        variants: [~cuda~rocm~valgrind~mkldnn~mpi~gloo+tensorpipe~onnx_ml]
diff --git a/packages/hxtorch/package.py b/packages/hxtorch/package.py
index f0aeaff71899e1adbae47a71e273bad673531afd..6b36a3685216db881fcea689cf567f2159e8539d 100644
--- a/packages/hxtorch/package.py
+++ b/packages/hxtorch/package.py
@@ -5,7 +5,6 @@
 import os
 
 from spack import *
-from spack.pkg.builtin.boost import Boost
 
 
 class Hxtorch(WafPackage):
@@ -15,27 +14,26 @@ class Hxtorch(WafPackage):
     # This repo provides a waf binary used for the build below
     git      = "https://github.com/electronicvisions/pynn-brainscales.git"
 
-    version('4.0-a3', branch='waf')
+    version('4.0-a4', branch='waf')
 
     # PPU compiler dependencies
-    depends_on('oppulance@4.0-a3')
+    depends_on('oppulance@4.0-a4')
 
     # host software dependencies
     depends_on('bitsery', type=('build', 'link', 'run'))
     depends_on('binutils+gold+ld+plugins', type=('build', 'link', 'run')) # specialize
-    depends_on(Boost.with_default_variants)
-    depends_on('boost@1.69.0: +graph+icu+mpi+python+numpy+coroutine+context cxxstd=17', type=('build', 'link', 'run')) # specialize boost (non-clingo, type=('build', 'link', 'run'))
+    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')) # specialize boost (non-clingo, type=('build', 'link', 'run'))
     depends_on('cereal', type=('build', 'link', 'run'))
     depends_on('cppcheck', type=('build', 'link', 'run'))
     depends_on('doxygen+graphviz', type=('build', 'link', 'run'))
     depends_on('genpybind@ebrains', type=('build', 'link', 'run'))
     depends_on('gflags', type=('build', 'link', 'run'))
-    depends_on('googletest@1.11.0: +gmock', type=('build', 'link', 'run')) # variadic templates needed
+    depends_on('googletest@1.11.0:+gmock', type=('build', 'link', 'run')) # variadic templates needed
     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('llvm', type=('build', 'link', 'run'))
-    depends_on('log4cxx', type=('build', 'link', 'run'))
+    depends_on('log4cxx@0.12.1:', type=('build', 'link', 'run'))
     depends_on('pkgconfig', type=('build', 'link', 'run'))
     depends_on('python@3.7.0:', type=('build', 'link', 'run')) # BrainScaleS(-2, type=('build', 'link', 'run')) only supports Python >= 3.7
     depends_on('py-h5py', type=('build', 'link', 'run')) # PyNN tests need it
@@ -47,7 +45,8 @@ class Hxtorch(WafPackage):
     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', type=('build', 'link', 'run'))
+    depends_on('py-torch@1.9.1:', type=('build', 'link', 'run'))
+    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'))
@@ -61,53 +60,46 @@ class Hxtorch(WafPackage):
         configuration."""
 
         include = []
-        for dep in self.spec.traverse(deptype='build'):
+        include_exclude_dirs = set(['/usr/include'])
+        for dep in self.spec.traverse(deptype='build', root=False):
             query = self.spec[dep.name]
+            if dep.name in ['pthreadpool', 'fxdiv']:
+                print('skipping {} in SPACK_INCLUDE_DIRS/CPATH/C{{,_PLUS}}_INCLUDE_PATH\n'.format(dep.name))
+                for d in query.headers.directories:
+                    if os.path.exists(d):
+                        env.remove_path('SPACK_INCLUDE_DIRS', d)
+                continue
             try:
-                if dep.name in ['pthreadpool', 'fxdiv']:
-                    print('skipping {} in SPACK_INCLUDE_DIRS/CPATH/C{{,_PLUS}}_INCLUDE_PATH\n'.format(dep.name))
-                    for d in query.headers.directories:
-                        if os.path.exists(d):
-                            env.remove_path('SPACK_INCLUDE_DIRS', d)
-                    continue
-                include.extend(query.headers.directories)
-                print('headers (', dep.name, '):', query.headers.directories, "\n")
-            except:
+                include_dirs = set(query.headers.directories)
+                include_dirs -= include_exclude_dirs
+                print('headers (', dep.name, '):', include_dirs, "\n")
+                include.extend(list(include_dirs))
+            except spack.error.NoHeadersError:
+                # we don't care if no header directories are found
                 pass
 
         library = []
-        for dep in self.spec.traverse(deptype=('link', 'run')):
+        library_exclude_dirs = set(['/lib', '/lib64', '/usr/lib', '/usr/lib64'])
+        for dep in self.spec.traverse(deptype=('link', 'run'), root=False):
             query = self.spec[dep.name]
-            # we probably should skip/remove the entries for the same
-            # dependencies as above; however, ".libs" relies on the package
-            # name being the same as the library name (e.g. approx.
-            # libPACKAGE.so) so we are just moving googletest to the front
-            if dep.name == 'googletest':
-                for d in [self.spec['googletest'].prefix.lib64, self.spec['googletest'].prefix.lib]:
-                    if os.path.exists(d):
-                        print('moving to front of SPACK_{LINK,RPATH}_DIRS\n', d)
-                        env.remove_path('SPACK_LINK_DIRS', d)
-                        env.prepend_path('SPACK_LINK_DIRS', d)
-                        env.remove_path('SPACK_RPATH_DIRS', d)
-                        env.prepend_path('SPACK_RPATH_DIRS', d)
             try:
-                print('libs (', dep.name, '):', query.libs.directories, "\n")
-                # extend at front
-                library = query.libs.directories + library
-            except:
+                library_dirs = set(query.libs.directories)
+                library_dirs -= library_exclude_dirs
+                print('libs (', dep.name, '):', library_dirs, "\n")
+                library.extend(list(library_dirs))
+            except spack.error.NoLibrariesError:
+                # we don't care if no library directories are found
                 pass
 
         path = []
-        for dep in self.spec.traverse(deptype=('build', 'link', 'run')):
+        for dep in self.spec.traverse(deptype=('build', 'link', 'run'), root=False):
             if dep.name in ['pthreadpool', 'fxdiv']:
                 print('skipping {} for bin'.format(dep.name))
                 continue
             query = self.spec[dep.name]
-            try:
+            if os.path.exists(self.prefix.bin):
                 path.append(query.prefix.bin)
                 print('bin (', dep.name, '):', query.prefix.bin, "\n")
-            except:
-                pass
 
         # llvm might be built with ~shared_libs but still builds shared libs
         if not any('llvm' in lib for lib in library):
@@ -171,5 +163,15 @@ class Hxtorch(WafPackage):
 
     def build_args(self):
         args = ['--keep', '--test-execnone', '-v']
+        return args
 
+    def build_test(self):
+        self.waf('install', '--test-execall')
+
+    def install_args(self):
+        args = ['--test-execnone']
         return args
+
+    def install_test(self):
+        with working_dir('spack-test', create=True):
+            python('-c', 'import hxtorch; print(hxtorch.__file__)')
diff --git a/packages/log4cxx/log4cxx-0.10.0-llvm-libcxx.patch b/packages/log4cxx/log4cxx-0.10.0-llvm-libcxx.patch
deleted file mode 100644
index addd198337d9a25bb7e74ac5d31623c848ea2554..0000000000000000000000000000000000000000
--- a/packages/log4cxx/log4cxx-0.10.0-llvm-libcxx.patch
+++ /dev/null
@@ -1,26 +0,0 @@
---- apache-log4cxx-0.10.0/src/main/cpp/stringhelper.cpp2018-04-19 09:48:50.762552	436 +0200
-+++ apache-log4cxx-0.10.0-old/src/main/cpp/stringhelper.cpp2	008-04-01 00:34:09.000000000 +0200
-@@ -28,7 +28,6 @@
- #endif
- #include <log4cxx/private/log4cxx_private.h>
- #include <cctype>
--#include <cstdlib>
- #include <apr.h>
- 
- 
-diff -rpu apache-log4cxx-0.10.0/src/main/include/log4cxx/helpers/simpledateformat.h apache-log4cxx-0.10.0-old/src/main/include/log4cxx/helpers/simpledateformat.h
---- apache-log4cxx-0.10.0/src/main/include/log4cxx/helpers/simpledateformat.h2018-04-19 09:4	8:19.010260662 +0200
-+++ apache-log4cxx-0.10.0-old/src/main/include/log4cxx/helpers/simpledateformat.h2008-04-01 00:34:26.000000000 +0200
-@@ -26,1	0 +26,11 @@
- 
- 
- #include <log4cxx/helpers/dateformat.h>
--#include <locale>
- #include <vector>
- #include <time.h>
- 
-+namespace std { class locale; }
-+
- namespace log4cxx
- {
-         namespace helpers
diff --git a/packages/log4cxx/log4cxx-0.10.0-missing_includes.patch b/packages/log4cxx/log4cxx-0.10.0-missing_includes.patch
deleted file mode 100644
index 6834648d09a826c18cf5755c406006c16accc36d..0000000000000000000000000000000000000000
--- a/packages/log4cxx/log4cxx-0.10.0-missing_includes.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-diff -Naur apache-log4cxx-0.10.0.orig/src/examples/cpp/console.cpp apache-log4cxx-0.10.0/src/examples/cpp/console.cpp
---- apache-log4cxx-0.10.0.orig/src/examples/cpp/console.cpp	2008-04-01 00:34:52.000000000 +0200
-+++ apache-log4cxx-0.10.0/src/examples/cpp/console.cpp	2008-05-06 05:40:52.000000000 +0200
-@@ -15,7 +15,10 @@
-  * limitations under the License.
-  */
- 
--#include <stdlib.h>
-+#include <cstdio>
-+#include <cstdlib>
-+#include <cstring>
-+#include <stdint.h>
- #include <log4cxx/logger.h>
- #include <log4cxx/consoleappender.h>
- #include <log4cxx/simplelayout.h>
-diff -Naur apache-log4cxx-0.10.0.orig/src/main/cpp/inputstreamreader.cpp apache-log4cxx-0.10.0/src/main/cpp/inputstreamreader.cpp
---- apache-log4cxx-0.10.0.orig/src/main/cpp/inputstreamreader.cpp	2008-04-01 00:34:09.000000000 +0200
-+++ apache-log4cxx-0.10.0/src/main/cpp/inputstreamreader.cpp	2008-05-06 05:32:31.000000000 +0200
-@@ -21,6 +21,8 @@
- #include <log4cxx/helpers/pool.h>
- #include <log4cxx/helpers/bytebuffer.h>
- 
-+#include <cstring>
-+
- using namespace log4cxx;
- using namespace log4cxx::helpers;
- 
-diff -Naur apache-log4cxx-0.10.0.orig/src/main/cpp/socketoutputstream.cpp apache-log4cxx-0.10.0/src/main/cpp/socketoutputstream.cpp
---- apache-log4cxx-0.10.0.orig/src/main/cpp/socketoutputstream.cpp	2008-04-01 00:34:09.000000000 +0200
-+++ apache-log4cxx-0.10.0/src/main/cpp/socketoutputstream.cpp	2008-05-06 05:35:55.000000000 +0200
-@@ -20,6 +20,8 @@
- #include <log4cxx/helpers/socket.h>
- #include <log4cxx/helpers/bytebuffer.h>
- 
-+#include <cstring>
-+
- using namespace log4cxx;
- using namespace log4cxx::helpers;
\ No newline at end of file
diff --git a/packages/log4cxx/log4cxx-0.10.0-narrowing-fixes-from-upstream.patch b/packages/log4cxx/log4cxx-0.10.0-narrowing-fixes-from-upstream.patch
deleted file mode 100644
index e583e7661d1d0adc0650dd3d96f5bf8d77aa6cbf..0000000000000000000000000000000000000000
--- a/packages/log4cxx/log4cxx-0.10.0-narrowing-fixes-from-upstream.patch
+++ /dev/null
@@ -1,117 +0,0 @@
-diff --git a/src/main/cpp/locationinfo.cpp b/src/main/cpp/locationinfo.cpp
-index e76ea29..bd22a1d 100644
---- a/src/main/cpp/locationinfo.cpp
-+++ b/src/main/cpp/locationinfo.cpp
-@@ -149,18 +149,21 @@ void LocationInfo::write(ObjectOutputStream& os, Pool& p) const {
-          os.writeNull(p);
-     } else {
-         char prolog[] = {
--         0x72, 0x00, 0x21, 0x6F, 0x72, 0x67, 0x2E, 
--         0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2E, 0x6C, 
--         0x6F, 0x67, 0x34, 0x6A, 0x2E, 0x73, 0x70, 0x69, 
--         0x2E, 0x4C, 0x6F, 0x63, 0x61, 0x74, 0x69, 0x6F, 
--         0x6E, 0x49, 0x6E, 0x66, 0x6F, 0xED, 0x99, 0xBB, 
--         0xE1, 0x4A, 0x91, 0xA5, 0x7C, 0x02, 0x00, 0x01, 
--         0x4C, 0x00, 0x08, 0x66, 0x75, 0x6C, 0x6C, 0x49, 
--         0x6E, 0x66, 0x6F, 
--            0x74, 0x00, 0x12, 0x4C, 0x6A, 
--                0x61, 0x76, 0x61, 0x2F, 0x6C, 0x61, 0x6E, 0x67, 
--                0x2F, 0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B,
--         0x78, 0x70 };
-+         0x72,
-+         0x00,
-+         0x21, 0x6F, 0x72, 0x67, 0x2E, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2E,
-+         0x6C, 0x6F, 0x67, 0x34, 0x6A, 0x2E, 0x73, 0x70, 0x69, 0x2E, 0x4C, 0x6F,
-+         0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x49, 0x6E, 0x66, 0x6F, static_cast<char>(0xED),
-+         static_cast<char>(0x99), static_cast<char>(0xBB), static_cast<char>(0xE1),
-+         0x4A, static_cast<char>(0x91), static_cast<char>(0xA5), 0x7C, 0x02,
-+         0x00,
-+         0x01, 0x4C,
-+         0x00,
-+         0x08, 0x66, 0x75, 0x6C, 0x6C, 0x49, 0x6E, 0x66, 0x6F, 0x74,
-+         0x00,
-+         0x12, 0x4C, 0x6A, 0x61, 0x76, 0x61, 0x2F, 0x6C, 0x61, 0x6E, 0x67, 0x2F,
-+         0x53, 0x74, 0x72, 0x69, 0x6E, 0x67, 0x3B, 0x78, 0x70
-+        };
-       os.writeProlog("org.apache.log4j.spi.LocationInfo", 2, prolog, sizeof(prolog), p);
-         char* line = p.itoa(lineNumber);
-         //
-diff --git a/src/main/cpp/loggingevent.cpp b/src/main/cpp/loggingevent.cpp
-index 1c0d4be..edbf40b 100644
---- a/src/main/cpp/loggingevent.cpp
-+++ b/src/main/cpp/loggingevent.cpp
-@@ -242,7 +242,7 @@ void LoggingEvent::writeProlog(ObjectOutputStream& os, Pool& p)  {
-         0x68, 0x65, 0x2E, 0x6C, 0x6F, 0x67, 0x34, 0x6A, 
-         0x2E, 0x73, 0x70, 0x69, 0x2E, 0x4C, 0x6F, 0x67, 
-         0x67, 0x69, 0x6E, 0x67, 0x45, 0x76, 0x65, 0x6E, 
--        0x74, 0xF3, 0xF2, 0xB9, 0x23, 0x74, 0x0B, 0xB5, 
-+        0x74, static_cast<char>(0xF3), static_cast<char>(0xF2), static_cast<char>(0xB9), 0x23, 0x74, 0x0B, static_cast<char>(0xB5), 
-         0x3F, 0x03, 0x00, 0x0A, 0x5A, 0x00, 0x15, 0x6D, 
-         0x64, 0x63, 0x43, 0x6F, 0x70, 0x79, 0x4C, 0x6F, 
-         0x6F, 0x6B, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 
-diff --git a/src/main/cpp/objectoutputstream.cpp b/src/main/cpp/objectoutputstream.cpp
-index 7cd696b..5442420 100644
---- a/src/main/cpp/objectoutputstream.cpp
-+++ b/src/main/cpp/objectoutputstream.cpp
-@@ -36,7 +36,7 @@ ObjectOutputStream::ObjectOutputStream(OutputStreamPtr outputStream, Pool& p)
-        objectHandle(0x7E0000),
-        classDescriptions(new ClassDescriptionMap())
- {
--   char start[] = { 0xAC, 0xED, 0x00, 0x05 };
-+   char start[] = { static_cast<char>(0xAC), static_cast<char>(0xED), 0x00, 0x05 };
-    ByteBuffer buf(start, sizeof(start));
-    os->write(buf, p);
- }
-@@ -81,15 +81,15 @@ void ObjectOutputStream::writeObject(const MDC::Map& val, Pool& p) {
-     //
-     //  TC_OBJECT and the classDesc for java.util.Hashtable
-     //
--    char prolog[] = {
--        0x72, 0x00, 0x13, 0x6A, 0x61, 0x76, 0x61, 
--        0x2E, 0x75, 0x74, 0x69, 0x6C, 0x2E, 0x48, 0x61, 
--        0x73, 0x68, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x13, 
--        0xBB, 0x0F, 0x25, 0x21, 0x4A, 0xE4, 0xB8, 0x03, 
--        0x00, 0x02, 0x46, 0x00, 0x0A, 0x6C, 0x6F, 0x61, 
--        0x64, 0x46, 0x61, 0x63, 0x74, 0x6F, 0x72, 0x49, 
--        0x00, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 
--        0x6F, 0x6C, 0x64, 0x78, 0x70  };
-+	char prolog[] = {
-+		0x72, 0x00, 0x13, 0x6A, 0x61, 0x76, 0x61,
-+		0x2E, 0x75, 0x74, 0x69, 0x6C, 0x2E, 0x48, 0x61,
-+		0x73, 0x68, 0x74, 0x61, 0x62, 0x6C, 0x65, 0x13,
-+		static_cast<char>(0xBB), 0x0F, 0x25, 0x21, 0x4A, static_cast<char>(0xE4), static_cast<char>(0xB8), 0x03,
-+		0x00, 0x02, 0x46, 0x00, 0x0A, 0x6C, 0x6F, 0x61,
-+		0x64, 0x46, 0x61, 0x63, 0x74, 0x6F, 0x72, 0x49,
-+		0x00, 0x09, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68,
-+		0x6F, 0x6C, 0x64, 0x78, 0x70  };
-     writeProlog("java.util.Hashtable", 1, prolog, sizeof(prolog), p);
-     //
-     //   loadFactor = 0.75, threshold = 5, blockdata start, buckets.size = 7
-diff --git a/src/test/cpp/xml/domtestcase.cpp b/src/test/cpp/xml/domtestcase.cpp
-index a500628..29d67dd 100644
---- a/src/test/cpp/xml/domtestcase.cpp
-+++ b/src/test/cpp/xml/domtestcase.cpp
-@@ -190,9 +190,9 @@ public:
-                 DOMConfigurator::configure(LOG4CXX_TEST_STR("input/xml/DOMTestCase3.xml"));
-                 LOG4CXX_INFO(logger, "File name is expected to end with a superscript 3");
- #if LOG4CXX_LOGCHAR_IS_UTF8
--                const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, 0xC2, 0xB3, 0 };
-+                const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, static_cast<logchar>(0xC2), static_cast<logchar>(0xB3), 0 };
- #else
--                const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, 0xB3, 0 };
-+                const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, static_cast<logchar>(0xB3), 0 };
- #endif
-                 File file;
-                 file.setPath(fname);
-@@ -209,9 +209,9 @@ public:
-                 DOMConfigurator::configure(LOG4CXX_TEST_STR("input/xml/DOMTestCase4.xml"));
-                 LOG4CXX_INFO(logger, "File name is expected to end with an ideographic 4");
- #if LOG4CXX_LOGCHAR_IS_UTF8
--                const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, 0xE3, 0x86, 0x95, 0 };
-+                const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, static_cast<logchar>(0xE3), static_cast<logchar>(0x86), static_cast<logchar>(0x95), 0 };
- #else
--                const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, 0x3195, 0 };
-+                const logchar fname[] = { 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x2F, 0x64, 0x6F, 0x6D, static_cast<logchar>(0x3195), 0 };
- #endif
-                 File file;
-                 file.setPath(fname);
\ No newline at end of file
diff --git a/packages/log4cxx/package.py b/packages/log4cxx/package.py
deleted file mode 100644
index 96ef6c616ebd27e147311b968e693ea59b673149..0000000000000000000000000000000000000000
--- a/packages/log4cxx/package.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
-# Spack Project Developers. See the top-level COPYRIGHT file for details.
-#
-# SPDX-License-Identifier: (Apache-2.0 OR MIT)
-
-from spack import *
-
-
-class Log4cxx(AutotoolsPackage):
-    """A C++ port of Log4j"""
-
-    homepage = "https://logging.apache.org/log4cxx/latest_stable/"
-    url      = "http://mirror.netcologne.de/apache.org/logging/log4cxx/0.10.0/apache-log4cxx-0.10.0.tar.gz"
-
-    version('0.10.0', sha256='0de0396220a9566a580166e66b39674cb40efd2176f52ad2c65486c99c920c8c')
-
-    depends_on('apr-util')
-    depends_on('apr')
-    depends_on('zip')
-
-    build_directory = 'spack-build'
-
-    # patches from https://aur.archlinux.org/packages/log4cxx/
-    patch('log4cxx-0.10.0-missing_includes.patch')
-    patch('log4cxx-0.10.0-narrowing-fixes-from-upstream.patch')
-    patch('log4cxx-0.10.0-llvm-libcxx.patch', when='@0.10.0%clang')
-
-    def configure_args(self):
-        args = ['--disable-static']
-
-        return args
diff --git a/packages/oppulance/package.py b/packages/oppulance/package.py
index d307c7ab1e6e1dc74a333420ef980d1567b51b27..697e3e794afbb2036f01814c65050ba4eed866a0 100644
--- a/packages/oppulance/package.py
+++ b/packages/oppulance/package.py
@@ -18,11 +18,12 @@ class Oppulance(Package):
     depends_on('m4')
     depends_on('texinfo')
     depends_on('wget')
+    depends_on('gmp')
 
     releases = [
         {
-            'version': '4.0-a3',
-            'tag': 'ebrains-4.0-a3'
+            'version': '4.0-a4',
+            'tag': 'ebrains-4.0-a4'
         },
     ]
 
@@ -84,3 +85,9 @@ class Oppulance(Package):
         bash('ci/00_build_install_libstdc++.sh')
         mkdirp(spec.prefix)
         install_tree('install/.', spec.prefix)
+
+    @run_after('install')
+    @on_package_attributes(run_tests=True)
+    def check_install(self):
+        ppu_gcc = which('powerpc-ppu-gcc')
+        ppu_gcc('--version')
diff --git a/packages/py-torch/fj-ssl2_1.10.patch b/packages/py-torch/fj-ssl2_1.10.patch
new file mode 100644
index 0000000000000000000000000000000000000000..bcd2c37804c1ba1ee62d70907c8705a23607a5aa
--- /dev/null
+++ b/packages/py-torch/fj-ssl2_1.10.patch
@@ -0,0 +1,76 @@
+diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
+index ca560288a4..f5a29ecf43 100644
+--- a/cmake/Dependencies.cmake
++++ b/cmake/Dependencies.cmake
+@@ -130,7 +130,7 @@ else()
+   set(AT_MKLDNN_ENABLED 0)
+   set(AT_MKL_ENABLED 0)
+ endif()
+-set_property(CACHE BLAS PROPERTY STRINGS "ATLAS;BLIS;Eigen;FLAME;Generic;MKL;OpenBLAS;vecLib")
++set_property(CACHE BLAS PROPERTY STRINGS "ATLAS;BLIS;Eigen;FLAME;Generic;MKL;OpenBLAS;SSL2;vecLib")
+ message(STATUS "Trying to find preferred BLAS backend of choice: " ${BLAS})
+ 
+ if(BLAS STREQUAL "Eigen")
+@@ -185,6 +185,20 @@ elseif(BLAS STREQUAL "vecLib")
+   set(BLAS_INFO "veclib")
+   set(BLAS_FOUND 1)
+   set(BLAS_LIBRARIES ${vecLib_LINKER_LIBS})
++elseif(BLAS STREQUAL "SSL2")
++  if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
++      AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
++    message(STATUS "SSL2 Selected BLAS library")
++    list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS "fjlapackexsve.so")
++    set(SSL2_FOUND ON)
++    message(STATUS "set CMAKE_SHARED_LINKER_FLAGS: -SSL2 --linkfortran")
++    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
++    set(WITH_BLAS "ssl2")
++  else()
++    message(STATUS "Not built using fcc and FCC.")
++    message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
++    message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
++  endif()
+ elseif(BLAS STREQUAL "Generic")
+   # On Debian family, the CBLAS ABIs have been merged into libblas.so
+   find_library(BLAS_LIBRARIES blas)
+@@ -201,7 +215,7 @@ if(NOT INTERN_BUILD_MOBILE)
+   set(AT_MKL_ENABLED 0)
+   set(AT_MKL_MT 0)
+   set(USE_BLAS 1)
+-  if(NOT (ATLAS_FOUND OR BLIS_FOUND OR GENERIC_BLAS_FOUND OR MKL_FOUND OR OpenBLAS_FOUND OR VECLIB_FOUND))
++  if(NOT (ATLAS_FOUND OR BLIS_FOUND OR GENERIC_BLAS_FOUND OR MKL_FOUND OR OpenBLAS_FOUND OR SSL2_FOUND OR VECLIB_FOUND))
+     message(WARNING "Preferred BLAS (" ${BLAS} ") cannot be found, now searching for a general BLAS library")
+     find_package(BLAS)
+     if(NOT BLAS_FOUND)
+diff --git a/cmake/Modules/FindBLAS.cmake b/cmake/Modules/FindBLAS.cmake
+index 47c80b45f6..efd4a87d06 100644
+--- a/cmake/Modules/FindBLAS.cmake
++++ b/cmake/Modules/FindBLAS.cmake
+@@ -276,6 +276,28 @@ if((NOT BLAS_LIBRARIES)
+   endif()
+ endif()
+ 
++# BLAS in SSL2 library?
++if((NOT BLAS_LIBRARIES)
++    AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "ssl2")))
++  if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
++      AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
++    check_fortran_libraries(
++    BLAS_LIBRARIES
++    BLAS
++    sgemm
++    "-SSL2;--linkfortran"
++    "fjlapackexsve")
++    if (BLAS_LIBRARIES)
++      set(BLAS_INFO "ssl2")
++      set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
++    endif (BLAS_LIBRARIES)
++  else()
++    message(STATUS "Not built using fcc and FCC.")
++    message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
++    message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
++  endif()
++endif()
++
+ # Generic BLAS library?
+ if((NOT BLAS_LIBRARIES)
+     AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "generic")))
diff --git a/packages/py-torch/fj-ssl2_1.11.patch b/packages/py-torch/fj-ssl2_1.11.patch
new file mode 100644
index 0000000000000000000000000000000000000000..af41e5bb93931ca3c0f12a55733407a52fb4af31
--- /dev/null
+++ b/packages/py-torch/fj-ssl2_1.11.patch
@@ -0,0 +1,76 @@
+diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
+index 557ab649a4..56d1699736 100644
+--- a/cmake/Dependencies.cmake
++++ b/cmake/Dependencies.cmake
+@@ -174,7 +174,7 @@ else()
+   set(AT_MKLDNN_ENABLED 0)
+   set(AT_MKL_ENABLED 0)
+ endif()
+-set_property(CACHE BLAS PROPERTY STRINGS "ATLAS;BLIS;Eigen;FLAME;Generic;MKL;OpenBLAS;vecLib")
++set_property(CACHE BLAS PROPERTY STRINGS "ATLAS;BLIS;Eigen;FLAME;Generic;MKL;OpenBLAS;SSL2;vecLib")
+ message(STATUS "Trying to find preferred BLAS backend of choice: " ${BLAS})
+ 
+ if(BLAS STREQUAL "Eigen")
+@@ -229,6 +229,20 @@ elseif(BLAS STREQUAL "vecLib")
+   set(BLAS_INFO "veclib")
+   set(BLAS_FOUND 1)
+   set(BLAS_LIBRARIES ${vecLib_LINKER_LIBS})
++elseif(BLAS STREQUAL "SSL2")
++  if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
++      AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
++    message(STATUS "SSL2 Selected BLAS library")
++    list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS "fjlapackexsve.so")
++    set(SSL2_FOUND ON)
++    message(STATUS "set CMAKE_SHARED_LINKER_FLAGS: -SSL2 --linkfortran")
++    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
++    set(WITH_BLAS "ssl2")
++  else()
++    message(STATUS "Not built using fcc and FCC.")
++    message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
++    message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
++  endif()
+ elseif(BLAS STREQUAL "FlexiBLAS")
+   find_package(FlexiBLAS REQUIRED)
+   include_directories(SYSTEM ${FlexiBLAS_INCLUDE_DIR})
+@@ -250,7 +264,7 @@ if(NOT INTERN_BUILD_MOBILE)
+   set(AT_MKL_SEQUENTIAL 0)
+   set(AT_MKL_MT 0)
+   set(USE_BLAS 1)
+-  if(NOT (ATLAS_FOUND OR BLIS_FOUND OR GENERIC_BLAS_FOUND OR MKL_FOUND OR OpenBLAS_FOUND OR VECLIB_FOUND OR FlexiBLAS_FOUND))
++  if(NOT (ATLAS_FOUND OR BLIS_FOUND OR GENERIC_BLAS_FOUND OR MKL_FOUND OR OpenBLAS_FOUND OR SSL2_FOUND OR VECLIB_FOUND OR FlexiBLAS_FOUND))
+     message(WARNING "Preferred BLAS (" ${BLAS} ") cannot be found, now searching for a general BLAS library")
+     find_package(BLAS)
+     if(NOT BLAS_FOUND)
+diff --git a/cmake/Modules/FindBLAS.cmake b/cmake/Modules/FindBLAS.cmake
+index 94942d520f..ae5b8db963 100644
+--- a/cmake/Modules/FindBLAS.cmake
++++ b/cmake/Modules/FindBLAS.cmake
+@@ -289,6 +289,28 @@ if((NOT BLAS_LIBRARIES)
+   endif()
+ endif()
+ 
++# BLAS in SSL2 library?
++if((NOT BLAS_LIBRARIES)
++    AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "ssl2")))
++  if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
++      AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
++    check_fortran_libraries(
++    BLAS_LIBRARIES
++    BLAS
++    sgemm
++    "-SSL2;--linkfortran"
++    "fjlapackexsve")
++    if (BLAS_LIBRARIES)
++      set(BLAS_INFO "ssl2")
++      set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
++    endif (BLAS_LIBRARIES)
++  else()
++    message(STATUS "Not built using fcc and FCC.")
++    message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
++    message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
++  endif()
++endif()
++
+ # Generic BLAS library?
+ if((NOT BLAS_LIBRARIES)
+     AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "generic")))
diff --git a/packages/py-torch/fj-ssl2_1.2.patch b/packages/py-torch/fj-ssl2_1.2.patch
new file mode 100644
index 0000000000000000000000000000000000000000..826c5c2b078de0c152d22d73cd8208ee992fa76b
--- /dev/null
+++ b/packages/py-torch/fj-ssl2_1.2.patch
@@ -0,0 +1,76 @@
+diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
+index 00dcabd131..bddd3716ca 100644
+--- a/cmake/Dependencies.cmake
++++ b/cmake/Dependencies.cmake
+@@ -107,7 +107,7 @@ else()
+   set(AT_MKLDNN_ENABLED 0)
+   set(AT_MKL_ENABLED 0)
+ endif()
+-set_property(CACHE BLAS PROPERTY STRINGS "Eigen;ATLAS;OpenBLAS;MKL;vecLib")
++set_property(CACHE BLAS PROPERTY STRINGS "Eigen;ATLAS;OpenBLAS;MKL;vecLib;SSL2")
+ message(STATUS "Trying to find preferred BLAS backend of choice: " ${BLAS})
+ 
+ if(BLAS STREQUAL "Eigen")
+@@ -147,6 +147,20 @@ elseif(BLAS STREQUAL "vecLib")
+   find_package(vecLib REQUIRED)
+   include_directories(SYSTEM ${vecLib_INCLUDE_DIR})
+   list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS ${vecLib_LINKER_LIBS})
++elseif(BLAS STREQUAL "SSL2")
++  if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
++      AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
++    message(STATUS "SSL2 Selected BLAS library")
++    list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS "fjlapackexsve.so")
++    set(SSL2_FOUND ON)
++    message(STATUS "set CMAKE_SHARED_LINKER_FLAGS: -SSL2 --linkfortran")
++    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
++    set(WITH_BLAS "ssl2")
++  else()
++    message(STATUS "Not built using fcc and FCC.")
++    message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
++    message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
++  endif()
+ else()
+   message(FATAL_ERROR "Unrecognized BLAS option: " ${BLAS})
+ endif()
+@@ -156,7 +170,7 @@ if (NOT INTERN_BUILD_MOBILE)
+   set(AT_MKL_ENABLED 0)
+   set(AT_MKL_MT 0)
+   set(USE_BLAS 1)
+-  if(NOT (ATLAS_FOUND OR OpenBLAS_FOUND OR MKL_FOUND OR VECLIB_FOUND))
++  if(NOT (ATLAS_FOUND OR OpenBLAS_FOUND OR MKL_FOUND OR VECLIB_FOUND OR SSL2_FOUND))
+     message(WARNING "Preferred BLAS (" ${BLAS} ") cannot be found, now searching for a general BLAS library")
+     find_package(BLAS)
+     if (NOT BLAS_FOUND)
+diff --git a/cmake/Modules/FindBLAS.cmake b/cmake/Modules/FindBLAS.cmake
+index d6c0346739..72f4e18da2 100644
+--- a/cmake/Modules/FindBLAS.cmake
++++ b/cmake/Modules/FindBLAS.cmake
+@@ -225,6 +225,28 @@ if((NOT BLAS_LIBRARIES)
+   endif (BLAS_LIBRARIES)
+ endif()
+ 
++# BLAS in SSL2 library?
++if((NOT BLAS_LIBRARIES)
++    AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "ssl2")))
++  if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
++      AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
++    check_fortran_libraries(
++    BLAS_LIBRARIES
++    BLAS
++    sgemm
++    "-SSL2;--linkfortran"
++    "fjlapackexsve")
++    if (BLAS_LIBRARIES)
++      set(BLAS_INFO "ssl2")
++      set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
++    endif (BLAS_LIBRARIES)
++  else()
++    message(STATUS "Not built using fcc and FCC.")
++    message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
++    message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
++  endif()
++endif()
++
+ # Generic BLAS library?
+ if((NOT BLAS_LIBRARIES)
+     AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "generic")))
diff --git a/packages/py-torch/fj-ssl2_1.3-1.5.patch b/packages/py-torch/fj-ssl2_1.3-1.5.patch
new file mode 100644
index 0000000000000000000000000000000000000000..0ea87500b0a60e35450c90315c5466d5f6488073
--- /dev/null
+++ b/packages/py-torch/fj-ssl2_1.3-1.5.patch
@@ -0,0 +1,76 @@
+diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
+index a8e9769536..f0f91304c2 100644
+--- a/cmake/Dependencies.cmake
++++ b/cmake/Dependencies.cmake
+@@ -107,7 +107,7 @@ else()
+   set(AT_MKLDNN_ENABLED 0)
+   set(AT_MKL_ENABLED 0)
+ endif()
+-set_property(CACHE BLAS PROPERTY STRINGS "Eigen;ATLAS;OpenBLAS;MKL;vecLib;FLAME")
++set_property(CACHE BLAS PROPERTY STRINGS "Eigen;ATLAS;OpenBLAS;MKL;vecLib;SSL2;FLAME")
+ message(STATUS "Trying to find preferred BLAS backend of choice: " ${BLAS})
+ 
+ if(BLAS STREQUAL "Eigen")
+@@ -147,6 +147,20 @@ elseif(BLAS STREQUAL "vecLib")
+   find_package(vecLib REQUIRED)
+   include_directories(SYSTEM ${vecLib_INCLUDE_DIR})
+   list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS ${vecLib_LINKER_LIBS})
++elseif(BLAS STREQUAL "SSL2")
++  if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
++      AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
++    message(STATUS "SSL2 Selected BLAS library")
++    list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS "fjlapackexsve.so")
++    set(SSL2_FOUND ON)
++    message(STATUS "set CMAKE_SHARED_LINKER_FLAGS: -SSL2 --linkfortran")
++    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
++    set(WITH_BLAS "ssl2")
++  else()
++    message(STATUS "Not built using fcc and FCC.")
++    message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
++    message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
++  endif()
+ else()
+   message(FATAL_ERROR "Unrecognized BLAS option: " ${BLAS})
+ endif()
+@@ -156,7 +170,7 @@ if (NOT INTERN_BUILD_MOBILE)
+   set(AT_MKL_ENABLED 0)
+   set(AT_MKL_MT 0)
+   set(USE_BLAS 1)
+-  if(NOT (ATLAS_FOUND OR OpenBLAS_FOUND OR MKL_FOUND OR VECLIB_FOUND))
++  if(NOT (ATLAS_FOUND OR OpenBLAS_FOUND OR MKL_FOUND OR VECLIB_FOUND OR SSL2_FOUND))
+     message(WARNING "Preferred BLAS (" ${BLAS} ") cannot be found, now searching for a general BLAS library")
+     find_package(BLAS)
+     if (NOT BLAS_FOUND)
+diff --git a/cmake/Modules/FindBLAS.cmake b/cmake/Modules/FindBLAS.cmake
+index e93e98a609..d43a6c40bd 100644
+--- a/cmake/Modules/FindBLAS.cmake
++++ b/cmake/Modules/FindBLAS.cmake
+@@ -239,6 +239,28 @@ if((NOT BLAS_LIBRARIES)
+   endif (BLAS_LIBRARIES)
+ endif()
+ 
++# BLAS in SSL2 library?
++if((NOT BLAS_LIBRARIES)
++    AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "ssl2")))
++  if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
++      AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
++    check_fortran_libraries(
++    BLAS_LIBRARIES
++    BLAS
++    sgemm
++    "-SSL2;--linkfortran"
++    "fjlapackexsve")
++    if (BLAS_LIBRARIES)
++      set(BLAS_INFO "ssl2")
++      set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
++    endif (BLAS_LIBRARIES)
++  else()
++    message(STATUS "Not built using fcc and FCC.")
++    message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
++    message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
++  endif()
++endif()
++
+ # Generic BLAS library?
+ if((NOT BLAS_LIBRARIES)
+     AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "generic")))
diff --git a/packages/py-torch/fj-ssl2_1.6-1.7.patch b/packages/py-torch/fj-ssl2_1.6-1.7.patch
new file mode 100644
index 0000000000000000000000000000000000000000..423af3f21299395696d27703e531c504c19b50f4
--- /dev/null
+++ b/packages/py-torch/fj-ssl2_1.6-1.7.patch
@@ -0,0 +1,76 @@
+diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
+index 36e1ab7682..0f02f51c47 100644
+--- a/cmake/Dependencies.cmake
++++ b/cmake/Dependencies.cmake
+@@ -114,7 +114,7 @@ else()
+   set(AT_MKLDNN_ENABLED 0)
+   set(AT_MKL_ENABLED 0)
+ endif()
+-set_property(CACHE BLAS PROPERTY STRINGS "Eigen;ATLAS;OpenBLAS;MKL;vecLib;FLAME;Generic")
++set_property(CACHE BLAS PROPERTY STRINGS "Eigen;ATLAS;OpenBLAS;MKL;vecLib;SSL2;FLAME;Generic")
+ message(STATUS "Trying to find preferred BLAS backend of choice: " ${BLAS})
+ 
+ if(BLAS STREQUAL "Eigen")
+@@ -154,6 +154,20 @@ elseif(BLAS STREQUAL "vecLib")
+   find_package(vecLib REQUIRED)
+   include_directories(SYSTEM ${vecLib_INCLUDE_DIR})
+   list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS ${vecLib_LINKER_LIBS})
++elseif(BLAS STREQUAL "SSL2")
++  if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
++      AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
++    message(STATUS "SSL2 Selected BLAS library")
++    list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS "fjlapackexsve.so")
++    set(SSL2_FOUND ON)
++    message(STATUS "set CMAKE_SHARED_LINKER_FLAGS: -SSL2 --linkfortran")
++    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
++    set(WITH_BLAS "ssl2")
++  else()
++    message(STATUS "Not built using fcc and FCC.")
++    message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
++    message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
++  endif()
+ elseif(BLAS STREQUAL "Generic")
+   # On Debian family, the CBLAS ABIs have been merged into libblas.so
+   find_library(BLAS_LIBRARIES blas)
+@@ -168,7 +182,7 @@ if(NOT INTERN_BUILD_MOBILE)
+   set(AT_MKL_ENABLED 0)
+   set(AT_MKL_MT 0)
+   set(USE_BLAS 1)
+-  if(NOT (ATLAS_FOUND OR OpenBLAS_FOUND OR MKL_FOUND OR VECLIB_FOUND OR GENERIC_BLAS_FOUND))
++  if(NOT (ATLAS_FOUND OR OpenBLAS_FOUND OR MKL_FOUND OR VECLIB_FOUND OR SSL2_FOUND OR GENERIC_BLAS_FOUND))
+     message(WARNING "Preferred BLAS (" ${BLAS} ") cannot be found, now searching for a general BLAS library")
+     find_package(BLAS)
+     if(NOT BLAS_FOUND)
+diff --git a/cmake/Modules/FindBLAS.cmake b/cmake/Modules/FindBLAS.cmake
+index e93e98a609..d43a6c40bd 100644
+--- a/cmake/Modules/FindBLAS.cmake
++++ b/cmake/Modules/FindBLAS.cmake
+@@ -239,6 +239,28 @@ if((NOT BLAS_LIBRARIES)
+   endif (BLAS_LIBRARIES)
+ endif()
+ 
++# BLAS in SSL2 library?
++if((NOT BLAS_LIBRARIES)
++    AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "ssl2")))
++  if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
++      AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
++    check_fortran_libraries(
++    BLAS_LIBRARIES
++    BLAS
++    sgemm
++    "-SSL2;--linkfortran"
++    "fjlapackexsve")
++    if (BLAS_LIBRARIES)
++      set(BLAS_INFO "ssl2")
++      set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
++    endif (BLAS_LIBRARIES)
++  else()
++    message(STATUS "Not built using fcc and FCC.")
++    message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
++    message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
++  endif()
++endif()
++
+ # Generic BLAS library?
+ if((NOT BLAS_LIBRARIES)
+     AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "generic")))
diff --git a/packages/py-torch/fj-ssl2_1.8.patch b/packages/py-torch/fj-ssl2_1.8.patch
new file mode 100644
index 0000000000000000000000000000000000000000..461c1a2976b7a118173182452075e809f7f52858
--- /dev/null
+++ b/packages/py-torch/fj-ssl2_1.8.patch
@@ -0,0 +1,76 @@
+diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
+index 06464e799a..7f50bd8fa0 100644
+--- a/cmake/Dependencies.cmake
++++ b/cmake/Dependencies.cmake
+@@ -118,7 +118,7 @@ else()
+   set(AT_MKLDNN_ENABLED 0)
+   set(AT_MKL_ENABLED 0)
+ endif()
+-set_property(CACHE BLAS PROPERTY STRINGS "Eigen;ATLAS;OpenBLAS;MKL;vecLib;FLAME;Generic")
++set_property(CACHE BLAS PROPERTY STRINGS "Eigen;ATLAS;OpenBLAS;MKL;vecLib;SSL2;FLAME;Generic")
+ message(STATUS "Trying to find preferred BLAS backend of choice: " ${BLAS})
+ 
+ if(BLAS STREQUAL "Eigen")
+@@ -157,6 +157,20 @@ elseif(BLAS STREQUAL "vecLib")
+   find_package(vecLib REQUIRED)
+   include_directories(SYSTEM ${vecLib_INCLUDE_DIR})
+   list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS ${vecLib_LINKER_LIBS})
++elseif(BLAS STREQUAL "SSL2")
++  if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
++      AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
++    message(STATUS "SSL2 Selected BLAS library")
++    list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS "fjlapackexsve.so")
++    set(SSL2_FOUND ON)
++    message(STATUS "set CMAKE_SHARED_LINKER_FLAGS: -SSL2 --linkfortran")
++    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
++    set(WITH_BLAS "ssl2")
++  else()
++    message(STATUS "Not built using fcc and FCC.")
++    message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
++    message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
++  endif()
+ elseif(BLAS STREQUAL "Generic")
+   # On Debian family, the CBLAS ABIs have been merged into libblas.so
+   find_library(BLAS_LIBRARIES blas)
+@@ -171,7 +185,7 @@ if(NOT INTERN_BUILD_MOBILE)
+   set(AT_MKL_ENABLED 0)
+   set(AT_MKL_MT 0)
+   set(USE_BLAS 1)
+-  if(NOT (ATLAS_FOUND OR OpenBLAS_FOUND OR MKL_FOUND OR VECLIB_FOUND OR GENERIC_BLAS_FOUND))
++  if(NOT (ATLAS_FOUND OR OpenBLAS_FOUND OR MKL_FOUND OR VECLIB_FOUND OR SSL2_FOUND OR GENERIC_BLAS_FOUND))
+     message(WARNING "Preferred BLAS (" ${BLAS} ") cannot be found, now searching for a general BLAS library")
+     find_package(BLAS)
+     if(NOT BLAS_FOUND)
+diff --git a/cmake/Modules/FindBLAS.cmake b/cmake/Modules/FindBLAS.cmake
+index e8f5d7c950..29219e057f 100644
+--- a/cmake/Modules/FindBLAS.cmake
++++ b/cmake/Modules/FindBLAS.cmake
+@@ -257,6 +257,28 @@ if((NOT BLAS_LIBRARIES)
+   endif()
+ endif()
+ 
++# BLAS in SSL2 library?
++if((NOT BLAS_LIBRARIES)
++    AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "ssl2")))
++  if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
++      AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
++    check_fortran_libraries(
++    BLAS_LIBRARIES
++    BLAS
++    sgemm
++    "-SSL2;--linkfortran"
++    "fjlapackexsve")
++    if (BLAS_LIBRARIES)
++      set(BLAS_INFO "ssl2")
++      set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
++    endif (BLAS_LIBRARIES)
++  else()
++    message(STATUS "Not built using fcc and FCC.")
++    message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
++    message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
++  endif()
++endif()
++
+ # Generic BLAS library?
+ if((NOT BLAS_LIBRARIES)
+     AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "generic")))
diff --git a/packages/py-torch/fj-ssl2_1.9.patch b/packages/py-torch/fj-ssl2_1.9.patch
new file mode 100644
index 0000000000000000000000000000000000000000..0febb57586fc1297ac21c1707e1c9cfc93da819d
--- /dev/null
+++ b/packages/py-torch/fj-ssl2_1.9.patch
@@ -0,0 +1,76 @@
+diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
+index 5d57b9ca78..a74fe73b9f 100644
+--- a/cmake/Dependencies.cmake
++++ b/cmake/Dependencies.cmake
+@@ -118,7 +118,7 @@ else()
+   set(AT_MKLDNN_ENABLED 0)
+   set(AT_MKL_ENABLED 0)
+ endif()
+-set_property(CACHE BLAS PROPERTY STRINGS "ATLAS;BLIS;Eigen;FLAME;Generic;MKL;OpenBLAS;vecLib")
++set_property(CACHE BLAS PROPERTY STRINGS "ATLAS;BLIS;Eigen;FLAME;Generic;MKL;OpenBLAS;SSL2;vecLib")
+ message(STATUS "Trying to find preferred BLAS backend of choice: " ${BLAS})
+ 
+ if(BLAS STREQUAL "Eigen")
+@@ -161,6 +161,20 @@ elseif(BLAS STREQUAL "vecLib")
+   find_package(vecLib REQUIRED)
+   include_directories(SYSTEM ${vecLib_INCLUDE_DIR})
+   list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS ${vecLib_LINKER_LIBS})
++elseif(BLAS STREQUAL "SSL2")
++  if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
++      AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
++    message(STATUS "SSL2 Selected BLAS library")
++    list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS "fjlapackexsve.so")
++    set(SSL2_FOUND ON)
++    message(STATUS "set CMAKE_SHARED_LINKER_FLAGS: -SSL2 --linkfortran")
++    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
++    set(WITH_BLAS "ssl2")
++  else()
++    message(STATUS "Not built using fcc and FCC.")
++    message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
++    message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
++  endif()
+ elseif(BLAS STREQUAL "Generic")
+   # On Debian family, the CBLAS ABIs have been merged into libblas.so
+   find_library(BLAS_LIBRARIES blas)
+@@ -175,7 +189,7 @@ if(NOT INTERN_BUILD_MOBILE)
+   set(AT_MKL_ENABLED 0)
+   set(AT_MKL_MT 0)
+   set(USE_BLAS 1)
+-  if(NOT (ATLAS_FOUND OR BLIS_FOUND OR GENERIC_BLAS_FOUND OR MKL_FOUND OR OpenBLAS_FOUND OR VECLIB_FOUND))
++  if(NOT (ATLAS_FOUND OR BLIS_FOUND OR GENERIC_BLAS_FOUND OR MKL_FOUND OR OpenBLAS_FOUND OR SSL2_FOUND OR VECLIB_FOUND))
+     message(WARNING "Preferred BLAS (" ${BLAS} ") cannot be found, now searching for a general BLAS library")
+     find_package(BLAS)
+     if(NOT BLAS_FOUND)
+diff --git a/cmake/Modules/FindBLAS.cmake b/cmake/Modules/FindBLAS.cmake
+index eefd6d475a..92ad75d32e 100644
+--- a/cmake/Modules/FindBLAS.cmake
++++ b/cmake/Modules/FindBLAS.cmake
+@@ -276,6 +276,28 @@ if((NOT BLAS_LIBRARIES)
+   endif()
+ endif()
+ 
++# BLAS in SSL2 library?
++if((NOT BLAS_LIBRARIES)
++    AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "ssl2")))
++  if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
++      AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
++    check_fortran_libraries(
++    BLAS_LIBRARIES
++    BLAS
++    sgemm
++    "-SSL2;--linkfortran"
++    "fjlapackexsve")
++    if (BLAS_LIBRARIES)
++      set(BLAS_INFO "ssl2")
++      set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
++    endif (BLAS_LIBRARIES)
++  else()
++    message(STATUS "Not built using fcc and FCC.")
++    message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
++    message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
++  endif()
++endif()
++
+ # Generic BLAS library?
+ if((NOT BLAS_LIBRARIES)
+     AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "generic")))
diff --git a/packages/py-torch/package.py b/packages/py-torch/package.py
index de0c36bea5240150e4539069c405233b7c685a9b..ce683443e9bf9226393edf7ed102ab6bdd3f2f9b 100644
--- a/packages/py-torch/package.py
+++ b/packages/py-torch/package.py
@@ -23,6 +23,7 @@ class PyTorch(PythonPackage, CudaPackage):
     import_modules = ['torch', 'torch.autograd', 'torch.nn', 'torch.utils']
 
     version('master', branch='master', submodules=True)
+    version('1.11.0', tag='v1.11.0', submodules=True)
     version('1.10.2', tag='v1.10.2', submodules=True)
     version('1.10.1', tag='v1.10.1', submodules=True)
     version('1.10.0', tag='v1.10.0', submodules=True)
@@ -48,6 +49,7 @@ class PyTorch(PythonPackage, CudaPackage):
 
     # All options are defined in CMakeLists.txt.
     # Some are listed in setup.py, but not all.
+    variant('debug', default=False, description="Build with debugging support")
     variant('caffe2', default=True, description='Build Caffe2', when='@1.7:')
     variant('test', default=False, description='Build C++ test binaries')
     variant('cuda', default=not is_darwin, description='Use CUDA')
@@ -87,10 +89,13 @@ class PyTorch(PythonPackage, CudaPackage):
               'https://developer.nvidia.com/cuda-gpus')
 
     # Required dependencies
+    depends_on('cmake@3.13:', when='@1.11:', type='build')
+    depends_on('cmake@3.10:', when='@1.10:', type='build')
     depends_on('cmake@3.5:', type='build')
     # Use Ninja generator to speed up build times, automatically used if found
     depends_on('ninja@1.5:', when='@1.1:', type='build')
     # See python_min_version in setup.py
+    depends_on('python@3.7:', when='@1.11:', type=('build', 'link', 'run'))
     depends_on('python@3.6.2:', when='@1.7.1:', type=('build', 'link', 'run'))
     depends_on('python@3.6.1:', when='@1.6:1.7.0', type=('build', 'link', 'run'))
     depends_on('python@3.5:', when='@1.5', type=('build', 'link', 'run'))
@@ -135,9 +140,9 @@ class PyTorch(PythonPackage, CudaPackage):
     # Optional dependencies
     # https://discuss.pytorch.org/t/compiling-1-10-1-from-source-with-gcc-11-and-cuda-11-5/140971
     depends_on('cuda@9.2:', when='@1.11:+cuda', type=('build', 'link', 'run'))
-    depends_on('cuda@9.2:11.4', when='@1.6:+cuda', type=('build', 'link', 'run'))
-    depends_on('cuda@9:11.4', when='@1.1:+cuda', type=('build', 'link', 'run'))
-    depends_on('cuda@7.5:11.4', when='+cuda', type=('build', 'link', 'run'))
+    depends_on('cuda@9.2:11.4', when='@1.6:1.10+cuda', type=('build', 'link', 'run'))
+    depends_on('cuda@9:11.4', when='@1.1:1.5+cuda', type=('build', 'link', 'run'))
+    depends_on('cuda@7.5:11.4', when='@:1.0+cuda', type=('build', 'link', 'run'))
     depends_on('cudnn@6:7', when='@:1.0+cudnn')
     depends_on('cudnn@7.0:7', when='@1.1:1.5+cudnn')
     depends_on('cudnn@7:', when='@1.6:+cudnn')
@@ -166,13 +171,13 @@ class PyTorch(PythonPackage, CudaPackage):
 
     # Fix BLAS being overridden by MKL
     # https://github.com/pytorch/pytorch/issues/60328
-    patch('https://patch-diff.githubusercontent.com/raw/pytorch/pytorch/pull/59220.patch',
-          sha256='e37afffe45cf7594c22050109942370e49983ad772d12ebccf508377dc9dcfc9',
+    patch('https://github.com/pytorch/pytorch/pull/59220.patch?full_index=1',
+          sha256='6d5717267f901e8ee493dfacd08734d9bcc48ad29a76ca9ef702368e96bee675',
           when='@1.2:')
 
     # Fixes build on older systems with glibc <2.12
-    patch('https://patch-diff.githubusercontent.com/raw/pytorch/pytorch/pull/55063.patch',
-          sha256='e17eaa42f5d7c18bf0d7c37d7b0910127a01ad53fdce3e226a92893356a70395',
+    patch('https://github.com/pytorch/pytorch/pull/55063.patch?full_index=1',
+          sha256='2229bcbf20fbe88aa9f7318f89c126ec7f527875ffe689a763c78abfa127a65c',
           when='@1.1:1.8.1')
 
     # Fixes CMake configuration error when XNNPACK is disabled
@@ -190,8 +195,8 @@ class PyTorch(PythonPackage, CudaPackage):
 
     # Fixes compilation with Clang 9.0.0 and Apple Clang 11.0.3
     # https://github.com/pytorch/pytorch/pull/37086
-    patch('https://github.com/pytorch/pytorch/commit/e921cd222a8fbeabf5a3e74e83e0d8dfb01aa8b5.patch',
-          sha256='17561b16cd2db22f10c0fe1fdcb428aecb0ac3964ba022a41343a6bb8cba7049',
+    patch('https://github.com/pytorch/pytorch/commit/e921cd222a8fbeabf5a3e74e83e0d8dfb01aa8b5.patch?full_index=1',
+          sha256='0f3ad037a95af9d34b1d085050c1e7771fd00f0b89e5b3a276097b7c9f4fabf8',
           when='@1.1:1.5')
 
     # Removes duplicate definition of getCusparseErrorString
@@ -202,10 +207,37 @@ class PyTorch(PythonPackage, CudaPackage):
     # to detect openmp settings used by Fujitsu compiler.
     patch('detect_omp_of_fujitsu_compiler.patch', when='%fj')
 
+    # Fixes to build with fujitsu-ssl2
+    patch('fj-ssl2_1.11.patch', when='@1.11:^fujitsu-ssl2')
+    patch('fj-ssl2_1.10.patch', when='@1.10^fujitsu-ssl2')
+    patch('fj-ssl2_1.9.patch', when='@1.9^fujitsu-ssl2')
+    patch('fj-ssl2_1.8.patch', when='@1.8^fujitsu-ssl2')
+    patch('fj-ssl2_1.6-1.7.patch', when='@1.6:1.7^fujitsu-ssl2')
+    patch('fj-ssl2_1.3-1.5.patch', when='@1.3:1.5^fujitsu-ssl2')
+    patch('fj-ssl2_1.2.patch', when='@1.2^fujitsu-ssl2')
+
     # Fix compilation of +distributed~tensorpipe
     # https://github.com/pytorch/pytorch/issues/68002
-    patch('https://github.com/pytorch/pytorch/commit/c075f0f633fa0136e68f0a455b5b74d7b500865c.patch',
-          sha256='e69e41b5c171bfb00d1b5d4ee55dd5e4c8975483230274af4ab461acd37e40b8', when='@1.10.0+distributed~tensorpipe')
+    patch('https://github.com/pytorch/pytorch/commit/c075f0f633fa0136e68f0a455b5b74d7b500865c.patch?full_index=1',
+          sha256='41271e494a3a60a65a8dd45ac053d1a6e4e4d5b42c2dac589ac67524f61ac41e', when='@1.10.0+distributed~tensorpipe')
+
+    # Use patches from IBM's Open CE to enable building on Power systems
+    # 03xx - patch temporary to fix a problem that when fixed upstream can be removed
+    patch('https://github.com/open-ce/pytorch-feedstock/raw/main/recipe/0302-cpp-extension.patch',
+          sha256='ecb3973fa7d0f4c8f8ae40433f3ca5622d730a7b16f6cb63325d1e95baff8aa2', when='@1.10.0: arch=ppc64le:')
+
+    patch('https://github.com/open-ce/pytorch-feedstock/raw/main/recipe/0311-PR66085-Remove-unused-dump-method-from-VSX-vec256-methods.patch',
+          sha256='f05db59f3def4c4215db7142d81029c73fe330c660492159b66d65ca5001f4d1', when='@1.10.0: arch=ppc64le:')
+
+    patch('https://github.com/open-ce/pytorch-feedstock/raw/main/recipe/0312-PR67331-Dummpy-VSX-bfloat16-implementation.patch',
+          sha256='860b64afa85f5e6647ebc3c91d5a0bb258784770900c9302c3599c98d5cff1ee', when='@1.10.0: arch=ppc64le:')
+
+    patch('https://github.com/open-ce/pytorch-feedstock/raw/main/recipe/0313-add-missing-vsx-dispatch.patch',
+          sha256='7393c2bc0b6d41ecc813c829a1e517bee864686652e91f174cb7bcdfb10ba451', when='@1.10.0: arch=ppc64le:')
+
+    # Cherry-pick a patch to allow earlier versions of PyTorch to work with CUDA 11.4
+    patch('https://github.com/pytorch/pytorch/commit/c74c0c571880df886474be297c556562e95c00e0.patch?full_index=1',
+          sha256='8ff7d285e52e4718bad1ca01ceb3bb6471d7828329036bb94222717fcaa237da', when='@:1.9.1 ^cuda@11.4.100:')
 
     @property
     def libs(self):
@@ -287,6 +319,10 @@ class PyTorch(PythonPackage, CudaPackage):
                                        in
                                        self.spec.variants['cuda_arch'].value)
             env.set('TORCH_CUDA_ARCH_LIST', torch_cuda_arch)
+            if self.spec.satisfies('%clang'):
+                for flag in self.spec.compiler_flags['cxxflags']:
+                    if 'gcc-toolchain' in flag:
+                        env.set('CMAKE_CUDA_FLAGS', '=-Xcompiler={0}'.format(flag))
 
         enable_or_disable('rocm')
 
@@ -330,6 +366,11 @@ class PyTorch(PythonPackage, CudaPackage):
         enable_or_disable('gloo', newer=True)
         enable_or_disable('tensorpipe')
 
+        if '+debug' in self.spec:
+            env.set('DEBUG', 'ON')
+        else:
+            env.set('DEBUG', 'OFF')
+
         if '+onnx_ml' in self.spec:
             env.set('ONNX_ML', 'ON')
         elif '~onnx_ml' in self.spec:
@@ -356,12 +397,20 @@ class PyTorch(PythonPackage, CudaPackage):
                 'intel-mkl', 'intel-parallel-studio', 'intel-oneapi-mkl']:
             env.set('BLAS', 'MKL')
             env.set('WITH_BLAS', 'mkl')
+            # help find MKL
+            if self.spec['mkl'].name == 'intel-oneapi-mkl':
+                env.set('INTEL_MKL_DIR', self.spec['mkl'].prefix.mkl.latest)
+            else:
+                env.set('INTEL_MKL_DIR', self.spec['mkl'].prefix.mkl)
         elif self.spec['blas'].name == 'openblas':
             env.set('BLAS', 'OpenBLAS')
             env.set('WITH_BLAS', 'open')
         elif self.spec['blas'].name == 'veclibfort':
             env.set('BLAS', 'vecLib')
             env.set('WITH_BLAS', 'veclib')
+        elif self.spec['blas'].name == 'fujitsu-ssl2':
+            env.set('BLAS', 'SSL2')
+            env.set('WITH_BLAS', 'ssl2')
         else:
             env.set('BLAS', 'Generic')
             env.set('WITH_BLAS', 'generic')
diff --git a/packages/pynn-brainscales/package.py b/packages/pynn-brainscales/package.py
index 195820f65693a5fc301ac67add5afb71c502335c..76b7ca3097fdbca0d8b2c0f1287886a407f15ed7 100644
--- a/packages/pynn-brainscales/package.py
+++ b/packages/pynn-brainscales/package.py
@@ -5,7 +5,6 @@
 import os
 
 from spack import *
-from spack.pkg.builtin.boost import Boost
 
 
 class PynnBrainscales(WafPackage):
@@ -14,27 +13,26 @@ class PynnBrainscales(WafPackage):
     homepage = "https://github.com/electronicvisions/pynn-brainscales"
     git      = "https://github.com/electronicvisions/pynn-brainscales.git"
 
-    version('4.0-a3', branch='waf')
+    version('4.0-a4', branch='waf')
 
     # PPU compiler dependencies
-    depends_on('oppulance@4.0-a3')
+    depends_on('oppulance@4.0-a4')
 
     # host software dependencies
     depends_on('bitsery', type=('build', 'link', 'run'))
     depends_on('binutils+gold+ld+plugins', type=('build', 'link', 'run')) # specialize
-    depends_on(Boost.with_default_variants)
-    depends_on('boost@1.69.0: +graph+icu+mpi+python+numpy+coroutine+context cxxstd=17', type=('build', 'link', 'run')) # specialize boost (non-clingo, type=('build', 'link', 'run'))
+    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')) # specialize boost (non-clingo, type=('build', 'link', 'run'))
     depends_on('cereal', type=('build', 'link', 'run'))
     depends_on('cppcheck', type=('build', 'link', 'run'))
     depends_on('doxygen+graphviz', type=('build', 'link', 'run'))
     depends_on('genpybind@ebrains', type=('build', 'link', 'run'))
     depends_on('gflags', type=('build', 'link', 'run'))
-    depends_on('googletest@1.11.0: +gmock', type=('build', 'link', 'run')) # variadic templates needed
+    depends_on('googletest@1.11.0:+gmock', type=('build', 'link', 'run')) # variadic templates needed
     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('llvm', type=('build', 'link', 'run'))
-    depends_on('log4cxx', type=('build', 'link', 'run'))
+    depends_on('log4cxx@0.12.1:', type=('build', 'link', 'run'))
     depends_on('pkgconfig', type=('build', 'link', 'run'))
     depends_on('python@3.7.0:', type=('build', 'link', 'run')) # BrainScaleS(-2, type=('build', 'link', 'run')) only supports Python >= 3.7
     depends_on('py-deap@1.3.1:', type=('build', 'link', 'run'))
@@ -61,31 +59,37 @@ class PynnBrainscales(WafPackage):
         configuration."""
 
         include = []
-        for dep in self.spec.traverse(deptype='build'):
+        include_exclude_dirs = set(['/usr/include'])
+        for dep in self.spec.traverse(deptype='build', root=False):
             query = self.spec[dep.name]
             try:
-                include.extend(query.headers.directories)
-                print('headers:', query.headers.directories, "\n")
-            except:
+                include_dirs = set(query.headers.directories)
+                include_dirs -= include_exclude_dirs
+                print('headers (', dep.name, '):', include_dirs, "\n")
+                include.extend(list(include_dirs))
+            except spack.error.NoHeadersError:
+                # we don't care if no header directories are found
                 pass
 
         library = []
-        for dep in self.spec.traverse(deptype=('link', 'run')):
+        library_exclude_dirs = set(['/lib', '/lib64', '/usr/lib', '/usr/lib64'])
+        for dep in self.spec.traverse(deptype=('link', 'run'), root=False):
             query = self.spec[dep.name]
             try:
-                library.extend(query.libs.directories)
-                print('libs:', query.libs.directories, "\n")
-            except:
+                library_dirs = set(query.libs.directories)
+                library_dirs -= library_exclude_dirs
+                print('libs (', dep.name, '):', library_dirs, "\n")
+                library.extend(list(library_dirs))
+            except spack.error.NoLibrariesError:
+                # we don't care if no library directories are found
                 pass
 
         path = []
-        for dep in self.spec.traverse(deptype=('build', 'link', 'run')):
+        for dep in self.spec.traverse(deptype=('build', 'link', 'run'), root=False):
             query = self.spec[dep.name]
-            try:
+            if os.path.exists(self.prefix.bin):
                 path.append(query.prefix.bin)
-                print('bin:', query.prefix.bin, "\n")
-            except:
-                pass
+                print('bin (', dep.name, '):', query.prefix.bin, "\n")
 
         # llvm might be built with ~shared_libs but still builds shared libs
         if not any('llvm' in lib for lib in library):
@@ -138,5 +142,15 @@ class PynnBrainscales(WafPackage):
 
     def build_args(self):
         args = ['--keep', '--test-execnone', '-v']
+        return args
 
+    def build_test(self):
+        self.waf('install', '--test-execall')
+
+    def install_args(self):
+        args = ['--test-execnone']
         return args
+
+    def install_test(self):
+        with working_dir('spack-test', create=True):
+            python('-c', 'import pynn_brainscales; print(pynn_brainscales.__file__)')
diff --git a/spack.yaml b/spack.yaml
index 55e1158ca8ba3d331353389dd052c06a77f26ef8..37d8d2ca0bcb85843dfaf9c1d9313ccb67407c50 100644
--- a/spack.yaml
+++ b/spack.yaml
@@ -30,8 +30,8 @@ spack:
     - py-pyaescrypt
     - py-formencode
     - tvb-framework ^binutils+ld+gold
-    - pynn-brainscales@4.0-a3 ^log4cxx@0.10.0 ^googletest@1.11.0:+gmock
-    - hxtorch@4.0-a3 ^log4cxx@0.10.0 ^googletest@1.11.0:+gmock
+    - pynn-brainscales@4.0-a4
+    - hxtorch@4.0-a4
     - py-neo
     - py-hdmf
     - py-pynwb
@@ -55,8 +55,6 @@ spack:
     - py-hippounit@1.3.6
     - py-efel@4.0.4
     - py-hbp-neuromorphic-platform@0.10.1
-    - py-torch~cuda~rocm~valgrind~mkldnn~mpi~gloo+tensorpipe~onnx_ml@1.9.1 ^protobuf@:3.17.999
-    - py-torchvision
     - py-lfpy@2.3
     - py-elephant
     - py-frites