diff --git a/benchmarks/access_to_memory.cpp b/benchmarks/access_to_memory.cpp index 1cdc1a11fb133c77995e5331f2a23f201dda5f27..372ddc4739e1b446c099d0fbd13c38f2ba7b5908 100644 --- a/benchmarks/access_to_memory.cpp +++ b/benchmarks/access_to_memory.cpp @@ -5,6 +5,7 @@ #include <memory> constexpr size_t MB = 1024 * 1024; +namespace { class InitializeInput : public benchmark::Fixture { public: void SetUp(::benchmark::State& state) { @@ -31,6 +32,7 @@ class InitializeInput : public benchmark::Fixture { float* B; size_t array_size; }; +} // namespace BENCHMARK_F(InitializeInput, MemoryAccessRandomAccessData) (benchmark::State& state) { diff --git a/benchmarks/matrix_multiplication.cpp b/benchmarks/matrix_multiplication.cpp index 75a058de04e513b0b3869881e575e5c882b3602e..fb33ae17cb4f5bcf128fdb18bffb6e343b977832 100644 --- a/benchmarks/matrix_multiplication.cpp +++ b/benchmarks/matrix_multiplication.cpp @@ -1,6 +1,7 @@ #include <benchmark/benchmark.h> #include <matrix_multiplication.h> +namespace { class InitializeInput : public benchmark::Fixture { public: void SetUp(::benchmark::State& state) { @@ -25,6 +26,7 @@ class InitializeInput : public benchmark::Fixture { std::complex<float>* B; std::complex<float>* C; }; +} // namespace // Reference standard BENCHMARK_F(InitializeInput, MatrixMultiplicationReference) diff --git a/code/access_to_memory.h b/code/access_to_memory.h index f4bda63676d33bfe2497af84c24e63604329ad34..8d8375edffc961fc66f4500060420d8b0ec9411d 100644 --- a/code/access_to_memory.h +++ b/code/access_to_memory.h @@ -6,8 +6,9 @@ inline void Initialize(float* a, size_t size) { // Initialize matrices with random complex values - std::random_device rd; - std::mt19937 gen(rd()); + std::seed_seq seed({42}); + std::mt19937 gen(seed); + std::uniform_real_distribution<float> dis(-1.0, 1.0); for (size_t i = 0; i < size; i++) { a[i] = dis(gen);