Skip to content

Commit ab5dfa3

Browse files
committed
saving.
1 parent 78211ef commit ab5dfa3

3 files changed

Lines changed: 23 additions & 22 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ We assume Linux or macOS. Under Windows 10, you can get the [Linux Subsystem](ht
4242
- Our scripts should work out of the box on most Linux boxes, except maybe when they are configured to act as secure servers (e.g., without a C compiler).
4343
- If you have a mac, it is assumed that [you have installed a recent Xcode package](https://developer.apple.com/xcode/) to get
4444
the C (and C++) compiler. Make sure you have installed the command-line utilities.
45-
- C++ compiler supporting C++23 (GCC 14+ or Clang 17+ recommended)
45+
- C++ compiler supporting C++20 (GCC 14+ or Clang 17+ recommended)
4646
- CMake (version 3.10 or later)
4747
- Perl interpreter (for summarizing TestU01 results)
4848
- Bash shell (for running test scripts)

speed/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.14)
22

3-
set(CMAKE_CXX_STANDARD 23)
3+
set(CMAKE_CXX_STANDARD 20)
44
set(CMAKE_CXX_STANDARD_REQUIRED ON)
55

66
include(../cmake/CPM.cmake)

speed/src/rng.cpp

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
#include <cstring>
55
#include <cassert>
66
#include <vector>
7-
#include <print>
7+
#include <format>
8+
#include <iostream>
89

910
#include "counters/bench.h"
1011

@@ -105,30 +106,30 @@ void populate128(rand128fnc f, __uint128_t *answer, size_t size) {
105106

106107
void pretty_print(const char *name, size_t bytes,
107108
counters::event_aggregate agg) {
108-
std::print("{:<40} : ", name);
109-
std::print(" {:5.2f} ns/byte ", agg.fastest_elapsed_ns() / double(bytes));
110-
std::print(" {:5.2f} GB/s ",
109+
std::cout << std::format("{:<40} : ", name);
110+
std::cout << std::format(" {:5.2f} ns/byte ", agg.fastest_elapsed_ns() / double(bytes));
111+
std::cout << std::format(" {:5.2f} GB/s ",
111112
double(bytes) / agg.fastest_elapsed_ns());
112113
if (counters::has_performance_counters()) {
113-
std::print(" {:5.2f} GHz ", agg.cycles() / double(agg.elapsed_ns()));
114-
std::print(" {:5.2f} c/b ", agg.fastest_cycles() / double(bytes));
115-
std::print(" {:5.2f} i/b ", agg.fastest_instructions() / double(bytes));
116-
std::print(" {:5.2f} i/c ",
114+
std::cout << std::format(" {:5.2f} GHz ", agg.cycles() / double(agg.elapsed_ns()));
115+
std::cout << std::format(" {:5.2f} c/b ", agg.fastest_cycles() / double(bytes));
116+
std::cout << std::format(" {:5.2f} i/b ", agg.fastest_instructions() / double(bytes));
117+
std::cout << std::format(" {:5.2f} i/c ",
117118
agg.fastest_instructions() / double(agg.fastest_cycles()));
118119
}
119-
std::print("\n");
120+
std::cout << "\n";
120121
}
121122

122123
void run_benchmark(int size) {
123-
std::print("Generating {} bytes of random numbers\n", size);
124-
std::print("Time reported per byte.\n");
125-
std::print("We store values to an array of size = {} kB.\n\n", size / 1024);
124+
std::cout << std::format("Generating {} bytes of random numbers\n", size);
125+
std::cout << "Time reported per byte.\n";
126+
std::cout << std::format("We store values to an array of size = {} kB.\n\n", size / 1024);
126127

127128
void *buf = malloc(size);
128129
assert(buf);
129130
assert(size % 8 == 0);
130131

131-
std::print("32-bit generators:\n");
132+
std::cout << "32-bit generators:\n";
132133
for (auto &g : generators32) {
133134
auto fn = g.fn;
134135
auto results = counters::bench([&]() {
@@ -137,7 +138,7 @@ void run_benchmark(int size) {
137138
pretty_print(g.name, size, results);
138139
}
139140

140-
std::print("\n64-bit generators:\n");
141+
std::cout << "\n64-bit generators:\n";
141142
for (auto &g : generators64) {
142143
auto fn = g.fn;
143144
auto results = counters::bench([&]() {
@@ -146,7 +147,7 @@ void run_benchmark(int size) {
146147
pretty_print(g.name, size, results);
147148
}
148149

149-
std::print("\n128-bit generators:\n");
150+
std::cout << "\n128-bit generators:\n";
150151
for (auto &g : generators128) {
151152
auto fn = g.fn;
152153
auto results = counters::bench([&]() {
@@ -156,16 +157,16 @@ void run_benchmark(int size) {
156157
}
157158

158159
free(buf);
159-
std::print("\n");
160+
std::cout << "\n";
160161
}
161162

162163
int main() {
163-
std::print("\n");
164+
std::cout << "\n";
164165
if (counters::has_performance_counters()) {
165-
std::print("Performance counters are available.\n");
166+
std::cout << "Performance counters are available.\n";
166167
} else {
167-
std::print("Performance counters are unavailable. Only timing will be reported.\n");
168-
std::print("You may be able to get counters by running as root (sudo).\n");
168+
std::cout << "Performance counters are unavailable. Only timing will be reported.\n";
169+
std::cout << "You may be able to get counters by running as root (sudo).\n";
169170
}
170171
run_benchmark(4096);
171172
return EXIT_SUCCESS;

0 commit comments

Comments
 (0)