Skip to content

Commit

Permalink
Minor edit to a comment in bench.h.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wei Dai committed Nov 12, 2021
1 parent ab59e9e commit 83541a5
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions native/bench/bench.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,14 @@ namespace sealbench
*/
void randomize_array_mod(std::uint64_t *data, std::size_t count, const seal::Modulus &modulus)
{
// Avoid using seal::UniformRandomGenerator, as it's slow enough to
// degrade performance with HEXL on some systems, due to AVX512 transitions.
// See https://travisdowns.github.io/blog/2020/01/17/avxfreq1.html#voltage-only-transitions.
std::random_device rd;
std::mt19937_64 generator(rd());
std::uniform_int_distribution<std::uint64_t> dist(0, modulus.value() - 1);
std::generate(data, data + count, [&]() { return dist(generator); });
// For the purpose of benchmark, avoid using seal::UniformRandomGenerator, as it degrades
// performance with HEXL on some systems, due to AVX512 transitions.
// See https://travisdowns.github.io/blog/2020/01/17/avxfreq1.html#voltage-only-transitions.
// This method is not used for random number generation in Microsoft SEAL.
std::random_device rd;
std::mt19937_64 generator(rd());
std::uniform_int_distribution<std::uint64_t> dist(0, modulus.value() - 1);
std::generate(data, data + count, [&]() { return dist(generator); });
}

/**
Expand Down

0 comments on commit 83541a5

Please sign in to comment.