Commit 61c24792 authored by David Frank's avatar David Frank
Browse files

Fix warnings in elsa/test_allmodules for integrations-tests target

parent f7e144cc
Pipeline #530154 passed with stages
in 14 minutes and 51 seconds
......@@ -46,7 +46,8 @@ namespace elsa
* @param stddev standard deviation of samples
* @return pair of lower and upper bound of 95% confidence interval
*/
constexpr auto confidenceInterval95(std::size_t n, real_t mean, real_t stddev)
template <typename data_t = real_t>
constexpr auto confidenceInterval95(std::size_t n, data_t mean, data_t stddev)
-> std::pair<real_t, real_t>
{
// Do we run often enough to assume a large sample size?
......
......@@ -28,10 +28,11 @@ namespace elsa
Logger::setLevel(Logger::LogLevel::OFF);
}
template <typename data_t = real_t>
static void logLaps(int dim, int size, std::size_t benchIters, std::string_view opName,
std::string_view solName, std::size_t noIters, real_t timeMean,
real_t timeStddev, real_t timeLower, real_t timeUpper,
real_t absErrMean, real_t relErrMean)
std::string_view solName, int noIters, data_t timeMean,
data_t timeStddev, data_t timeLower, data_t timeUpper,
data_t absErrMean, data_t relErrMean)
{
// Log output of this iterations
Logger::setLevel(Logger::LogLevel::INFO);
......
......@@ -14,7 +14,11 @@
namespace elsa
{
/// Stats for a single iteration of a run
template <typename data_t = real_t>
struct Stats {
/// Typedef to make generic programming easier
using Scalar = data_t;
/// Store time as floating point representation that we can easily print in decimal notation
using fsec = std::chrono::duration<real_t>;
......@@ -22,10 +26,10 @@ namespace elsa
fsec::rep _time;
/// Absolute error
real_t _absError;
data_t _absError;
/// Relative error
real_t _relError;
data_t _relError;
};
/**
......@@ -34,15 +38,16 @@ namespace elsa
* @param stats vector of `Stats` storing samples for each iteration of the benchmark
* @return mean and standard deviation of each of the quantities stored in `Stats`
*/
auto evaluateStats(const std::vector<Stats>& stats)
template <typename data_t = real_t>
auto evaluateStats(const std::vector<Stats<data_t>>& stats)
{
std::vector<Stats::fsec::rep> time;
std::vector<typename Stats<data_t>::fsec::rep> time;
time.reserve(stats.size());
std::vector<real_t> absError;
std::vector<typename Stats<data_t>::Scalar> absError;
absError.reserve(stats.size());
std::vector<real_t> relError;
std::vector<typename Stats<data_t>::Scalar> relError;
relError.reserve(stats.size());
for (const auto& s : stats) {
......@@ -157,7 +162,7 @@ namespace elsa
Logging::logHeader();
// Some statistics we want to save
std::vector<Stats> stats(benchIters);
std::vector<Stats<data_t>> stats(benchIters);
// Setup a phantom, default a Modified Shepp Logan
auto phantom = phantomSetup(dim, size);
......@@ -222,8 +227,9 @@ namespace elsa
auto [lower, upper] = confidenceInterval95(benchIters, timeMean, timeStddev);
// Log a laps
Logging::logLaps(dim, size, benchIters, opName, solName, noIters, timeMean,
timeStddev, lower, upper, absErrMean, relErrMean);
Logging::template logLaps<data_t>(dim, size, benchIters, opName, solName, noIters,
timeMean, timeStddev, lower, upper, absErrMean,
relErrMean);
}
}
} // namespace detail
......
......@@ -14,4 +14,7 @@ int main()
benchDriver<CG, SiddonsMethod>(2, 64, 5);
benchDriver<ADMM, CG, SoftThresholding, SiddonsMethod>(2, 32, 5);
benchDriver<ISTA, SiddonsMethod>(2, 32, 5);
// Explicitly test for double
benchDriver<CG, SiddonsMethod, double>(2, 64, 5);
}
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