Commit 75734863 authored by Michael Goette's avatar Michael Goette

Xerus Meeting, hot fixes and audits

parent a6cb9535
Pipeline #1061 failed with stages
in 9 minutes and 15 seconds
......@@ -21,6 +21,7 @@ LAPACK_LIBRARIES = -llapacke -llapack # Standard Lapack + La
# Uncomment or add the appropriate CXSparse library
SUITESPARSE = -lcholmod -lspqr
BOOST_LIBS = -lboost_filesystem
# custom include paths
......
......@@ -3,6 +3,10 @@
#=================================================================================================
CXX = g++
COMPATIBILITY = -std=c++11
PYTHON2_CONFIG = `python2-config --cflags --ldflags`
PYTHON3_CONFIG = `python3-config --cflags --ldflags`
PYTEST2 = pytest2
PYTEST3 = pytest3
STRICT_WARNINGS = TRUE
DEBUG += -D XERUS_TEST_COVERAGE # Enable coverage tests
......@@ -15,5 +19,10 @@ DEBUG += -D XERUS_TEST_COVERAGE # Enable coverage tests
BLAS_LIBRARIES = -lopenblas -lgfortran # Openblas, serial
LAPACK_LIBRARIES = -llapacke -llapack # Standard Lapack + Lapacke libraries
SUITESPARSE = -lcholmod -lspqr
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
......@@ -21,7 +21,7 @@ LOGGING += -D XERUS_LOG_INFO # Information that is not linke
BLAS_LIBRARIES = -lopenblas -lgfortran # Openblas, serial
LAPACK_LIBRARIES = -llapacke -llapack # Standard Lapack + Lapacke libraries
SUITESPARSE = -lcholmod -lspqr
BOOST_LIBS = -lboost_filesystem
# custom include paths
# OTHER += -I /path/to/include
......
......@@ -35,7 +35,7 @@ job_test_gcc_nocheck:
job_build_python:
stage: build_python
script: "g++ --version; cp .config.mk.ci.gcc config.mk; make python"
script: "g++ --version; cp .config.mk.ci.gcc config.mk; make python2"
when: always
job_make_clang:
......
......@@ -147,7 +147,7 @@ shared: build/libxerus_misc.so build/libxerus.so
build/libxerus_misc.so: $(MINIMAL_DEPS) $(MISC_SOURCES)
mkdir -p $(dir $@)
$(CXX) -shared -fPIC -Wl,-soname,libxerus_misc.so $(FLAGS) -I include $(MISC_SOURCES) -Wl,--as-needed $(CALLSTACK_LIBS) -lboost_filesystem -o build/libxerus_misc.so
$(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
build/libxerus.so: $(MINIMAL_DEPS) $(XERUS_SOURCES) build/libxerus_misc.so
mkdir -p $(dir $@)
......@@ -159,12 +159,12 @@ python3: build/python3/xerus.so
build/python2/xerus.so: $(MINIMAL_DEPS) $(PYTHON_SOURCES) build/libxerus.so
mkdir -p $(dir $@)
$(CXX) -shared -fPIC -Wl,-soname,xerus.so `$(PYTHON2_CONFIG) --cflags --ldflags` $(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 $(PYTHON_SOURCES) -L ./build/ -Wl,--as-needed -lxerus $(BOOST_PYTHON2) -o $@
build/python3/xerus.so: $(MINIMAL_DEPS) $(PYTHON_SOURCES) build/libxerus.so
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) --cflags --ldflags` $(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) -fpermissive -I include $(PYTHON_SOURCES) -L ./build/ -Wl,--as-needed -lxerus $(BOOST_PYTHON3) -o $@
static: build/libxerus_misc.a build/libxerus.a
......@@ -233,10 +233,10 @@ test: $(TEST_NAME)
./$(TEST_NAME) all
test_python2: # build/libxerus.so build/python2/xerus.so
test_python2: build/libxerus.so build/python2/xerus.so
@PYTHONPATH=build/python2:${PYTHONPATH} LD_LIBRARY_PATH=build:${LD_LIBRARY_PATH} $(PYTEST2) src/pyTests
test_python3: # build/libxerus.so build/python3/xerus.so
test_python3: build/libxerus.so build/python3/xerus.so
@PYTHONPATH=build/python3:${PYTHONPATH} LD_LIBRARY_PATH=build:${LD_LIBRARY_PATH} $(PYTEST3) src/pyTests
......@@ -257,9 +257,6 @@ clean:
benchmark: $(MINIMAL_DEPS) $(LOCAL_HEADERS) benchmark.cxx $(LIB_NAME_STATIC)
$(CXX) $(FLAGS) benchmark.cxx $(LIB_NAME_STATIC) $(SUITESPARSE) $(LAPACK_LIBRARIES) $(ARPACK_LIBRARIES) $(BLAS_LIBRARIES) $(CALLSTACK_LIBS) -lboost_filesystem -lboost_system -o Benchmark
# Build rule for normal misc objects
build/.miscObjects/%.o: %.cpp $(MINIMAL_DEPS)
mkdir -p $(dir $@)
......@@ -278,12 +275,6 @@ build/.testObjects/%.o: %.cpp $(MINIMAL_DEPS)
$(CXX) -D XERUS_UNITTEST -I include $< -c $(FLAGS) -MMD -o $@
# Build rule for benchmark objects
build/%.o: %.cpp $(MINIMAL_DEPS)
mkdir -p $(dir $@)
$(CXX) -D XERUS_UNITTEST -I include $< -c $(FLAGS) -MMD -o $@
# Build rule for unit test objects
ifdef USE_GCC
build/.unitTestObjects/%.o: %.cxx $(MINIMAL_DEPS) build/.preCompileHeaders/xerus.h.gch
......
This diff is collapsed.
......@@ -6,8 +6,14 @@
# If you want to use OpenMP, make sure that your compiler supports OpenMP 4.0.
CXX = g++
# CXX = clang++
PYTHON2_CONFIG = python2-config
PYTHON3_CONFIG = python3-config
#=================================================================================================
# Python Settings
#=================================================================================================
# To build and test the python bindings for Xerus we need the python configs and the name of the
# 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 = pytest2
PYTEST3 = pytest3
......@@ -118,7 +124,7 @@ LOGGING += -D XERUS_LOG_INFO # Information that is not linke
# and bfd, all of which are available through common GNU/Linux packaging systems. If you want to
# build a shared library or run the unit tests of Xerus you have to provide the corresponding
# libraries here (otherwise only when linking your own program using Xerus).
# Make sure to use a parallel version of blas when compiling with -fopenmp.
# Make sure to use a thread safe version of blas when compiling with -fopenmp.
# Uncomment or add the appropriate blas libraries
BLAS_LIBRARIES = -lopenblas -lgfortran # Openblas, serial
......@@ -134,7 +140,10 @@ LAPACK_LIBRARIES = -llapacke -llapack # Standard Lapack +
# Uncomment or add the appropriate CXSparse library
SUITESPARSE = -lcholmod -lspqr
# (optional) Uncomment if not needed, iterative eigenvalue solver ARPACK-ng, see https://github.com/opencollab/arpack-ng
# Uncomment or add the approriate boost libraries
BOOST_LIBS = -lboost_filesystem
# (optional) Uncomment if needed, iterative eigenvalue solver ARPACK-ng, see https://github.com/opencollab/arpack-ng
# ARPACK_LIBRARIES = -larpack
# OTHER += -DARPACK_LIBRARIES
......
......@@ -32,11 +32,13 @@ include ../makeIncludes/general.mk
include ../makeIncludes/warnings.mk
include ../makeIncludes/optimization.mk
FLAGS = $(strip $(WARNINGS) $(OPTIMIZE) $(OTHER)) -std=c++11
FLAGS = $(strip $(COMPATIBILITY) $(WARNINGS) $(OPTIMIZE) $(OTHER))
MINIMAL_DEPS = Makefile ../config.mk
parseDoxytags: ../src/docHelper/parseDoxytags.cpp
parseDoxytags: $(MINIMAL_DEPS) ../src/docHelper/parseDoxytags.cpp
$(CXX) $(FLAGS) ../src/docHelper/parseDoxytags.cpp -o parseDoxytags
findDoxytag: ../src/docHelper/findDoxytag.cpp
findDoxytag: $(MINIMAL_DEPS) ../src/docHelper/findDoxytag.cpp
$(CXX) $(FLAGS) ../src/docHelper/findDoxytag.cpp -o findDoxytag
......@@ -244,37 +244,6 @@ namespace xerus {
*/
static TTNetwork XERUS_warn_unused dirac(std::vector<size_t> _dimensions, const size_t _position);
/**
* @brief constructs a constant TTNetwork with the given dimensions and ranks.
* @param _dimensions the dimensions of the to be created TTNetwork.
* @param _ranks the ranks of the to be created TTNetwork.
* TODO wright Tests
*/
static TTNetwork XERUS_warn_unused constant(value_t constant, std::vector<size_t> _dimensions, const std::vector<size_t> &_ranks) {
const size_t numComponents = _dimensions.size()/N;
XERUS_REQUIRE(_dimensions.size()%N==0, "Illegal number of dimensions for TTOperator.");
XERUS_REQUIRE(_ranks.size()+1 == numComponents,"Non-matching amount of ranks given to TTNetwork::random.");
XERUS_REQUIRE(!misc::contains(_dimensions, size_t(0)), "Trying to construct a TTTensor with dimension 0 is not possible.");
XERUS_REQUIRE(!misc::contains(_ranks, size_t(0)), "Trying to construct random TTTensor with rank 0 is illegal.");
TTNetwork result(_dimensions.size());
const std::vector<size_t> targetRank = reduce_to_maximal_ranks(_ranks, _dimensions);
for(size_t i = 0; i < numComponents; ++i) {
const size_t leftRank = i==0 ? 1 : targetRank[i-1];
const size_t rightRank = (i==numComponents-1) ? 1 : targetRank[i];
if(isOperator) {
const auto constCmp = constant * Tensor::ones({leftRank, _dimensions[i], _dimensions[numComponents+i], rightRank});
result.set_component(i, constCmp);
} else {
const auto constCmp = constant * Tensor::ones({leftRank, _dimensions[i], rightRank});
result.set_component(i, constCmp);
}
}
//result.move_core(0);
return result;
}
/*- - - - - - - - - - - - - - - - - - - - - - - - - - Standard Operators - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
///@brief TTNetworks are default assignable.
......
# np.random.seed(1337)
# def build_TestNumpyInterface(seed, num, ext):
# rsg = np.random.RandomState(seed)
# mnkls = rsg.randint(1, 20, (num,4))
# def make_test_to_ndarray(mn, kl):
# def test(self):
# ls = rsg.randn(ext, *mn)
# rs = rsg.randn(ext, *kl)
# for l,r in zip(ls,rs):
# lr = np.kron(l,r)
# L,R = project(lr, mn, kl)
# diff = norm(lr - np.kron(L,R))
# self.assertLessEqual(diff, 1e-12)
# return test
# def make_test_from_ndarray(mn, kl):
# def test(self):
# ls = rsg.randn(ext, *mn)
# rs = rsg.randn(ext, *kl)
# for l,r in zip(ls,rs):
# lr = np.kron(l,r)
# L,R = project(lr, mn, kl)
# diff = norm(lr - np.kron(L,R))
# self.assertLessEqual(diff, 1e-12)
# return test
# odir = dict()
# for mnkl in mnkls:
# name = "test_random_{}x{}_{}x{}".format(*mnkl)
# test = make_test(mnkl[:2], mnkl[2:])
# odir[name] = test
# return type("TestRandomKroneckerSplitting", (unittest.TestCase,), odir)
# TestRandomKroneckerSplitting = build_TestNumpyInterface(0, 100, 4)
......@@ -76,7 +76,7 @@ namespace xerus {
if (measurments.positions[_a][j-1] > measurments.positions[_b][j-1]) { return false; }
}
}
/* LOG(fatal, "Measurments must not appear twice."); // NOTE that the algorithm works fine even if measurements appear twice. */
LOG(fatal, "Measurments must not appear twice."); // NOTE that the algorithm works fine even if measurements appear twice.
return false;
}
......
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