Merge pull request #195 from mlemanczyk/codex/add-console-notifications-in-benchmarks
Add console notifications for benchmark data preparation
This commit is contained in:
3 files changed
+23
-3
No files matched your search
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using BenchmarkDotNet.Jobs;
|
||||
@@ -51,6 +52,8 @@ public class GpuModularArithmeticBenchmarks
|
||||
|
||||
private static ModularArithmeticSampleData Create()
|
||||
{
|
||||
Console.WriteLine("Preparing modular arithmetic benchmark sample data...");
|
||||
|
||||
Random random = new(7);
|
||||
var exponents = new ulong[MaxBatchSize];
|
||||
var moduli = new ulong[MaxBatchSize];
|
||||
@@ -66,7 +69,11 @@ public class GpuModularArithmeticBenchmarks
|
||||
mersenneModuli[i] = (1UL << bits) - 1UL;
|
||||
}
|
||||
|
||||
return new ModularArithmeticSampleData(exponents, moduli, mersenneModuli, mersenneBitWidths);
|
||||
ModularArithmeticSampleData data = new ModularArithmeticSampleData(exponents, moduli, mersenneModuli, mersenneBitWidths);
|
||||
|
||||
Console.WriteLine("Finished preparing modular arithmetic benchmark sample data.");
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private static ulong NextExponent(Random random)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using BenchmarkDotNet.Jobs;
|
||||
|
||||
@@ -51,6 +52,8 @@ public class MontgomeryMultiplyBenchmarks
|
||||
|
||||
private static MontgomerySampleData Create()
|
||||
{
|
||||
Console.WriteLine("Preparing Montgomery multiply benchmark sample data...");
|
||||
|
||||
Random random = new(1979);
|
||||
var operandsA = new ulong[MaxBatchSize];
|
||||
var operandsB = new ulong[MaxBatchSize];
|
||||
@@ -66,7 +69,11 @@ public class MontgomeryMultiplyBenchmarks
|
||||
operandsB[i] = (ulong)random.NextInt64(0, (long)modulus);
|
||||
}
|
||||
|
||||
return new MontgomerySampleData(operandsA, operandsB, moduli, nPrimes);
|
||||
MontgomerySampleData data = new MontgomerySampleData(operandsA, operandsB, moduli, nPrimes);
|
||||
|
||||
Console.WriteLine("Finished preparing Montgomery multiply benchmark sample data.");
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private static ulong NextOddModulus(Random random)
|
||||
|
||||
@@ -443,6 +443,8 @@ public class Pow2ModBenchmarks
|
||||
|
||||
private static SampleCollections Create()
|
||||
{
|
||||
Console.WriteLine("Preparing power-of-two modulus benchmark sample collections...");
|
||||
|
||||
Random random = new(13);
|
||||
Random heuristicRandom = new(113);
|
||||
Random wideRandom = new(19);
|
||||
@@ -486,7 +488,7 @@ public class Pow2ModBenchmarks
|
||||
wideCycles[i] = CalculateCycleLengthWithHeuristics(wideModulus, ref previousWidePrimeOrder);
|
||||
}
|
||||
|
||||
return new SampleCollections(
|
||||
SampleCollections collections = new SampleCollections(
|
||||
smallDivisors,
|
||||
largeDivisors,
|
||||
veryLargeDivisors,
|
||||
@@ -499,6 +501,10 @@ public class Pow2ModBenchmarks
|
||||
largeCycles,
|
||||
veryLargeCycles,
|
||||
wideCycles);
|
||||
|
||||
Console.WriteLine("Finished preparing power-of-two modulus benchmark sample collections.");
|
||||
|
||||
return collections;
|
||||
}
|
||||
|
||||
private static ulong NextSmallExponent(Random random) => (ulong)random.NextInt64(1L, 1_000_000L);
|
||||
|
||||
Reference in new issue
Block a user