Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ebrains-spack-builds
Manage
Activity
Members
Labels
Plan
Issues
40
Issue boards
Milestones
Wiki
Code
Merge requests
29
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EBRAINS RI
Tech Hub
Platform
EBRAINS Software Distribution
ebrains-spack-builds
Merge requests
!508
feat(BSS2): Add and enable jaxsnn
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
feat(BSS2): Add and enable jaxsnn
feat_jaxsnn
into
master
Overview
17
Commits
4
Pipelines
14
Changes
6
Merged
Eric Müller
requested to merge
feat_jaxsnn
into
master
1 year ago
Overview
17
Commits
4
Pipelines
14
Changes
6
Expand
This adds
jaxsnn
to the ESD.
(Just testing for now…)
0
0
Merge request reports
Compare
master
version 14
25eb3601
1 year ago
version 13
783a108d
1 year ago
version 12
783a108d
1 year ago
version 11
783a108d
1 year ago
version 10
15d17514
1 year ago
version 9
85367493
1 year ago
version 8
6c0c924b
1 year ago
version 7
9e36e3be
1 year ago
version 6
a5c6d26c
1 year ago
version 5
7d291b22
1 year ago
version 4
897fd74f
1 year ago
version 3
2f0779cb
1 year ago
version 2
a34e535c
1 year ago
version 1
656081cb
1 year ago
master (base)
and
latest version
latest version
156f31d4
4 commits,
1 year ago
version 14
25eb3601
4 commits,
1 year ago
version 13
783a108d
4 commits,
1 year ago
version 12
783a108d
55 commits,
1 year ago
version 11
783a108d
4 commits,
1 year ago
version 10
15d17514
4 commits,
1 year ago
version 9
85367493
4 commits,
1 year ago
version 8
6c0c924b
4 commits,
1 year ago
version 7
9e36e3be
4 commits,
1 year ago
version 6
a5c6d26c
4 commits,
1 year ago
version 5
7d291b22
4 commits,
1 year ago
version 4
897fd74f
3 commits,
1 year ago
version 3
2f0779cb
3 commits,
1 year ago
version 2
a34e535c
2 commits,
1 year ago
version 1
656081cb
2 commits,
1 year ago
6 files
+
399
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
6
Search (e.g. *.vue) (Ctrl+P)
packages/jaxsnn/package.py
0 → 100644
+
157
−
0
Options
# Copyright 2013-2022 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)
import
os
import
unittest.mock
import
xml.etree.ElementTree
as
ET
from
spack
import
*
from
spack.util.environment
import
EnvironmentModifications
import
spack.build_environment
class
Jaxsnn
(
WafPackage
):
"""
jaxsnn is an event-based approach to machine-learning-inspired training
and simulation of SNNs, including support for the BrainScaleS-2
neuromorphic backend.
"""
homepage
=
"
https://github.com/electronicvisions/jaxsnn
"
# This repo provides a custom waf binary used for the build below
git
=
"
https://github.com/electronicvisions/pynn-brainscales.git
"
maintainers
=
[
'
emuller
'
]
version
(
'
8.0-a3
'
,
tag
=
'
jaxsnn-8.0-a3
'
)
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
'
))
# main dependencies w/o hxtorch.core dependencies (those come via hxtorch above)
depends_on
(
'
py-jax@0.4.13:
'
,
type
=
(
'
build
'
,
'
link
'
,
'
run
'
))
depends_on
(
'
py-matplotlib
'
,
type
=
(
'
build
'
,
'
link
'
,
'
run
'
))
depends_on
(
'
py-optax
'
,
type
=
(
'
build
'
,
'
link
'
,
'
run
'
))
depends_on
(
'
py-tree-math
'
,
type
=
(
'
build
'
,
'
link
'
,
'
run
'
))
extends
(
'
python
'
)
def
do_fetch
(
self
,
mirror_only
=
False
):
"""
Setup the project.
"""
self
.
stage
.
create
()
self
.
stage
.
fetch
(
mirror_only
)
# if fetcher didn't do anything, it's cached already
if
not
os
.
path
.
exists
(
self
.
stage
.
source_path
):
return
with
working_dir
(
self
.
stage
.
source_path
):
python
=
which
(
'
python3
'
)
python
(
'
./waf
'
,
'
setup
'
,
'
--repo-db-url=https://github.com/electronicvisions/projects
'
,
'
--clone-depth=2
'
,
'
--without-munge
'
,
'
--without-hxcomm-hostarq
'
,
'
--project=jaxsnn
'
,
'
--release-branch=ebrains-
'
+
str
(
self
.
spec
.
version
)
)
# in the configure step, we need access to all archived .git folders
def
custom_archive
(
self
,
destination
):
super
(
spack
.
fetch_strategy
.
GitFetchStrategy
,
self
).
archive
(
destination
)
with
unittest
.
mock
.
patch
(
'
spack.fetch_strategy.GitFetchStrategy.archive
'
,
new
=
custom_archive
):
self
.
stage
.
cache_local
()
def
_setup_common_env
(
self
,
env
):
# grenade needs to find some libraries for the JIT-compilation of
# programs for BrainScaleS-2's embedded processor.
ppu_include_dirs
=
[]
ppu_dep_names
=
[
'
bitsery
'
,
'
boost
'
,
'
cereal
'
]
for
ppu_dep_name
in
ppu_dep_names
:
dep
=
self
.
spec
[
ppu_dep_name
]
dep_include_dirs
=
set
(
dep
.
headers
.
directories
)
ppu_include_dirs
.
extend
(
list
(
dep_include_dirs
))
for
dir
in
reversed
(
ppu_include_dirs
):
env
.
prepend_path
(
"
C_INCLUDE_PATH
"
,
dir
)
env
.
prepend_path
(
"
CPLUS_INCLUDE_PATH
"
,
dir
)
def
setup_build_environment
(
self
,
env
):
my_envmod
=
EnvironmentModifications
(
env
)
spack
.
build_environment
.
set_wrapper_variables
(
self
,
my_envmod
)
my_env
=
{}
my_envmod
.
apply_modifications
(
my_env
)
def
get_path
(
env
,
name
):
path
=
env
.
get
(
name
,
""
).
strip
()
if
path
:
return
path
.
split
(
os
.
pathsep
)
return
[]
# spack tries to find headers and libraries by itself (i.e. it's not
# relying on the compiler to find it); we explicitly expose the
# spack-provided env vars that contain include and library paths
if
'
SPACK_INCLUDE_DIRS
'
in
my_env
:
for
dir
in
reversed
(
get_path
(
my_env
,
"
SPACK_INCLUDE_DIRS
"
)):
env
.
prepend_path
(
"
C_INCLUDE_PATH
"
,
dir
)
env
.
prepend_path
(
"
CPLUS_INCLUDE_PATH
"
,
dir
)
if
'
SPACK_LINK_DIRS
'
in
my_env
:
for
dir
in
reversed
(
get_path
(
my_env
,
"
SPACK_LINK_DIRS
"
)):
env
.
prepend_path
(
"
LIBRARY_PATH
"
,
dir
)
env
.
prepend_path
(
"
LD_LIBRARY_PATH
"
,
dir
)
for
dir
in
reversed
(
self
.
compiler
.
implicit_rpaths
()):
env
.
prepend_path
(
"
LIBRARY_PATH
"
,
dir
)
# technically this is probably not needed for the non-configure steps
env
.
prepend_path
(
"
LD_LIBRARY_PATH
"
,
dir
)
def
setup_dependent_build_environment
(
self
,
env
,
dependent_spec
):
self
.
_setup_common_env
(
env
)
def
setup_run_environment
(
self
,
env
):
self
.
_setup_common_env
(
env
)
def
setup_dependent_run_environment
(
self
,
env
,
dependent_spec
):
self
.
_setup_common_env
(
env
)
# override configure step as we perform a project setup first
def
configure
(
self
,
spec
,
prefix
):
"""
Configure the project.
"""
args
=
[
'
--prefix={0}
'
.
format
(
self
.
prefix
)]
args
+=
self
.
configure_args
()
self
.
waf
(
'
configure
'
,
'
--build-profile=release
'
,
'
--disable-doxygen
'
,
*
args
)
def
build_args
(
self
):
args
=
[
'
--keep
'
,
'
--test-execnone
'
,
'
-v
'
]
return
args
def
build_test
(
self
):
self
.
builder
.
waf
(
'
build
'
,
'
--test-execall
'
)
copy_tree
(
'
build/test_results
'
,
join_path
(
self
.
prefix
,
'
.build
'
))
copy_tree
(
'
build/test_results
'
,
join_path
(
self
.
stage
.
path
,
"
.install_time_tests
"
))
# propagate failures from junit output to spack
tree
=
ET
.
parse
(
'
build/test_results/summary.xml
'
)
for
testsuite
in
tree
.
getroot
():
for
testcase
in
testsuite
:
if
(
testcase
.
get
(
'
name
'
).
startswith
(
"
pycodestyle
"
)
or
testcase
.
get
(
'
name
'
).
startswith
(
"
pylint
"
)):
continue
for
elem
in
testcase
:
if
(
elem
.
tag
==
'
failure
'
)
and
not
(
elem
.
get
(
'
message
'
).
startswith
(
"
pylint:
"
)
or
elem
.
get
(
'
message
'
).
startswith
(
"
pycodestyle:
"
)
or
(
"
OK
"
in
elem
.
get
(
'
message
'
)
and
"
Segmentation fault
"
in
elem
.
get
(
'
message
'
))):
raise
RuntimeError
(
"
Failed test found: {}
"
.
format
(
testcase
.
get
(
'
name
'
)))
def
install_args
(
self
):
args
=
[
'
--test-execnone
'
]
return
args
def
install_test
(
self
):
with
working_dir
(
'
spack-test
'
,
create
=
True
):
old_pythonpath
=
os
.
environ
.
get
(
'
PYTHONPATH
'
,
''
)
os
.
environ
[
'
PYTHONPATH
'
]
=
'
:
'
.
join
([
str
(
self
.
prefix
.
lib
),
old_pythonpath
])
bash
=
which
(
"
bash
"
)
# ignore segfaults for now (exit code 139)
bash
(
'
-c
'
,
'
(python -c
"
import jaxsnn; print(jaxsnn.__file__)
"
|| ( test $? -eq 139 && echo
"
segfault
"
)) || exit $?
'
)