Commit ac2b88d1 authored by Sebastian Wolf's avatar Sebastian Wolf

Merge branch 'development' of git:xerus/xerus into development

parents 26def04b 1eb54d75
Pipeline #1238 passed with stages
in 17 minutes and 51 seconds
#================================================================================================= #=================================================================================================
# Compiler Options # Compiler Options
#================================================================================================= #=================================================================================================
CXX = g++ CXX = clang++
COMPATIBILITY = -std=c++14 COMPATIBILITY = -std=c++14
DEBUG_OPTIMIZATION = TRUE DEBUG_OPTIMIZATION = TRUE
......
...@@ -35,7 +35,7 @@ job_test_gcc_nocheck: ...@@ -35,7 +35,7 @@ job_test_gcc_nocheck:
job_code_coverage: job_code_coverage:
stage: code_coverage stage: code_coverage
script: "g++ --version; cp .gitlab-ci-configs/.config.mk.ci.cc config.mk; mkdir -p build; make test &> build/build_output.txt; tail -n 500 build/build_output.txt" script: "g++ --version; cp .gitlab-ci-configs/.config.mk.ci.cc config.mk; mkdir -p build; make test &> build/build_output.txt || { tail -n 500 build/build_output.txt && readelf -S XerusTest && objdump -s -j .cc_loc XerusTest && false; }; tail -n 500 build/build_output.txt"
when: always when: always
artifacts: artifacts:
expire_in: 3h expire_in: 3h
......
...@@ -5,14 +5,15 @@ ...@@ -5,14 +5,15 @@
# ------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------
help: help:
@printf "Possible make targets are:\n \ @printf "Possible make targets are:\n \
\t\tshared \t\t -- Build xerus as a shared library.\n \ \t\tversion \t -- Print the version of xerus.\n \
\t\tstatic \t\t -- Build xerus as a static library.\n \ \t\tshared \t -- Build xerus as a shared library.\n \
\t\tpython2 \t\t -- Build the xerus python2 wrappers.\n \ \t\tstatic \t -- Build xerus as a static library.\n \
\t\tpython3 \t\t -- Build the xerus python3 wrappers.\n \ \t\tpython2 \t -- Build the xerus python2 wrappers.\n \
\t\tdoc \t\t -- Build the html documentation for the xerus library.\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\tinstall \t -- Install the shared library and header files (may require root).\n \
\t\ttest \t\t -- Build and run the xerus unit tests.\n \ \t\ttest \t -- Build and run the xerus unit tests.\n \
\t\tclean \t\t -- Remove all object, library and executable files.\n" \t\tclean \t -- Remove all object, library and executable files.\n"
# ------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------
...@@ -282,8 +283,7 @@ install: ...@@ -282,8 +283,7 @@ install:
@printf "Cannot install xerus: INSTALL_LIB_PATH not set. Please set the path in config file.\n" @printf "Cannot install xerus: INSTALL_LIB_PATH not set. Please set the path in config file.\n"
endif 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
$(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) $(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 build/print_boost_version: src/print_boost_version.cpp
...@@ -297,7 +297,7 @@ ifdef BROCKEN_CI ...@@ -297,7 +297,7 @@ ifdef BROCKEN_CI
test: test:
mkdir -p build mkdir -p build
make $(TEST_NAME) make $(TEST_NAME)
@cat build/build_output.txt | grep "‘EnumMarker’ is deprecated" > build/required_tests.txt @cat build/build_output.txt | grep "REQUIRE_TEST @" > build/required_tests.txt
./$(TEST_NAME) all ./$(TEST_NAME) all
else else
...@@ -307,7 +307,7 @@ JOB_FLAG := $(filter -j%, $(subst -j ,-j,$(shell ps T | grep "^\s*$(MAKE_PID).*$ ...@@ -307,7 +307,7 @@ JOB_FLAG := $(filter -j%, $(subst -j ,-j,$(shell ps T | grep "^\s*$(MAKE_PID).*$
test: test:
mkdir -p build mkdir -p build
make $(TEST_NAME) $(JOB_FLAG) &> build/build_output.txt || cat build/build_output.txt make $(TEST_NAME) $(JOB_FLAG) &> build/build_output.txt || cat build/build_output.txt
@cat build/build_output.txt | grep "‘EnumMarker’ is deprecated" > build/required_tests.txt @cat build/build_output.txt | grep "REQUIRE_TEST @" > build/required_tests.txt
./$(TEST_NAME) all ./$(TEST_NAME) all
endif endif
else else
...@@ -316,13 +316,16 @@ test: $(TEST_NAME) ...@@ -316,13 +316,16 @@ test: $(TEST_NAME)
endif endif
.PHONY: test_python2_dependencies
test_python2: build/libxerus.so build/python2/xerus.so test_python2_dependencies:
@:$(call check_defined, PYTEST2, pytest executable) @:$(call check_defined, PYTEST2, pytest executable)
test_python2: test_python2_dependencies build/libxerus.so build/python2/xerus.so
@PYTHONPATH=build/python2:${PYTHONPATH} LD_LIBRARY_PATH=build:${LD_LIBRARY_PATH} $(PYTEST2) src/pyTests @PYTHONPATH=build/python2:${PYTHONPATH} LD_LIBRARY_PATH=build:${LD_LIBRARY_PATH} $(PYTEST2) src/pyTests
test_python3: build/libxerus.so build/python3/xerus.so .PHONY: test_python3_dependencies
test_python3_dependencies:
@:$(call check_defined, PYTEST3, pytest executable) @:$(call check_defined, PYTEST3, pytest executable)
test_python3: test_python3_dependencies build/libxerus.so build/python3/xerus.so
@PYTHONPATH=build/python3:${PYTHONPATH} LD_LIBRARY_PATH=build:${LD_LIBRARY_PATH} $(PYTEST3) src/pyTests @PYTHONPATH=build/python3:${PYTHONPATH} LD_LIBRARY_PATH=build:${LD_LIBRARY_PATH} $(PYTEST3) src/pyTests
...@@ -342,7 +345,7 @@ clean: ...@@ -342,7 +345,7 @@ clean:
make -C doc clean make -C doc clean
version: version:
@echo $(VERSION) @echo $(XERUS_MAJOR_V).$(XERUS_MINOR_V).$(XERUS_REVISION_V)
......
...@@ -3,4 +3,5 @@ DIRNAME=$(dirname $0) ...@@ -3,4 +3,5 @@ DIRNAME=$(dirname $0)
docker build "$@" -t firemarmot/base $DIRNAME/base docker build "$@" -t firemarmot/base $DIRNAME/base
docker build "$@" -t firemarmot/suitesparse $DIRNAME/suitesparse docker build "$@" -t firemarmot/suitesparse $DIRNAME/suitesparse
docker build "$@" -t firemarmot/xerus $DIRNAME/xerus docker build "$@" -t firemarmot/xerus $DIRNAME/xerus
docker build "$@" -t firemarmot $DIRNAME # docker build "$@" -t firemarmot/interactive $DIRNAME/interactive
docker build "$@" -t firemarmot/interactive_fenics $DIRNAME/interactive_fenics
This diff is collapsed.
#!/bin/bash
DIRNAME=$(dirname $0)
docker image rm -f firemarmot/xerus
docker image rm -f firemarmot
docker build -t firemarmot/xerus $DIRNAME/xerus
docker build -t firemarmot $DIRNAME
...@@ -27,7 +27,16 @@ ...@@ -27,7 +27,16 @@
#include "../basic.h" #include "../basic.h"
#include "../forwardDeclarations.h" #include "../forwardDeclarations.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-override"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wparentheses"
#pragma GCC diagnostic ignored "-Wuseless-cast"
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
#pragma GCC diagnostic ignored "-Wfloat-equal"
#include <boost/circular_buffer.hpp> #include <boost/circular_buffer.hpp>
#pragma GCC diagnostic pop
......
...@@ -30,13 +30,13 @@ ...@@ -30,13 +30,13 @@
#ifdef XERUS_TEST_COVERAGE #ifdef XERUS_TEST_COVERAGE
#define S1(x) #x #define XERUS_S1(x) #x
#define S2(x) S1(x) #define XERUS_S2(x) XERUS_S1(x)
#define LOCATION __FILE__ ":" S2(__LINE__) #define XERUS_LOCATION __FILE__ ":" XERUS_S2(__LINE__)
#define LOCATION_MARKED "@" LOCATION "@" #define XERUS_LOCATION_MARKED "@" XERUS_LOCATION "@"
#define XERUS_CC_MARK_WARNING enum [[deprecated(LOCATION_MARKED)]] EnumMarker {}; [[maybe_unused]] EnumMarker trigger;
#define XERUS_DO_PRAGMA(x) _Pragma (#x)
#define XERUS_CC_MARK(msg) XERUS_DO_PRAGMA(message ("REQUIRE_TEST @" msg "@"))
/** /**
* @def XERUS_REQUIRE_TEST * @def XERUS_REQUIRE_TEST
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
*/ */
#define XERUS_REQUIRE_TEST \ #define XERUS_REQUIRE_TEST \
do { \ do { \
static const char * const xerusCCLocalFunctionLocation = LOCATION;\ static const char * const xerusCCLocalFunctionLocation = XERUS_LOCATION;\
static const char * const xerusCCLocalFunctionName = __PRETTY_FUNCTION__;\ static const char * const xerusCCLocalFunctionName = __PRETTY_FUNCTION__;\
__asm__( \ __asm__( \
".pushsection .cc_loc, \"a\", @progbits" "\n" \ ".pushsection .cc_loc, \"a\", @progbits" "\n" \
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
); \ ); \
xerus::misc::CodeCoverage::covered(xerusCCLocalFunctionLocation, xerusCCLocalFunctionName); \ xerus::misc::CodeCoverage::covered(xerusCCLocalFunctionLocation, xerusCCLocalFunctionName); \
\ \
XERUS_CC_MARK_WARNING \ XERUS_CC_MARK(XERUS_LOCATION) \
} while(false) } while(false)
#else #else
...@@ -68,8 +68,6 @@ namespace xerus { namespace misc { namespace CodeCoverage { ...@@ -68,8 +68,6 @@ namespace xerus { namespace misc { namespace CodeCoverage {
extern std::map<std::string, std::unordered_set<std::string>>* testsCovered; extern std::map<std::string, std::unordered_set<std::string>>* testsCovered;
extern std::map<std::string, std::unordered_set<std::string>>* testsRequiredInit; extern std::map<std::string, std::unordered_set<std::string>>* testsRequiredInit;
void register_test(const std::string& _location, const std::string& _identifier);
void covered(const std::string& _location, const std::string& _identifier); void covered(const std::string& _location, const std::string& _identifier);
void print_code_coverage(); void print_code_coverage();
......
...@@ -30,7 +30,16 @@ ...@@ -30,7 +30,16 @@
#include <limits> #include <limits>
#include <functional> #include <functional>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-override"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wparentheses"
#pragma GCC diagnostic ignored "-Wuseless-cast"
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
#pragma GCC diagnostic ignored "-Wfloat-equal"
#include <boost/math/tools/polynomial.hpp> #include <boost/math/tools/polynomial.hpp>
#pragma GCC diagnostic pop
namespace xerus { namespace misc { namespace xerus { namespace misc {
......
...@@ -27,8 +27,8 @@ static misc::UnitTest trasd_frr("TRASD", "Fixed_Rank_Recovery", [](){ ...@@ -27,8 +27,8 @@ static misc::UnitTest trasd_frr("TRASD", "Fixed_Rank_Recovery", [](){
auto myTRASD = TRASD; auto myTRASD = TRASD;
myTRASD.maxIterations = 500; myTRASD.maxIterations = 100;
myTRASD.targetRelativeResidual = 1e-6; myTRASD.targetRelativeResidual = 1e-3;
for(const auto d : orders) { for(const auto d : orders) {
size_t residualSucc = 0, ErrorSucc = 0; size_t residualSucc = 0, ErrorSucc = 0;
...@@ -52,8 +52,8 @@ static misc::UnitTest trasd_frr("TRASD", "Fixed_Rank_Recovery", [](){ ...@@ -52,8 +52,8 @@ static misc::UnitTest trasd_frr("TRASD", "Fixed_Rank_Recovery", [](){
myTRASD(solution, measurments); myTRASD(solution, measurments);
const double error = frob_norm(target-solution)/targetNorm; const double error = frob_norm(target-solution)/targetNorm;
const double residual = measurments.test(solution); const double residual = measurments.test(solution);
if(residual < 1e-6) { residualSucc++; } if(residual < 1e-3) { residualSucc++; }
if(error < 1e-4) { ErrorSucc++; } if(error < 3e-3) { ErrorSucc++; }
} }
MTEST(residualSucc >= successThreshold, "Only " << residualSucc << " of " << runs << " were succesfull in terms of residual."); MTEST(residualSucc >= successThreshold, "Only " << residualSucc << " of " << runs << " were succesfull in terms of residual.");
...@@ -69,8 +69,8 @@ static misc::UnitTest trasd_rar("TRASD", "Rank_Adaptive_Recovery", [](){ ...@@ -69,8 +69,8 @@ static misc::UnitTest trasd_rar("TRASD", "Rank_Adaptive_Recovery", [](){
auto myTRASD = TRASD; auto myTRASD = TRASD;
myTRASD.maxIterations = 500; myTRASD.maxIterations = 100;
myTRASD.targetRelativeResidual = 1e-6; myTRASD.targetRelativeResidual = 1e-3;
for(const auto d : orders) { for(const auto d : orders) {
size_t residualSucc = 0, ErrorSucc = 0; size_t residualSucc = 0, ErrorSucc = 0;
...@@ -94,8 +94,8 @@ static misc::UnitTest trasd_rar("TRASD", "Rank_Adaptive_Recovery", [](){ ...@@ -94,8 +94,8 @@ static misc::UnitTest trasd_rar("TRASD", "Rank_Adaptive_Recovery", [](){
myTRASD(solution, measurments, std::vector<size_t>(d-1, 10)); myTRASD(solution, measurments, std::vector<size_t>(d-1, 10));
const double error = frob_norm(target-solution)/targetNorm; const double error = frob_norm(target-solution)/targetNorm;
const double residual = measurments.test(solution); const double residual = measurments.test(solution);
if(residual < 1e-4) { residualSucc++; } if(residual < 1e-3) { residualSucc++; }
if(error < 1e-4) { ErrorSucc++; } if(error < 3e-3) { ErrorSucc++; }
} }
MTEST(residualSucc >= successThreshold, "Only " << residualSucc << " of " << runs << " were succesfull in terms of residual."); MTEST(residualSucc >= successThreshold, "Only " << residualSucc << " of " << runs << " were succesfull in terms of residual.");
......
...@@ -115,7 +115,7 @@ static misc::UnitTest tensor_rnd_add_sub("Tensor", "Random_Add_Sub", [](){ ...@@ -115,7 +115,7 @@ static misc::UnitTest tensor_rnd_add_sub("Tensor", "Random_Add_Sub", [](){
std::vector<size_t> dimensions; std::vector<size_t> dimensions;
std::vector<size_t> idxPow(5, 0); std::vector<size_t> idxPow(5, 0);
for(size_t d = 0; d < 10; ++d) { for(size_t d = 0; d < 5; ++d) {
std::vector<size_t> opDim(dimensions); std::vector<size_t> opDim(dimensions);
opDim.insert(opDim.end(), dimensions.begin(), dimensions.end()); opDim.insert(opDim.end(), dimensions.begin(), dimensions.end());
std::uniform_int_distribution<size_t> numDist (0, misc::product(dimensions)); std::uniform_int_distribution<size_t> numDist (0, misc::product(dimensions));
......
...@@ -32,7 +32,7 @@ static misc::UnitTest alg_largestEntry("Algorithm", "LargestEntry", [](){ ...@@ -32,7 +32,7 @@ static misc::UnitTest alg_largestEntry("Algorithm", "LargestEntry", [](){
std::uniform_int_distribution<size_t> dimDist(1, 4); std::uniform_int_distribution<size_t> dimDist(1, 4);
std::uniform_int_distribution<size_t> rankDist(1, 5); std::uniform_int_distribution<size_t> rankDist(1, 5);
const size_t D = 15; const size_t D = 7;
for(size_t k = 0; k < 3; ++k) { for(size_t k = 0; k < 3; ++k) {
std::vector<size_t> stateDims; std::vector<size_t> stateDims;
......
...@@ -28,7 +28,7 @@ using namespace xerus; ...@@ -28,7 +28,7 @@ using namespace xerus;
static misc::UnitTest alg_adf_inverseidx("Algorithm", "adf_inverse_index_ratios", [](){ static misc::UnitTest alg_adf_inverseidx("Algorithm", "adf_inverse_index_ratios", [](){
const size_t D = 6; const size_t D = 6;
const size_t N = 10; const size_t N = 5;
const size_t R = 3; const size_t R = 3;
const size_t CS = 3; const size_t CS = 3;
......
...@@ -24,7 +24,16 @@ ...@@ -24,7 +24,16 @@
#include <xerus/algorithms/asd.h> #include <xerus/algorithms/asd.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-override"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wparentheses"
#pragma GCC diagnostic ignored "-Wuseless-cast"
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
#pragma GCC diagnostic ignored "-Wfloat-equal"
#include <boost/circular_buffer.hpp> #include <boost/circular_buffer.hpp>
#pragma GCC diagnostic pop
#include <xerus/misc/math.h> #include <xerus/misc/math.h>
#include <xerus/misc/basicArraySupport.h> #include <xerus/misc/basicArraySupport.h>
......
...@@ -28,8 +28,17 @@ ...@@ -28,8 +28,17 @@
#include <xerus/misc/basicArraySupport.h> #include <xerus/misc/basicArraySupport.h>
#include <xerus/misc/internal.h> #include <xerus/misc/internal.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-override"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wparentheses"
#pragma GCC diagnostic ignored "-Wuseless-cast"
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
#pragma GCC diagnostic ignored "-Wfloat-equal"
#include <boost/math/special_functions/hermite.hpp> #include <boost/math/special_functions/hermite.hpp>
#include <boost/math/special_functions/legendre.hpp> #include <boost/math/special_functions/legendre.hpp>
#pragma GCC diagnostic pop
#ifdef _OPENMP #ifdef _OPENMP
#include <omp.h> #include <omp.h>
......
...@@ -29,7 +29,16 @@ ...@@ -29,7 +29,16 @@
#include <xerus/misc/math.h> #include <xerus/misc/math.h>
#include <xerus/misc/internal.h> #include <xerus/misc/internal.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-override"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wparentheses"
#pragma GCC diagnostic ignored "-Wuseless-cast"
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
#pragma GCC diagnostic ignored "-Wfloat-equal"
#include <boost/circular_buffer.hpp> #include <boost/circular_buffer.hpp>
#pragma GCC diagnostic pop
#ifdef _OPENMP #ifdef _OPENMP
#include <omp.h> #include <omp.h>
...@@ -43,6 +52,7 @@ namespace xerus { namespace uq { namespace impl_uqRaAdf { ...@@ -43,6 +52,7 @@ namespace xerus { namespace uq { namespace impl_uqRaAdf {
const size_t N; const size_t N;
const size_t d; const size_t d;
double initialResiduum = 0.0;
const double targetResidual; const double targetResidual;
const size_t maxRank = 50; const size_t maxRank = 50;
const double minRankEps = 1e-10; const double minRankEps = 1e-10;
...@@ -456,7 +466,7 @@ namespace xerus { namespace uq { namespace impl_uqRaAdf { ...@@ -456,7 +466,7 @@ namespace xerus { namespace uq { namespace impl_uqRaAdf {
} }
} }
LOG(uqADF, "Residual decrease from " << std::scientific << 0.0 /* TODO */ << " to " << std::scientific << residuals.back() << " in " << _iteration << " iterations."); LOG(uqADF, "Residual decrease from " << std::scientific << initialResiduum << " to " << std::scientific << residuals.back() << " in " << _iteration << " iterations.");
} }
...@@ -469,9 +479,12 @@ namespace xerus { namespace uq { namespace impl_uqRaAdf { ...@@ -469,9 +479,12 @@ namespace xerus { namespace uq { namespace impl_uqRaAdf {
calc_right_stack(corePosition); calc_right_stack(corePosition);
} }
double optResidual, testResidual;
std::vector<double> setResiduals;
std::tie(optResidual, testResidual, setResiduals) = calc_residuals(0);
initialResiduum = optResidual; /* TODO: inefficient */
for(size_t iteration = 0; maxIterations == 0 || iteration < maxIterations; ++iteration) { for(size_t iteration = 0; maxIterations == 0 || iteration < maxIterations; ++iteration) {
double optResidual, testResidual;
std::vector<double> setResiduals;
std::tie(optResidual, testResidual, setResiduals) = calc_residuals(0); std::tie(optResidual, testResidual, setResiduals) = calc_residuals(0);
residuals.push_back(optResidual); residuals.push_back(optResidual);
prevRanks.push_back(x.ranks()); prevRanks.push_back(x.ranks());
......
...@@ -644,10 +644,10 @@ namespace xerus { ...@@ -644,10 +644,10 @@ namespace xerus {
lapackAnswer = LAPACKE_dpotrf2( lapackAnswer = LAPACKE_dpotrf2(
LAPACK_ROW_MAJOR, LAPACK_ROW_MAJOR,
'U', // Upper triangle of A is read 'U', // Upper triangle of A is read
static_cast<int>(_n), // dimensions of A static_cast<int>(_n), // dimensions of A
tmpA.get(), // input: A, output: cholesky factorisation tmpA.get(), // input: A, output: cholesky factorisation
static_cast<int>(_n) // LDA static_cast<int>(_n) // LDA
); );
XERUS_PA_END("Dense LAPACK", "Cholesky decomposition", misc::to_string(_n)+"x"+misc::to_string(_n)); XERUS_PA_END("Dense LAPACK", "Cholesky decomposition", misc::to_string(_n)+"x"+misc::to_string(_n));
...@@ -661,13 +661,13 @@ namespace xerus { ...@@ -661,13 +661,13 @@ namespace xerus {
lapackAnswer = LAPACKE_dpotrs( lapackAnswer = LAPACKE_dpotrs(
LAPACK_ROW_MAJOR, LAPACK_ROW_MAJOR,
'U', // upper triangle of cholesky decomp is stored in tmpA 'U', // upper triangle of cholesky decomp is stored in tmpA
static_cast<int>(_n), // dimensions of A static_cast<int>(_n), // dimensions of A
static_cast<int>(_nrhs),// number of rhs static_cast<int>(_nrhs), // number of rhs
tmpA.get(), // input: cholesky decomp tmpA.get(), // input: cholesky decomp
static_cast<int>(_n), // lda static_cast<int>(_n), // lda
_x, // input: rhs b, output: solution x _x, // input: rhs b, output: solution x
static_cast<int>(_nrhs) // ldb static_cast<int>(_nrhs) // ldb
); );
CHECK(lapackAnswer == 0, error, "Unable to solve Ax = b (cholesky solver). Lapacke says: " << lapackAnswer); CHECK(lapackAnswer == 0, error, "Unable to solve Ax = b (cholesky solver). Lapacke says: " << lapackAnswer);
......
...@@ -46,15 +46,6 @@ ...@@ -46,15 +46,6 @@
namespace xerus { namespace misc { namespace CodeCoverage { namespace xerus { namespace misc { namespace CodeCoverage {
std::map<std::string, std::unordered_set<std::string>>* testsCovered; std::map<std::string, std::unordered_set<std::string>>* testsCovered;
std::map<std::string, std::unordered_set<std::string>>* testsRequiredInit;
void register_test(const std::string& _location, const std::string& _identifier) {
// Initialization order is undefined, therefore the first one has to initialize.
if(!testsRequiredInit) { testsRequiredInit = new std::map<std::string, std::unordered_set<std::string>>; }
(*testsRequiredInit)[_location].insert(_identifier);
}
void covered(const std::string& _location, const std::string& _identifier) { void covered(const std::string& _location, const std::string& _identifier) {
// Initialization order is undefined, therefore the first covered test has to initialize. // Initialization order is undefined, therefore the first covered test has to initialize.
...@@ -74,7 +65,7 @@ namespace xerus { namespace misc { namespace CodeCoverage { ...@@ -74,7 +65,7 @@ namespace xerus { namespace misc { namespace CodeCoverage {
// Load required tests from .cc_loc section // Load required tests from .cc_loc section
auto range = get_range_of_section(reinterpret_cast<void*>(&print_code_coverage) /* ie inside this executable */, ".cc_loc"); auto range = get_range_of_section(reinterpret_cast<void*>(&print_code_coverage) /* ie inside this executable */, ".cc_loc");
auto step = sizeof(uintptr_t); auto step = sizeof(uintptr_t);
size_t count = 0; // size_t count = 0;
for (auto p = range.first; p < range.second; p += 2*step) { for (auto p = range.first; p < range.second; p += 2*step) {
char * loc = *reinterpret_cast<char **>(*reinterpret_cast<uintptr_t*>(p)); char * loc = *reinterpret_cast<char **>(*reinterpret_cast<uintptr_t*>(p));
const auto locationParts = misc::explode(loc, ':'); const auto locationParts = misc::explode(loc, ':');
...@@ -85,10 +76,7 @@ namespace xerus { namespace misc { namespace CodeCoverage { ...@@ -85,10 +76,7 @@ namespace xerus { namespace misc { namespace CodeCoverage {
const auto file = xerus::misc::normalize_pathname(locationParts[0]); const auto file = xerus::misc::normalize_pathname(locationParts[0]);
const auto lineNumber = xerus::misc::from_string<size_t>(locationParts[1]); const auto lineNumber = xerus::misc::from_string<size_t>(locationParts[1]);
char * name = *reinterpret_cast<char **>(*reinterpret_cast<uintptr_t*>(p+step)); char * name = *reinterpret_cast<char **>(*reinterpret_cast<uintptr_t*>(p+step));
if (requiredTests.count(file) == 0 || requiredTests[file].count(lineNumber) == 0 || requiredTests[file][lineNumber].count(name) == 0) { requiredTests[file][lineNumber][name] = false;
requiredTests[file][lineNumber][name] = false;
count += 1;
}
// LOG(codeCoverage, count << " " << file << ":" << lineNumber); // LOG(codeCoverage, count << " " << file << ":" << lineNumber);
} }
...@@ -97,8 +85,12 @@ namespace xerus { namespace misc { namespace CodeCoverage { ...@@ -97,8 +85,12 @@ namespace xerus { namespace misc { namespace CodeCoverage {
const auto testLines = xerus::misc::explode(xerus::misc::read_file("build/required_tests.txt"), '\n'); const auto testLines = xerus::misc::explode(xerus::misc::read_file("build/required_tests.txt"), '\n');
for(const auto& line : testLines) { for(const auto& line : testLines) {
if (line.find("note: #pragma message: REQUIRE_TEST @")==line.npos // gcc
&& line.find("warning: REQUIRE_TEST @")==line.npos // clang
) {
continue;
}
const auto lineParts = xerus::misc::explode(line, '@'); const auto lineParts = xerus::misc::explode(line, '@');
REQUIRE(lineParts.size() == 3, "Error parsing the required tests.");
const auto locationParts = misc::explode(lineParts[1], ':'); const auto locationParts = misc::explode(lineParts[1], ':');
REQUIRE(locationParts.size() == 2, "Error parsing the required tests."); REQUIRE(locationParts.size() == 2, "Error parsing the required tests.");
const auto file = xerus::misc::normalize_pathname(locationParts[0]); const auto file = xerus::misc::normalize_pathname(locationParts[0]);
......
...@@ -27,7 +27,16 @@ ...@@ -27,7 +27,16 @@
#include <xerus/misc/stringUtilities.h> #include <xerus/misc/stringUtilities.h>
#include <fstream> #include <fstream>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-override"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wparentheses"
#pragma GCC diagnostic ignored "-Wuseless-cast"
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
#pragma GCC diagnostic ignored "-Wfloat-equal"
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#pragma GCC diagnostic pop
namespace xerus { namespace misc { namespace xerus { namespace misc {
......
...@@ -22,10 +22,25 @@ ...@@ -22,10 +22,25 @@
* @brief Definition of common functions for the python bindings. * @brief Definition of common functions for the python bindings.
*/ */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-override"
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wparentheses"
#pragma GCC diagnostic ignored "-Wuseless-cast"
#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
#pragma GCC diagnostic ignored "-Wfloat-equal"
#pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wfloat-conversion"
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#pragma GCC diagnostic ignored "-Wundef"
#pragma GCC diagnostic ignored "-Wcast-qual"
#pragma GCC diagnostic ignored "-Wswitch-default"
#include <boost/function.hpp> #include <boost/function.hpp>
#include <boost/python.hpp> #include <boost/python.hpp>
#include <boost/python/stl_iterator.hpp> #include <boost/python/stl_iterator.hpp>
#include <boost/python/call.hpp> #include <boost/python/call.hpp>
#pragma GCC diagnostic pop
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wuseless-cast" #pragma GCC diagnostic ignored "-Wuseless-cast"
......
...@@ -130,8 +130,6 @@ namespace xerus { namespace misc { ...@@ -130,8 +130,6 @@ namespace xerus { namespace misc {
#undef main #undef main
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
using required_test_t = void (*)();