Commit 3b198203 authored by Philipp  Trunschke's avatar Philipp Trunschke

Merge branch 'conda' into pybind11

parents e8cceb47 b51236c6
Pipeline #2034 failed with stages
in 8 minutes and 59 seconds
.PHONY: help shared static python2 python3 doc install test clean version opt warn printBoostVersion
.PHONY: help version opt-flags warn-flags shared static python doc install test clean opt warn printBoostVersion
# ------------------------------------------------------------------------------------------------------
# Default rule should be the help message
# ------------------------------------------------------------------------------------------------------
help:
@printf "Possible make targets are:\n \
\t\tversion \t -- Print the version of xerus.\n \
\t\tshared \t -- Build xerus as a shared library.\n \
\t\tstatic \t -- Build xerus as a static library.\n \
\t\tpython2 \t -- Build the xerus python2 wrappers.\n \
\t\tpython3 \t -- Build the xerus python3 wrappers.\n \
\t\tdoc \t -- Build the html documentation for the xerus library.\n \
\t\tinstall \t -- Install the shared library and header files (may require root).\n \
\t\ttest \t -- Build and run the xerus unit tests.\n \
\t\tclean \t -- Remove all object, library and executable files.\n"
\thelp -- Print this help message.\n \
\tversion -- Print the version of xerus.\n \
\topt-flags -- List optimizations used by the compiler.\n \
\twarn-flags -- List warnings generated by the compiler.\n \
\tshared -- Build xerus as a shared library.\n \
\tstatic -- Build xerus as a static library.\n \
\tpython -- Build the xerus python3 wrappers.\n \
\tdoc -- Build the html documentation for the xerus library.\n \
\tinstall -- Install the shared library and header files (may require root).\n \
\ttest -- Build and run the xerus unit tests.\n \
\tclean -- Remove all object, library and executable files.\n"
# ------------------------------------------------------------------------------------------------------
......@@ -25,10 +27,10 @@ TEST_NAME = XerusTest
# ------------------------------------------------------------------------------------------------------
# Extract Xerus version from VERSION file and the git repository
# Extract Xerus version from VERSION file
# ------------------------------------------------------------------------------------------------------
VERSION_STRING = $(shell git describe --tags --always 2>/dev/null || cat VERSION)
VERSION_STRING = $(shell cat VERSION)
VERSION = -D XERUS_VERSION="$(VERSION_STRING)"
XERUS_MAJOR_V = $(word 1, $(subst ., ,$(VERSION_STRING)) )
......@@ -36,18 +38,20 @@ ifneq (,$(findstring v, $(XERUS_MAJOR_V)))
XERUS_MAJOR_V := $(strip $(subst v, ,$(XERUS_MAJOR_V)) )
endif
VERSION += -D XERUS_VERSION_MAJOR=$(XERUS_MAJOR_V)
XERUS_MINOR_V = $(word 2, $(subst ., ,$(VERSION_STRING)) )
XERUS_MINOR_V = $(word 2, $(subst ., ,$(VERSION_STRING)))
VERSION += -D XERUS_VERSION_MINOR=$(XERUS_MINOR_V)
XERUS_REVISION_V = $(word 3, $(subst ., ,$(VERSION_STRING)) )
XERUS_REVISION_V = $(word 3, $(subst ., ,$(VERSION_STRING)))
ifneq (,$(findstring -, $(XERUS_REVISION_V)))
XERUS_COMMIT_V := $(word 2, $(subst -, ,$(XERUS_REVISION_V)) )
XERUS_REVISION_V := $(word 1, $(subst -, ,$(XERUS_REVISION_V)) )
XERUS_COMMIT_V := $(word 2, $(subst -, ,$(XERUS_REVISION_V)))
XERUS_REVISION_V := $(word 1, $(subst -, ,$(XERUS_REVISION_V)))
else
XERUS_COMMIT_V = 0
endif
VERSION += -D XERUS_VERSION_REVISION=$(XERUS_REVISION_V)
VERSION += -D XERUS_VERSION_COMMIT=$(XERUS_COMMIT_V)
version:
@echo $(XERUS_MAJOR_V).$(XERUS_MINOR_V).$(XERUS_REVISION_V).$(XERUS_COMMIT_V)
# ------------------------------------------------------------------------------------------------------
# Register source files for the xerus library
......@@ -195,12 +199,12 @@ __check_defined_FORCE:
# Make Rules
# ------------------------------------------------------------------------------------------------------
opt:
$(CXX) $(FLAGS) -Q --help=optimizers
opt-flags:
@$(CXX) $(FLAGS) -Q --help=optimizers 2>/dev/null
warn:
$(CXX) $(FLAGS) -Q --help=warnings
warn-flags:
@$(CXX) $(FLAGS) -Q --help=warnings 2>/dev/null
# Fake rule to create arbitary headers, to prevent errors if files are moved/renamed
......@@ -223,8 +227,7 @@ build/libxerus.so: $(MINIMAL_DEPS) $(XERUS_SOURCES) $(XERUS_INCLUDES) build/libx
$(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
python2: build/python2/xerus.so
python3: xerus/xerus.so xerus/libxerus.so xerus/libxerus_misc.so
python: xerus/xerus.so xerus/libxerus.so xerus/libxerus_misc.so
xerus/xerus.so: build/python3/xerus.so
cp $< $@
......@@ -233,11 +236,6 @@ xerus/libxerus.so: build/libxerus.so
xerus/libxerus_misc.so: build/libxerus_misc.so
cp $< $@
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 -I 3rdParty/pybind11/include $(PYTHON_SOURCES) -L ./build/ -Wl,--as-needed -lxerus -o $@
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 $@)
......@@ -272,25 +270,16 @@ endif
ifdef INSTALL_LIB_PATH
ifdef INSTALL_HEADER_PATH
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
mkdir -p $(INSTALL_LIB_PATH)
mkdir -p $(INSTALL_HEADER_PATH)
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
cp build/python2/xerus.so $(INSTALL_PYTHON2_PATH)
endif
ifdef INSTALL_PYTHON3_PATH
@printf "Installing xerus.so to $(strip $(INSTALL_PYTHON3_PATH)).\n"
mkdir -p $(INSTALL_PYTHON3_PATH)
cp build/python3/xerus.so $(INSTALL_PYTHON3_PATH)
endif
else
......@@ -330,17 +319,10 @@ test:
./$(TEST_NAME) all
endif
else
test: $(TEST_NAME)
test: $(TEST_NAME)
./$(TEST_NAME) all
endif
.PHONY: test_python2_dependencies
test_python2_dependencies:
@:$(call check_defined, PYTEST2, pytest executable)
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)
......@@ -363,9 +345,6 @@ clean:
-rm -f include/xerus.h.gch
make -C doc clean
version:
@echo $(XERUS_MAJOR_V).$(XERUS_MINOR_V).$(XERUS_REVISION_V)
# Build rule for normal misc objects
......
This diff is collapsed.
#bash bootstrap.sh --with-libraries=system,filesystem,math --prefix=${PREFIX}
#./b2 -q --build-type=minimal --layout=system variant=release debug-symbols=off threading=multi runtime-link=shared link=shared install
#!/bin/bash
set -x -e
cd xerus
cat <<EOF >config.mk
CXX = ${CXX}
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
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
XERUS_NO_FANCY_CALLSTACK = TRUE # Show simple callstacks only
BLAS_LIBRARIES = -lopenblas -lgfortran # Openblas, serial
LAPACK_LIBRARIES = -llapacke -llapack # Standard Lapack + Lapacke libraries
SUITESPARSE = -lcholmod -lspqr
BOOST_LIBS = -lboost_filesystem
OTHER += -I${CONDA_PREFIX}/include -I${CONDA_PREFIX}/lib/python${PY_VER}/site-packages/numpy/core/include/
OTHER += -L${CONDA_PREFIX}/lib
EOF
ln -s ${CONDA_PREFIX}/include/ ${CONDA_PREFIX}/include/suitesparse
make python3
python3 setup.py install --prefix=${PREFIX}
# INCLUDE_PATH="${PREFIX}/include"
# mkdir -p ${INCLUDE_PATH}
# cp include/xerus.h ${INCLUDE_PATH}
# cp -r include/xerus ${INCLUDE_PATH}
# LIBRARY_PATH="${PREFIX}/lib"
# mkdir -p ${LIBRARY_PATH}
# cp build/libxerus.so ${LIBRARY_PATH}
# cp build/libxerus_misc.so ${LIBRARY_PATH}
rm config.mk
{% set name = "Xerus" %}
{% set version = "4.0.1" %}
{% set branch = "pybind11" %}
package:
name: {{ name|lower }}
version: {{ version }}
source:
- git_url: https://github.com/libxerus/xerus.git
git_tag: {{ branch }}
# git_depth: 1 # perform shallow clone
folder: xerus
build:
skip: true # [py<34 or win]
requirements:
build:
- {{ compiler('cxx') }}
- make
- openblas
- suitesparse
- lapack
- openmp
- boost >=1.69.0
- python
- numpy {{ numpy }}
#- gdb # bfd
#- backward-cpp # option for better python-like backtraces
run:
- openblas
- suitesparse
- lapack
- openmp
- boost >=1.69.0
- python
- numpy {{ numpy }}
#- gdb # bfd
#- backward-cpp # option for better python-like backtraces
about:
home: https://git.hemio.de/xerus/xerus.git
license: "AGPL 3.0"
license_file: LICENSE
summary: "A c++ library for numerical calculations with higher order tensors"
description: |
The Xerus library is a general purpose library for numerical calculations with higher order tensors, Tensor-Train Decompositions / Matrix Product States and other Tensor Networks.
The focus of development was the simple usability and adaptibility to any setting that requires higher order tensors or decompositions thereof.
doc_url: https://www.libxerus.org/
dev_url: https://git.hemio.de/xerus/xerus
extra:
recipe-maintainers:
- trunschk
......@@ -94,8 +94,7 @@ static misc::UnitTest tt_noround("TT", "no_rounding", [](){
TTTensor a = TTTensor::random({2,2,2,2,2,2,2}, {2,2,2,2,2,2});
TTTensor b(a);
a.round(2);
MTEST(approx_equal(Tensor(a),Tensor(b), 1e-14), frob_norm(a-b));
TEST(approx_equal(Tensor(a),Tensor(b), 1e-14));
TTTensor c = TTTensor::random({2,2,2,2,2,2,2}, {2,2,2,2,2,2});
a(i&0) = a(i&0) + 0.0*c(i&0);
LOG(unit_test, a.ranks());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment