Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
xerus
xerus
Commits
7e9d8462
Commit
7e9d8462
authored
Apr 09, 2020
by
Philipp Trunschke
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'pybind11' into vmc
parents
c316d639
9622eaed
Pipeline
#1940
failed with stages
in 11 minutes and 41 seconds
Changes
54
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
54 changed files
with
2121 additions
and
1879 deletions
+2121
-1879
.gitattributes
.gitattributes
+2
-0
.gitconfig
.gitconfig
+1
-0
.gitignore
.gitignore
+13
-38
.gitlab-ci-configs/.config.mk.ci.gcc.python
.gitlab-ci-configs/.config.mk.ci.gcc.python
+5
-8
.gitlab-ci.yml
.gitlab-ci.yml
+9
-5
.gitmodules
.gitmodules
+4
-0
.project
.project
+11
-0
3rdParty/pybind11
3rdParty/pybind11
+1
-0
ChangeLog.md
ChangeLog.md
+1
-1
Makefile
Makefile
+30
-18
config.mk.default
config.mk.default
+2
-6
docker/base/Dockerfile
docker/base/Dockerfile
+9
-8
docker/build.sh
docker/build.sh
+3
-3
docker/interactive_fenics/Dockerfile
docker/interactive_fenics/Dockerfile
+6
-6
docker/xerus/Dockerfile
docker/xerus/Dockerfile
+8
-5
docker/xerus/config.mk
docker/xerus/config.mk
+5
-7
include/xerus/htNetwork.h
include/xerus/htNetwork.h
+557
-547
include/xerus/indexedTensor_tensor_factorisations.h
include/xerus/indexedTensor_tensor_factorisations.h
+2
-2
include/xerus/misc/containerOutput.h
include/xerus/misc/containerOutput.h
+4
-4
include/xerus/misc/containerSupport.h
include/xerus/misc/containerSupport.h
+12
-4
include/xerus/misc/fileIO.h
include/xerus/misc/fileIO.h
+1
-1
include/xerus/misc/fileUtilities.h
include/xerus/misc/fileUtilities.h
+11
-1
include/xerus/misc/math.h
include/xerus/misc/math.h
+6
-0
include/xerus/misc/namedLogger.h
include/xerus/misc/namedLogger.h
+2
-2
include/xerus/tensorNetwork.h
include/xerus/tensorNetwork.h
+3
-3
makeIncludes/optimization.mk
makeIncludes/optimization.mk
+1
-1
setup.py
setup.py
+21
-0
src/pyTests/test_arithmetic.py.pause
src/pyTests/test_arithmetic.py.pause
+0
-0
src/pyTests/test_chop.py.pause
src/pyTests/test_chop.py.pause
+0
-0
src/pyTests/test_extended_tt.py.pause
src/pyTests/test_extended_tt.py.pause
+0
-0
src/pyTests/test_numpy_interface.py
src/pyTests/test_numpy_interface.py
+76
-23
src/pyTests/test_pickle.py
src/pyTests/test_pickle.py
+140
-0
src/pyTests/test_reconstruction.py.pause
src/pyTests/test_reconstruction.py.pause
+5
-0
src/pyTests/test_tensor.py
src/pyTests/test_tensor.py
+139
-0
src/pyTests/test_tensor_arithmetic.py
src/pyTests/test_tensor_arithmetic.py
+43
-0
src/pyTests/test_tensor_factorizations.py
src/pyTests/test_tensor_factorizations.py
+28
-0
src/xerus/applications/uqAdf.cpp
src/xerus/applications/uqAdf.cpp
+6
-6
src/xerus/misc/fileUtilities.cpp
src/xerus/misc/fileUtilities.cpp
+40
-5
src/xerus/misc/stringUtilities.cpp
src/xerus/misc/stringUtilities.cpp
+14
-6
src/xerus/python/blocktt.cpp.
src/xerus/python/blocktt.cpp.
+59
-0
src/xerus/python/factorizations.cpp
src/xerus/python/factorizations.cpp
+29
-30
src/xerus/python/htnetwork.cpp
src/xerus/python/htnetwork.cpp
+54
-51
src/xerus/python/indexedTensor.cpp
src/xerus/python/indexedTensor.cpp
+34
-65
src/xerus/python/leastSquares.cpp
src/xerus/python/leastSquares.cpp
+137
-135
src/xerus/python/misc.cpp
src/xerus/python/misc.cpp
+49
-96
src/xerus/python/misc.h
src/xerus/python/misc.h
+23
-43
src/xerus/python/python.cpp
src/xerus/python/python.cpp
+28
-23
src/xerus/python/recovery.cpp
src/xerus/python/recovery.cpp
+92
-154
src/xerus/python/tensor.cpp
src/xerus/python/tensor.cpp
+219
-256
src/xerus/python/tensorNetwork.cpp
src/xerus/python/tensorNetwork.cpp
+90
-123
src/xerus/python/ttnetwork.cpp
src/xerus/python/ttnetwork.cpp
+75
-103
src/xerus/python/vectorAndPair.h
src/xerus/python/vectorAndPair.h
+0
-77
src/xerus/tensorNetwork.cpp
src/xerus/tensorNetwork.cpp
+3
-3
src/xerus/test/test.cpp
src/xerus/test/test.cpp
+8
-10
No files found.
.gitattributes
0 → 100644
View file @
7e9d8462
*.py filter=tabspace
*.cpp filter=tabspace
.gitconfig
0 → 120000
View file @
7e9d8462
.git/config
\ No newline at end of file
.gitignore
View file @
7e9d8462
# Ignore everything
*
# But not these files...
!.gitignore
!*.h
!*.hpp
!*.hxx
!*.c
!*.cpp
!*.cxx
!*.mk
!Makefile
!Dockerfile
!*.sh
!*.rb
!*.py
!.config.mk.*
!*.md
!*.xml
!*.dox
!*.css
!*.js
!*.yml
# ...even if they are in subdirectories
!*/
# However we really want to ignore
lapacke/*
build/*
doc/html/*
.cache
__pycache__
*.sw[pon]
*.np[yz]
*.xrs
lapacke
build
doc/html
doc/findDoxytag
doc/parseDoxytags
doc/xerus.tagfile
doc/xerus.tags
config.mk
XerusTest
.gitlab-ci-configs/.config.mk.ci.gcc.python
View file @
7e9d8462
...
...
@@ -5,13 +5,10 @@ CXX = g++
COMPATIBILITY = -std=c++11
PYTHON2_CONFIG = `python2-config --cflags --ldflags`
PYTHON3_CONFIG = `python3-config --cflags --ldflags`
PYTEST2 = pytest
PYTEST3 = pytest
-3
PYTEST2 =
python2 -m
pytest
PYTEST3 =
python3 -m
pytest
STRICT_WARNINGS = TRUE
# DEBUG += -D XERUS_TEST_COVERAGE # Enable coverage tests
DEBUG += -g # Adds debug symbols
DEBUG += -g # Adds debug symbols
#=================================================================================================
# External libraries
...
...
@@ -23,6 +20,6 @@ BOOST_LIBS = -lboost_filesystem
OTHER += -I /usr/include/python2.7/ -lboost_python -I/usr/lib64/python2.7/site-packages/numpy/core/include/ -lpython2.7 -fno-var-tracking-assignments
BOOST_PYTHON2 = -lboost_python-py27
BOOST_PYTHON3 = -lboost_python-py35
#
BOOST_PYTHON2 = -lboost_python-py27
#
BOOST_PYTHON3 = -lboost_python-py35
.gitlab-ci.yml
View file @
7e9d8462
...
...
@@ -14,7 +14,7 @@ job_build_homepage:
stage
:
build_homepage
script
:
"
cp
.gitlab-ci-configs/.config.mk.ci.cc
config.mk;
make
-C
doc
doc
&&
scp
-r
doc/html
xerusweb:libxerus.org-443"
when
:
always
only
:
only
:
-
master
allow_failure
:
true
...
...
@@ -46,21 +46,25 @@ job_build_python2:
stage
:
build_python2
script
:
"
g++
--version;
cp
.gitlab-ci-configs/.config.mk.ci.gcc.python
config.mk;
make
python2"
when
:
always
variables
:
GIT_SUBMODULE_STRATEGY
:
normal
job_build_python3
:
stage
:
build_python3
script
:
"
g++
--version;
cp
.gitlab-ci-configs/.config.mk.ci.gcc.python
config.mk;
make
python3"
when
:
always
variables
:
GIT_SUBMODULE_STRATEGY
:
normal
job_test_python2
:
stage
:
test_python2
script
:
"
g++
--version;
cp
.gitlab-ci-configs/.config.mk.ci.gcc.python
config.mk;
make
test_python2"
when
:
always
#
job_test_python3:
#
stage: test_python3
#
script: "g++ --version; cp .config.mk.ci.gcc.python config.mk; make test_python3"
#
when: always
job_test_python3
:
stage
:
test_python3
script
:
"
g++
--version;
cp
.gitlab-ci-configs/
.config.mk.ci.gcc.python
config.mk;
make
test_python3"
when
:
always
job_make_clang
:
stage
:
build_clang
...
...
.gitmodules
View file @
7e9d8462
[submodule "src/pybind11"]
path = 3rdParty/pybind11
url = https://github.com/pybind/pybind11.git
[submodule "3rdParty/measurement_utils"]
path = 3rdParty/measurement_utils
url = https://trunschk@bitbucket.org/trunschk/measurement_utils.git
.project
0 → 100644
View file @
7e9d8462
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>
xerus
</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
pybind11
@
25abf7ef
Subproject commit 25abf7efba0b2990f5a6dfb0a31bc65c0f2f4d17
ChangeLog.md
View file @
7e9d8462
...
...
@@ -11,7 +11,7 @@ Potentially breaking changes are marked with an exclamation point '!' at the beg
*
! Support for GCC <= 4.8 was dropped. Update your compiler if this affects you.
*
(optional) support for arpack https://github.com/opencollab/arpack-ng
*
Fixed minor rank reduction bug in TensorNetwork soft thresholding.
*
Defining multiple UnitTests with the same name does not crash the execution of 'make test' anymore.
*
2017-05-31 v3.0.1
*
Added TTNetwork::use_dense_representations() to convert all components to dense representation.
...
...
Makefile
View file @
7e9d8462
...
...
@@ -58,9 +58,18 @@ XERUS_SOURCES = $(wildcard src/xerus/*.cpp)
XERUS_SOURCES
+=
$(
wildcard
src/xerus/algorithms/
*
.cpp
)
XERUS_SOURCES
+=
$(
wildcard
src/xerus/applications/
*
.cpp
)
XERUS_SOURCES
+=
$(
wildcard
src/xerus/examples/
*
.cpp
)
# XERUS_SOURCES = $(wildcard src/xerus/**/*.cpp)
XERUS_INCLUDES
=
$(
wildcard
include/xerus/
*
.h
)
XERUS_INCLUDES
+=
$(
wildcard
include/xerus/algorithms/
*
.h
)
XERUS_INCLUDES
+=
$(
wildcard
include/xerus/applications/
*
.h
)
XERUS_INCLUDES
+=
$(
wildcard
include/xerus/examples/
*
.h
)
# XERUS_INCLUDES = $(wildcard include/xerus/**/*.h)
MISC_SOURCES
=
$(
wildcard
src/xerus/misc/
*
.cpp
)
MISC_INCLUDES
=
$(
wildcard
include/xerus/misc/
*
.h
)
PYTHON_SOURCES
=
$(
wildcard
src/xerus/python/
*
.cpp
)
TEST_SOURCES
=
$(
wildcard
src/xerus/test/
*
.cpp
)
...
...
@@ -202,14 +211,14 @@ shared: build/libxerus_misc.so build/libxerus.so
.PHONY
:
libxerus_misc_dependencies
libxerus_misc_dependencies
:
@
:
$(
call
check_defined, BOOST_LIBS, include and
link
paths
)
build/libxerus_misc.so
:
libxerus_misc_dependencies
$(MINIMAL_DEPS) $(MISC_SOURCES)
build/libxerus_misc.so
:
$(MINIMAL_DEPS) $(MISC_SOURCES)
$(MISC_INCLUDES) | libxerus_misc_dependencies
mkdir
-p
$(
dir
$@
)
$(CXX)
-shared
-fPIC
-Wl
,-soname,libxerus_misc.so
$(FLAGS)
-I
include
$(MISC_SOURCES)
-Wl
,--as-needed
$(CALLSTACK_LIBS)
$(BOOST_LIBS)
-o
build/libxerus_misc.so
.PHONY
:
libxerus_dependencies
libxerus_dependencies
:
@
:
$(
call
check_defined, SUITESPARSE LAPACK_LIBRARIES BLAS_LIBRARIES, include and
link
paths
)
build/libxerus.so
:
libxerus_dependencies
$(MINIMAL_DEPS) $(XERUS_SOURCES) build/libxerus_misc.so
build/libxerus.so
:
$(MINIMAL_DEPS) $(XERUS_SOURCES)
$(XERUS_INCLUDES)
build/libxerus_misc.so
| libxerus_dependencies
mkdir
-p
$(
dir
$@
)
$(CXX)
-shared
-fPIC
-Wl
,-soname,libxerus.so
$(FLAGS)
-I
include
$(XERUS_SOURCES)
-L
./build/
-Wl
,--as-needed
-lxerus_misc
$(SUITESPARSE)
$(LAPACK_LIBRARIES)
$(ARPACK_LIBRARIES)
$(BLAS_LIBRARIES)
-o
build/libxerus.so
...
...
@@ -217,21 +226,20 @@ build/libxerus.so: libxerus_dependencies $(MINIMAL_DEPS) $(XERUS_SOURCES) build/
python2
:
build/python2/xerus.so
python3
:
build/python3/xerus.so
build/python2/xerus.so
:
$(MINIMAL_DEPS) $(PYTHON_SOURCES) build/libxerus.so
@
:
$(
call
check_defined, PYTHON2_CONFIG
BOOST_PYTHON2
, include and
link
paths
)
build/python2/xerus.so
:
$(MINIMAL_DEPS) $(PYTHON_SOURCES)
src/xerus/python/misc.h
build/libxerus.so
@
:
$(
call
check_defined, PYTHON2_CONFIG, include and
link
paths
)
mkdir
-p
$(
dir
$@
)
$(CXX)
-shared
-fPIC
-Wl
,-soname,xerus.so
$(PYTHON2_CONFIG)
$(PYTHON_FLAGS)
-I
include
$(PYTHON_SOURCES)
-L
./build/
-Wl
,--as-needed
-lxerus
$(BOOST_PYTHON2)
-o
$@
$(CXX)
-shared
-fPIC
-Wl
,-soname,xerus.so
$(PYTHON2_CONFIG)
$(PYTHON_FLAGS)
-I
include
-I
3rdParty/pybind11/include
$(PYTHON_SOURCES)
-L
./build/
-Wl
,--as-needed
-lxerus
-o
$@
build/python3/xerus.so
:
$(MINIMAL_DEPS) $(PYTHON_SOURCES) build/libxerus.so
@
:
$(
call
check_defined, PYTHON3_CONFIG
BOOST_PYTHON3
, include and
link
paths
)
build/python3/xerus.so
:
$(MINIMAL_DEPS) $(PYTHON_SOURCES)
src/xerus/python/misc.h
build/libxerus.so
@
:
$(
call
check_defined, PYTHON3_CONFIG, include and
link
paths
)
mkdir
-p
$(
dir
$@
)
@
# -fpermissive is needed because of a bug in the definition of BOOST_PYTHON_MODULE_INIT in <boost/python/module_init.h>
$(CXX)
-shared
-fPIC
-Wl
,-soname,xerus.so
$(PYTHON3_CONFIG)
$(PYTHON_FLAGS)
-fpermissive
-I
include
$(PYTHON_SOURCES)
-L
./build/
-Wl
,--as-needed
-lxerus
$(BOOST_PYTHON3)
-o
$@
$(CXX)
-shared
-fPIC
-Wl
,-soname,xerus.so
$(PYTHON3_CONFIG)
$(PYTHON_FLAGS)
-I
include
-I
3rdParty/pybind11/include
$(PYTHON_SOURCES)
-L
./build/
-Wl
,--as-needed
-lxerus
-o
$@
static
:
build/libxerus_misc.a build/libxerus.a
build/libxerus_misc.a
:
libxerus_misc_dependencies
$(MINIMAL_DEPS) $(MISC_OBJECTS)
build/libxerus_misc.a
:
$(MINIMAL_DEPS) $(MISC_OBJECTS)
| libxerus_misc_dependencies
mkdir
-p
$(
dir
$@
)
ifdef
USE_LTO
gcc-ar rcs ./build/libxerus_misc.a
$(MISC_OBJECTS)
...
...
@@ -239,7 +247,7 @@ else
ar rcs ./build/libxerus_misc.a
$(MISC_OBJECTS)
endif
build/libxerus.a
:
libxerus_dependencies
$(MINIMAL_DEPS) $(XERUS_OBJECTS)
build/libxerus.a
:
$(MINIMAL_DEPS) $(XERUS_OBJECTS)
| libxerus_dependencies
mkdir
-p
$(
dir
$@
)
ifdef
USE_LTO
gcc-ar rcs ./build/libxerus.a
$(XERUS_OBJECTS)
...
...
@@ -260,18 +268,22 @@ install: shared
test
-d
$(
strip
$(INSTALL_LIB_PATH)
)
;
test
-d
$(
strip
$(INSTALL_HEADER_PATH)
)
;
@
printf
"Installing libxerus.so to
$(
strip
$(INSTALL_LIB_PATH)
)
and storing the header files in
$(
strip
$(INSTALL_HEADER_PATH)
)
.
\n
"
ifdef
INSTALL_PYTHON2_PATH
test
-d
$(
strip
$(INSTALL_PYTHON2_PATH)
)
;
@
printf
"Installing python2/xerus.so to
$(
strip
$(INSTALL_PYTHON2_PATH)
)
.
\n
"
endif
ifdef
INSTALL_PYTHON3_PATH
test
-d
$(
strip
$(INSTALL_PYTHON3_PATH)
)
;
@
printf
"Installing python3/xerus.so to
$(
strip
$(INSTALL_PYTHON3_PATH)
)
.
\n
"
endif
cp
include/xerus.h
$(INSTALL_HEADER_PATH)
cp
-r
include/xerus
$(INSTALL_HEADER_PATH)
cp
build/libxerus_misc.so
$(INSTALL_LIB_PATH)
cp
build/libxerus.so
$(INSTALL_LIB_PATH)
ifdef
INSTALL_PYTHON2_PATH
test
-d
$(
strip
$(INSTALL_PYTHON2_PATH)
)
;
@
printf
"Installing xerus.so to
$(
strip
$(INSTALL_PYTHON2_PATH)
)
.
\n
"
cp
build/python2/xerus.so
$(INSTALL_PYTHON2_PATH)
endif
ifdef
INSTALL_PYTHON3_PATH
test
-d
$(
strip
$(INSTALL_PYTHON3_PATH)
)
;
@
printf
"Installing xerus.so to
$(
strip
$(INSTALL_PYTHON3_PATH)
)
.
\n
"
cp
build/python3/xerus.so
$(INSTALL_PYTHON3_PATH)
endif
else
...
...
@@ -283,7 +295,7 @@ install:
@
printf
"Cannot install xerus: INSTALL_LIB_PATH not set. Please set the path in config file.
\n
"
endif
$(TEST_NAME)
:
libxerus_misc_dependencies libxerus_dependencies
$(MINIMAL_DEPS) $(UNIT_TEST_OBJECTS) $(TEST_OBJECTS) build/libxerus.a build/libxerus_misc.a
$(TEST_NAME)
:
$(MINIMAL_DEPS) $(UNIT_TEST_OBJECTS) $(TEST_OBJECTS) build/libxerus.a build/libxerus_misc.a
| libxerus_misc_dependencies libxerus_dependencies
$(CXX)
-D
XERUS_UNITTEST
$(FLAGS)
$(UNIT_TEST_OBJECTS)
$(TEST_OBJECTS)
build/libxerus.a build/libxerus_misc.a
$(SUITESPARSE)
$(LAPACK_LIBRARIES)
$(ARPACK_LIBRARIES)
$(BLAS_LIBRARIES)
$(BOOST_LIBS)
$(CALLSTACK_LIBS)
-o
$(TEST_NAME)
build/print_boost_version
:
src/print_boost_version.cpp
...
...
@@ -319,13 +331,13 @@ endif
.PHONY
:
test_python2_dependencies
test_python2_dependencies
:
@
:
$(
call
check_defined, PYTEST2, pytest executable
)
test_python2
:
test_python2_dependencies
build/libxerus.so build/python2/xerus.so
test_python2
:
build/libxerus.so build/python2/xerus.so
| test_python2_dependencies
@
PYTHONPATH
=
build/python2:
${PYTHONPATH}
LD_LIBRARY_PATH
=
build:
${LD_LIBRARY_PATH}
$(PYTEST2)
src/pyTests
.PHONY
:
test_python3_dependencies
test_python3_dependencies
:
@
:
$(
call
check_defined, PYTEST3, pytest executable
)
test_python3
:
test_python3_dependencies
build/libxerus.so build/python3/xerus.so
test_python3
:
build/libxerus.so build/python3/xerus.so
| test_python3_dependencies
@
PYTHONPATH
=
build/python3:
${PYTHONPATH}
LD_LIBRARY_PATH
=
build:
${LD_LIBRARY_PATH}
$(PYTEST3)
src/pyTests
...
...
config.mk.default
View file @
7e9d8462
...
...
@@ -14,8 +14,8 @@ CXX = g++
# pytest executable(s). If you installed these system-wide you likely don't need to change anything.
PYTHON2_CONFIG = `python2-config --cflags --ldflags`
PYTHON3_CONFIG = `python3-config --cflags --ldflags`
PYTEST2 = pytest
2
PYTEST3 = pytest
3
PYTEST2 =
python2 -m
pytest
PYTEST3 =
python3 -m
pytest
#=================================================================================================
# C++ Version
...
...
@@ -140,9 +140,5 @@ BOOST_LIBS = -lboost_filesystem -lboost_system
# ARPACK_LIBRARIES = -larpack
# OTHER += -DARPACK_LIBRARIES
# Uncomment or add the appropriate boost python library
BOOST_PYTHON2 = -lboost_python-py27
BOOST_PYTHON3 = -lboost_python-py35
# Custom include paths
# OTHER += -I /path/to/include
docker/base/Dockerfile
View file @
7e9d8462
FROM
phusion/baseimage:0.
9.22
FROM
phusion/baseimage:0.
11
USER
root
WORKDIR
"/tmp/"
# Get Ubuntu updates
RUN
apt-get
-qq
update
&&
\
apt-get
-y
--with-new-pkgs
-o
Dpkg::Options::
=
"--force-confold"
upgrade
RUN
apt-get update
&&
\
apt-get
upgrade
-y
-o
Dpkg::Options::
=
"--force-confold"
# Set locale environment
RUN
apt-get
-y
install
locales
sudo
&&
\
...
...
@@ -14,10 +14,6 @@ ENV LC_ALL=C.UTF-8 \
LANG=C.UTF-8 \
LANGUAGE=C.UTF-8
# Turn off forwarding of syslog messages to stdout
# https://github.com/phusion/baseimage-docker/issues/186
RUN
touch
/etc/service/syslog-forwarder/down
# Non-Python utilities and libraries
RUN
apt-get
-y
install
\
cmake
\
...
...
@@ -32,7 +28,12 @@ RUN apt-get -y install \
libopenblas-dev
\
libiberty-dev
\
binutils-dev
\
zlib1g-dev
zlib1g-dev
\
libdpkg-perl
# Check Python versions
RUN
python
-c
'from __future__ import print_function; import sys; version = "{0}.{1}".format(*sys.version_info); print("python2-version:", version)'
RUN
python3
-c
'import sys; version = "{0}.{1}".format(*sys.version_info); print("python3-version:", version)'
# Install Python2 based environment
RUN
apt-get
-y
install
\
...
...
docker/build.sh
View file @
7e9d8462
#!/bin/bash
DIRNAME
=
$(
dirname
$0
)
docker build
"
$@
"
-t
firemarmot/base
$DIRNAME
/base
docker build
"
$@
"
-t
firemarmot/suitesparse
$DIRNAME
/suitesparse
docker build
"
$@
"
-t
firemarmot/xerus
$DIRNAME
/xerus
docker build
"
$@
"
-t
firemarmot/base
$DIRNAME
/base
&&
\
docker build
"
$@
"
-t
firemarmot/suitesparse
$DIRNAME
/suitesparse
&&
\
docker build
"
$@
"
-t
firemarmot/xerus
$DIRNAME
/xerus
&&
\
# docker build "$@" -t firemarmot/interactive $DIRNAME/interactive
docker build
"
$@
"
-t
firemarmot/interactive_fenics
$DIRNAME
/interactive_fenics
docker/interactive_fenics/Dockerfile
View file @
7e9d8462
FROM
firemarmot/xerus AS xerus
FROM
quay.io/fenicsproject/stable:201
7
.1.0
FROM
quay.io/fenicsproject/stable:201
9
.1.0
.r3
USER
root
WORKDIR
"/tmp/"
...
...
@@ -27,8 +27,8 @@ RUN apt-get -y install \
python3-numpy
# Check Python versions
RUN
python
-c
'
import sys; raise SystemExit("{0}.{1}".format(*sys.version_info) != "2.7"
)'
RUN
python3
-c
'import sys;
raise SystemExit(
"{0}.{1}".format(*sys.version_info)
!= "3.5"
)'
RUN
python
-c
'
from __future__ import print_function; import sys; version = "{0}.{1}".format(*sys.version_info); print("python2-version:", version
)'
RUN
python3
-c
'import sys;
version =
"{0}.{1}".format(*sys.version_info)
; print("python3-version:", version
)'
# Clean apt
RUN
apt-get clean
&&
\
...
...
@@ -38,7 +38,7 @@ RUN apt-get clean && \
RUN
mkdir
-p
/usr/local/lib
&&
\
mkdir
-p
/usr/local/include
&&
\
mkdir
-p
/usr/local/lib/python2.7/site-packages
&&
\
mkdir
-p
/usr/local/lib/python3.
5
/site-packages
mkdir
-p
/usr/local/lib/python3.
6
/site-packages
COPY
--from=xerus /usr/local/include/suitesparse /usr/local/include/suitesparse
COPY
--from=xerus /usr/local/lib/suitesparse /usr/local/lib/suitesparse
...
...
@@ -47,7 +47,7 @@ COPY --from=xerus /usr/local/include/xerus /usr/local/include
COPY
--from=xerus /usr/local/lib/libxerus_misc.so /usr/local/lib
COPY
--from=xerus /usr/local/lib/libxerus.so /usr/local/lib
COPY
--from=xerus /usr/local/lib/python2.7/site-packages/xerus.so /usr/local/lib/python2.7/site-packages
COPY
--from=xerus /usr/local/lib/python3.
5
/site-packages/xerus.so /usr/local/lib/python3.
5
/site-packages
COPY
--from=xerus /usr/local/lib/python3.
6
/site-packages/xerus.so /usr/local/lib/python3.
6
/site-packages
# Install custom Python2 packages
RUN
pip
install
cython
&&
pip
install
ttpy matplotlib2tikz joblib
...
...
@@ -57,7 +57,7 @@ USER fenics
RUN
mkdir
-p
$(
python
-m
site
--user-site
)
&&
\
echo
/usr/local/lib/python2.7/site-packages/
>
$(
python
-m
site
--user-site
)
/xerus.pth
&&
\
mkdir
-p
$(
python3
-m
site
--user-site
)
&&
\
echo
/usr/local/lib/python3.
5
/site-packages/
>
$(
python3
-m
site
--user-site
)
/xerus.pth
echo
/usr/local/lib/python3.
6
/site-packages/
>
$(
python3
-m
site
--user-site
)
/xerus.pth
ENV
LD_LIBRARY_PATH "/usr/local/lib/:/usr/local/lib/suitesparse:$LD_LIBRARY_PATH"
WORKDIR
"/home/fenics/"
...
...
docker/xerus/Dockerfile
View file @
7e9d8462
...
...
@@ -3,23 +3,26 @@ USER root
WORKDIR
"/tmp/"
# Check Python versions
RUN
python
-c
'
import sys; raise SystemExit("{0}.{1}".format(*sys.version_info)
!= "2.7")'
RUN
python3
-c
'import sys;
raise SystemExit(
"{0}.{1}".format(*sys.version_info) != "3.
5
")'
RUN
python
-c
'
from __future__ import print_function; import sys; version = "{0}.{1}".format(*sys.version_info); print("python2-version:", version); raise SystemExit(version
!= "2.7")'
RUN
python3
-c
'import sys;
version =
"{0}.{1}".format(*sys.version_info)
; print("python3-version:", version); raise SystemExit(version
!= "3.
6
")'
# Install Xerus
RUN
git clone https://git.hemio.de/xerus/xerus.git
WORKDIR
"/tmp/xerus/"
RUN
git checkout vmc
&&
\
git pull
&&
\
cp
./docker/xerus/config.mk
.
&&
\
git submodule update
--init
--recursive
RUN
cp
./docker/xerus/config.mk
.
&&
\
mkdir
-p
/usr/local/lib
&&
\
mkdir
-p
/usr/local/include
&&
\
mkdir
-p
/usr/local/lib/python2.7/site-packages
&&
\
mkdir
-p
/usr/local/lib/python3.5/site-packages
&&
\
mkdir
-p
/usr/local/lib/python3.6/site-packages
&&
\
make python2 python3
-j
$(
cat
/tmp/NCORES_1
)
RUN
ls
/usr/local/lib/python3.6/
&&
\
make
install
-j
$(
cat
/tmp/NCORES_1
)
RUN
mkdir
-p
$(
python
-m
site
--user-site
)
&&
\
echo
/usr/local/lib/python2.7/site-packages/
>
$(
python
-m
site
--user-site
)
/xerus.pth
&&
\
mkdir
-p
$(
python3
-m
site
--user-site
)
&&
\
echo
/usr/local/lib/python3.
5
/site-packages/
>
$(
python3
-m
site
--user-site
)
/xerus.pth
echo
/usr/local/lib/python3.
6
/site-packages/
>
$(
python3
-m
site
--user-site
)
/xerus.pth
ENV
LD_LIBRARY_PATH "/usr/local/lib/:$LD_LIBRARY_PATH"
docker/xerus/config.mk
View file @
7e9d8462
CXX
=
g++
PYTHON2_CONFIG
=
`
python-config
--cflags
--ldflags
`
PYTHON3_CONFIG
=
`
python3-config
--cflags
--ldflags
`
COMPATIBILITY
=
-std
=
c++17
COMPILE_THREADS
=
8
# Number of threads to use during link time optimization.
HIGH_OPTIMIZATION
=
TRUE
# Activates -O3 -march=native and some others
OTHER
+=
-fopenmp
PYTHON2_CONFIG
=
`
python-config
--cflags
--ldflags
`
PYTHON3_CONFIG
=
`
python3-config
--cflags
--ldflags
`
LOGGING
+=
-D
XERUS_LOG_INFO
# Information that is not linked to any unexpected behaviour but might nevertheless be of interest.
LOGGING
+=
-D
XERUS_LOGFILE
# Use 'error.log' file instead of cerr
LOGGING
+=
-D
XERUS_LOG_ABSOLUTE_TIME
# Print absolute times instead of relative to program time
...
...
@@ -14,12 +15,9 @@ LOGGING += -D XERUS_LOG_ABSOLUTE_TIME # Print absolute times instead of rela
INSTALL_LIB_PATH
=
/usr/local/lib
# Path where to install the libxerus.so shared library.
INSTALL_HEADER_PATH
=
/usr/local/include
# Path where to install the xerus header files.
INSTALL_PYTHON2_PATH
=
/usr/local/lib/python2.7/site-packages
INSTALL_PYTHON3_PATH
=
/usr/local/lib/python3.
5
/site-packages
INSTALL_PYTHON3_PATH
=
/usr/local/lib/python3.
6
/site-packages
BLAS_LIBRARIES
=
-lopenblas
-lgfortran
# Openblas, serial
LAPACK_LIBRARIES
=
-llapacke
-llapack
# Standard Lapack + Lapacke libraries
SUITESPARSE
=
-L
/usr/local/lib/suitesparse
-lcholmod
-lspqr
BOOST_LIBS
=
-lboost_filesystem
BOOST_PYTHON2
=
-lboost_python-py27
BOOST_PYTHON3
=
-lboost_python-py35
include/xerus/htNetwork.h
View file @
7e9d8462
This diff is collapsed.
Click to expand it.
include/xerus/indexedTensor_tensor_factorisations.h
View file @
7e9d8462
...
...
@@ -60,13 +60,13 @@ namespace xerus {
const
size_t
maxRank
;
const
bool
preventZero
;
SVD
(
internal
::
IndexedTensorReadOnly
<
Tensor
>&&
_input
)
:
SVD
(
internal
::
IndexedTensorReadOnly
<
Tensor
>&&
_input
)
:
input
(
&
_input
),
epsilon
(
EPSILON
),
softThreshold
(
0.0
),
maxRank
(
std
::
numeric_limits
<
size_t
>::
max
()),
preventZero
(
false
)
{
}
SVD
(
internal
::
IndexedTensorReadOnly
<
Tensor
>&&
_input
,
const
double
_softTreshold
,
const
bool
_preventZero
=
false
)
:
input
(
&
_input
),
epsilon
(
0.0
),
softThreshold
(
_softTreshold
),
maxRank
(
std
::
numeric_limits
<
size_t
>::
max
()),
preventZero
(
_preventZero
)
{
}
SVD
(
internal
::
IndexedTensorReadOnly
<
Tensor
>&&
_input
,
const
size_t
_maxRank
,
const
double
_epsilon
=
EPSILON
)
:
SVD
(
internal
::
IndexedTensorReadOnly
<
Tensor
>&&
_input
,
const
size_t
_maxRank
,
const
double
_epsilon
=
EPSILON
)
:
input
(
&
_input
),
epsilon
(
_epsilon
),
softThreshold
(
0.0
),
maxRank
(
_maxRank
),
preventZero
(
false
)
{
}
SVD
(
internal
::
IndexedTensorReadOnly
<
Tensor
>&&
_input
,
const
size_t
_maxRank
,
const
double
_epsilon
,
const
double
_softTreshold
,
const
bool
_preventZero
)
:
...
...
include/xerus/misc/containerOutput.h
View file @
7e9d8462
...
...
@@ -86,11 +86,11 @@ namespace xerus { namespace misc {
///@brief Allow to pipe std::maps to ostreams.
template
<
class
T
,
class
U
>
std
::
ostream
&
operator
<<
(
std
::
ostream
&
_out
,
const
std
::
map
<
T
,
U
>&
_
set
)
{
if
(
_
set
.
size
()
==
0
)
{
_out
<<
"{ }"
;
return
_out
;
}
template
<
class
T
,
class
U
,
class
...
rest_t
>
std
::
ostream
&
operator
<<
(
std
::
ostream
&
_out
,
const
std
::
map
<
T
,
U
,
rest_t
...
>&
_
map
)
{
if
(
_
map
.
size
()
==
0
)
{
_out
<<
"{ }"
;
return
_out
;
}
_out
<<
"{ "
;
for
(
const
auto
&
item
:
_
set
)
{
_out
<<
"("
<<
item
.
first
<<
", "
<<
item
.
second
<<
"), "
;
}
for
(
const
auto
&
item
:
_
map
)
{
_out
<<
"("
<<
item
.
first
<<
", "
<<
item
.
second
<<
"), "
;
}
_out
<<
"
\b\b
}"
;
return
_out
;
}
...
...
include/xerus/misc/containerSupport.h
View file @
7e9d8462
...
...
@@ -63,7 +63,6 @@ namespace xerus { namespace misc {
return
count
;
}
///@brief: Checks whether an arbitary container contains a certain element.
template
<
template
<
class
,
class
...
>
class
container_t
,
class
item_t
,
class
...
rest_t
,
typename
std
::
enable_if
<
sfinae
::
has_find
<
container_t
<
item_t
,
rest_t
...>,
item_t
>::
value
,
int
>::
type
=
0
>
...
...
@@ -195,7 +194,16 @@ namespace xerus { namespace misc {
inline
void
erase
(
container_t
<
item_t
,
rest_t
...
>&
_container
,
const
rule_t
&
_rule
)
{
_container
.
erase
(
std
::
remove_if
(
_container
.
begin
(),
_container
.
end
(),
_rule
),
_container
.
end
());
}
}
}
// namespaces xerus::misc
///@brief: Erases a single element specified by @a _rule from the vector @a _vector by swaping with the last item (destroying the order).
template
<
class
rule_t
,
class
item_t
,
class
...
rest_t
>
inline
void
swap_erase_single
(
std
::
vector
<
item_t
,
rest_t
...
>&
_vector
,
const
rule_t
&
_rule
)
{
const
auto
foundItr
=
std
::
find_if
(
_vector
.
begin
(),
_vector
.
end
(),
_rule
);
if
(
foundItr
!=
_vector
.
end
())
{
if
(
foundItr
+
1
!=
_vector
.
end
())
{
std
::
iter_swap
(
foundItr
,
_vector
.
rbegin
());
}
_vector
.
pop_back
();
}
}
}}
// namespaces xerus::misc
include/xerus/misc/fileIO.h
View file @
7e9d8462
...
...
@@ -110,7 +110,7 @@ namespace xerus { namespace misc {
T
deserialize
(
const
std
::
string
&
_bytes
)
{
T
obj
;
std
::
string
header
=
_bytes
.
substr
(
0
,
_bytes
.
find
(
"
\n
"
));
XERUS_REQUIRE
(
header
==
std
::
string
(
"Xerus "
)
+
misc
::
demangle_cxa
(
typeid
(
T
).
name
())
+
" serialized object."
,
"Invalid binary input.
DBG:
"
<<
header
);
XERUS_REQUIRE
(
header
==
std
::
string
(
"Xerus "
)
+
misc
::
demangle_cxa
(
typeid
(
T
).
name
())
+
" serialized object."
,
"Invalid binary input.
\n
Expected:
\"
"
<<
std
::
string
(
"Xerus "
)
+
misc
::
demangle_cxa
(
typeid
(
T
).
name
())
+
" serialized object.
\"\n
Got:
\"
"
<<
header
<<
"
\"
"
);
std
::
stringstream
stream
(
_bytes
.
substr
(
_bytes
.
find
(
"
\n
"
)
+
1
));
// +1 because of the last \n
XERUS_REQUIRE
(
stream
,
"Unexpected end of stream in load_from_file()."
);
stream_reader
(
stream
,
obj
,
FileFormat
::
BINARY
);
...
...
include/xerus/misc/fileUtilities.h
View file @
7e9d8462
...
...
@@ -27,6 +27,7 @@
#include <set>
#include <string>
#include <fstream>
#include <vector>
// #include "standard.h"
...
...
@@ -35,18 +36,27 @@ namespace xerus { namespace misc {
///@brief Creates all directories in the @a _path of the file, if needed.
void
create_directories_for_file
(
const
std
::
string
&
_path
);
///@brief Returns a set containing all regular files at the given @a _path.
///@brief Returns a set containing all regular files
present
at the given @a _path.
std
::
set
<
std
::
string
>
get_files
(
const
std
::
string
&
_path
);
///@brief Returns a set containing all directories present at the given @a _path.
std
::
set
<
std
::
string
>
get_directories
(
const
std
::
string
&
_path
);
///@brief Checks whether a file at the given @a _path exists.
bool
file_exists
(
const
std
::
string
&
_path
);
///@brief Checks whether a directory at the given @a _path exists.
bool
directory_exists
(
const
std
::
string
&
_path
);
///@brief Checks whether a file at the given @a _path is empty.
bool
file_is_empty
(
const
std
::
string
&
_path
);
///@brief Reads the complete content of the file at the given @a _path into a string.
std
::
string
read_file
(
const
std
::
string
&
_path
);
///@brief Reads all lines of the file at the given @a _path into a vector of strings.
std
::
vector
<
std
::
string
>
read_file_lines
(
const
std
::
string
&
_path
);
/// @brief Resolves 'folder/..' occurences in pathnames.
std
::
string
/*XERUS_warn_unused*/
normalize_pathname
(
const
std
::
string
&
_name
);
...
...
include/xerus/misc/math.h
View file @
7e9d8462
...
...
@@ -37,6 +37,12 @@ namespace xerus {
return
(
T
(
0
)
<
_value
)
-
(
_value
<
T
(
0
));
}
///@brief: Calculates the absolute value of _value.
template
<
class
T
>
constexpr
T
abs
(
const
T
_value
)
noexcept
{
return
(
_value
<
0
)
?
-
_value
:
_value
;
}
///@brief: Calculates _a*_a.
template
<
class
T
>
...
...
include/xerus/misc/namedLogger.h
View file @
7e9d8462
...
...
@@ -57,14 +57,14 @@ namespace xerus {
// If the LOG_BUFFER is active there is the additional option only to print the log if an error occurs.
#ifdef XERUS_LOG_BUFFER
enum
{
enum
LogLvl
{
NOT_LOGGING
=
0
,
LOGGING_ON_ERROR
=
1
,
LOGGING_FULL
=
2
,
LOGGING_EXCEPTION
=
3
};
#else
enum
{
enum
LogLvl
{
NOT_LOGGING
=
0
,