Commit 2e6dfc89 authored by Christoph Conrads's avatar Christoph Conrads

Benchmark AWC, SWB for similar parameters

parent 23e73243
......@@ -8,7 +8,7 @@ CXX := g++
CXXFLAGS := -O3 -march=native -DNDEBUG
SOURCES := \
batch-vs-sequential.cpp \
awc-vs-swb.cpp batch-vs-sequential.cpp \
benchmark.cpp rlxt-vs-std.cpp print-random.cpp swc24-vs-native-ints.cpp
EXECUTABLES := $(patsubst %.cpp,%.bin,$(SOURCES))
......
// Copyright 2019 Christoph Conrads
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include "benchmark.hpp"
#include <cassert>
#include <cstdio>
#include <cstdint>
#include <ctime>
#include <limits>
#include <random>
#include <string>
#include <type_traits>
namespace rlxt = ranlux_tools;
using awc16 =
rlxt::add_with_carry_engine<std::uint16_t, 16, 2, 9>;
using swc16 =
rlxt::subtract_with_borrow_engine<std::uint16_t, 16, 3, 11>;
using awc32 =
rlxt::add_with_carry_engine<std::uint32_t, 32, 3, 16>;
using swc32 =
rlxt::subtract_with_borrow_engine<std::uint32_t, 32, 3, 17>;
#if RANLUX_TOOLS_HAS_INT128
using swb64 =
rlxt::subtract_with_borrow_engine<std::uint64_t, 64, 15, 2>;
using swc64 =
rlxt::subtract_with_borrow_engine<std::uint64_t, 64, 4, 26>;
#endif
int main()
{
constexpr auto num_draws = std::uintmax_t{1000} * 1000u * 1000u;
std::printf(
"%-25s | %10s | %20s | %s\n",
"generator", "time(sec)", "throughput(byte/sec)", "dummy"
);
rlxt::run<rlxt::dummy_engine>(num_draws);
rlxt::run<awc16>(num_draws);
rlxt::run<swc16>(num_draws);
rlxt::run<awc32>(num_draws);
rlxt::run<swc32>(num_draws);
#if RANLUX_TOOLS_HAS_INT128
rlxt::run<swb64>(num_draws);
rlxt::run<swc64>(num_draws);
#endif
}
......@@ -7,6 +7,7 @@
#ifndef RADEMACHER_FPL_RANDOM_NUMBER_ENGINE_HPP
#define RADEMACHER_FPL_RANDOM_NUMBER_ENGINE_HPP
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <limits>
......
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