Commit 96ceef03 authored by Philipp  Trunschke's avatar Philipp Trunschke

Merge branch 'development' of git.hemio.de:xerus/xerus into development

parents 15cf3735 8a0fa1dc
Pipeline #1224 failed with stages
in 10 minutes and 13 seconds
......@@ -2,7 +2,9 @@
# Compiler Options
#=================================================================================================
CXX = g++
COMPATIBILITY = -std=c++11
COMPATIBILITY = -std=c++14
DEBUG_OPTIMIZATION = TRUE
ACTIVATE_CODE_COVERAGE = TRUE # Enable coverage tests
BROCKEN_CI = TRUE # Enable workaround for brocken CI runner
......
......@@ -12,7 +12,7 @@ stages:
job_build_homepage:
stage: build_homepage
script: "cp .gitlab-ci-configs/.config.mk.ci.gcc config.mk; make -C doc doc && scp -r doc/html xerusweb:libxerus.org-443"
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:
- master
......@@ -35,7 +35,7 @@ job_test_gcc_nocheck:
job_code_coverage:
stage: code_coverage
script: "g++ --version; cp .gitlab-ci-configs/.config.mk.ci.gcc 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
artifacts:
expire_in: 3h
......
......@@ -28,12 +28,12 @@ COMPATIBILITY = -std=c++14
#=================================================================================================
# Optimization
#=================================================================================================
# We suggest the use of one of the following optimization levels. The first uses basically no
# optimization and is primarly intended for debugging purposes. The second (recommended) level
# activates more or less all optimization options that conform with the ISO C++ Standard.
# We suggest the use of one of the following optimization levels. The first uses -Og and is
# primarly intended for debugging purposes. The second (recommended) level activates more or
# less all optimization options that conform with the ISO C++ Standard.
# The last level activates all optimazations available, including non-ISO C++ conform optimization
# and optimazations that may result in a loss of numerical precicsion, use at your own risk.
# LOW_OPTIMIZATION = TRUE # Activates -O0
# DEBUG_OPTIMIZATION = TRUE # Activates -O0
HIGH_OPTIMIZATION = TRUE # Activates -O3 -march=native and some others
# DANGEROUS_OPTIMIZATION = TRUE # Activates everything of HIGH_OPTIMIZATION plus basically everything that is said to improve performance including several potentially unsafe optimizations
......
......@@ -52,7 +52,7 @@
".quad %c0" "\n" \
".quad %c1" "\n" \
".popsection" "\n" \
: : "i"(xerusCCLocalFunctionLocation), "i"(xerusCCLocalFunctionName) \
: : "i"(&xerusCCLocalFunctionLocation), "i"(&xerusCCLocalFunctionName) \
); \
xerus::misc::CodeCoverage::covered(xerusCCLocalFunctionLocation, xerusCCLocalFunctionName); \
\
......@@ -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>>* testsRequiredInit;
void register_test(const std::string& _location, const std::string& _identifier);
void covered(const std::string& _location, const std::string& _identifier);
void print_code_coverage();
......
......@@ -34,9 +34,11 @@ ifdef USE_LTO
endif
# Set optimization options
ifdef LOW_OPTIMIZATION
DEBUG += -D LOW_OPTIMIZATION
OPTIMIZE += -O0
ifdef DEBUG_OPTIMIZATION
DEBUG += -D DEBUG_OPTIMIZATION
ifndef USE_CLANG
OPTIMIZE += -Og
endif
else ifdef HIGH_OPTIMIZATION
DEBUG += -D HIGH_OPTIMIZATION
OPTIMIZE += -O3 # Even more optimization, using non iso conform C++ operations
......
......@@ -39,7 +39,7 @@ else ifdef USE_GCC
WARNINGS += -Wtrampolines # Warn about trampolines
# WARNINGS += -Wzero-as-null-pointer-constant # Warn when a literal '0' is used as null pointer constant.
WARNINGS += -Wnoexcept # Warn when a noexcept-expression evaluates to false because of a call to a function that does not have noexcept but is known by the compiler to never throw.
# WARNINGS += -Wsuggest-override # Suggest functions that do override
WARNINGS += -Wsuggest-override # Suggest functions that do override
ifdef SUGGEST_ATTRIBUTES
WARNINGS += -Wsuggest-attribute=pure # Suggest functions that can be pure
......
......@@ -27,8 +27,8 @@ static misc::UnitTest trasd_frr("TRASD", "Fixed_Rank_Recovery", [](){
auto myTRASD = TRASD;
myTRASD.maxIterations = 500;
myTRASD.targetRelativeResidual = 1e-6;
myTRASD.maxIterations = 100;
myTRASD.targetRelativeResidual = 1e-3;
for(const auto d : orders) {
size_t residualSucc = 0, ErrorSucc = 0;
......@@ -52,8 +52,8 @@ static misc::UnitTest trasd_frr("TRASD", "Fixed_Rank_Recovery", [](){
myTRASD(solution, measurments);
const double error = frob_norm(target-solution)/targetNorm;
const double residual = measurments.test(solution);
if(residual < 1e-6) { residualSucc++; }
if(error < 1e-4) { ErrorSucc++; }
if(residual < 1e-3) { residualSucc++; }
if(error < 3e-3) { ErrorSucc++; }
}
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", [](){
auto myTRASD = TRASD;
myTRASD.maxIterations = 500;
myTRASD.targetRelativeResidual = 1e-6;
myTRASD.maxIterations = 100;
myTRASD.targetRelativeResidual = 1e-3;
for(const auto d : orders) {
size_t residualSucc = 0, ErrorSucc = 0;
......@@ -94,8 +94,8 @@ static misc::UnitTest trasd_rar("TRASD", "Rank_Adaptive_Recovery", [](){
myTRASD(solution, measurments, std::vector<size_t>(d-1, 10));
const double error = frob_norm(target-solution)/targetNorm;
const double residual = measurments.test(solution);
if(residual < 1e-4) { residualSucc++; }
if(error < 1e-4) { ErrorSucc++; }
if(residual < 1e-3) { residualSucc++; }
if(error < 3e-3) { ErrorSucc++; }
}
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", [](){
std::vector<size_t> dimensions;
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);
opDim.insert(opDim.end(), dimensions.begin(), dimensions.end());
std::uniform_int_distribution<size_t> numDist (0, misc::product(dimensions));
......
......@@ -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> rankDist(1, 5);
const size_t D = 15;
const size_t D = 7;
for(size_t k = 0; k < 3; ++k) {
std::vector<size_t> stateDims;
......
......@@ -28,7 +28,7 @@ using namespace xerus;
static misc::UnitTest alg_adf_inverseidx("Algorithm", "adf_inverse_index_ratios", [](){
const size_t D = 6;
const size_t N = 10;
const size_t N = 5;
const size_t R = 3;
const size_t CS = 3;
......
......@@ -46,15 +46,6 @@
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>>* 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) {
// Initialization order is undefined, therefore the first covered test has to initialize.
......@@ -74,9 +65,9 @@ namespace xerus { namespace misc { namespace CodeCoverage {
// 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 step = sizeof(uintptr_t);
size_t count = 0;
// size_t count = 0;
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, ':');
if (locationParts.size() != 2) {
LOG(warning, "i don't understand the required test location: '" << loc << "'");
......@@ -84,11 +75,8 @@ namespace xerus { namespace misc { namespace CodeCoverage {
}
const auto file = xerus::misc::normalize_pathname(locationParts[0]);
const auto lineNumber = xerus::misc::from_string<size_t>(locationParts[1]);
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;
count += 1;
}
char * name = *reinterpret_cast<char **>(*reinterpret_cast<uintptr_t*>(p+step));
requiredTests[file][lineNumber][name] = false;
// LOG(codeCoverage, count << " " << file << ":" << lineNumber);
}
......
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