Add GPU options for by-divisor Montgomery data
This commit is contained in:
1 parent
ea29035c55
commit
483584b5d4
5 files changed
+449
-77
No files matched your search
@@ -76,6 +76,7 @@ internal static class Program
|
||||
bool useDivisor = false; // M_p divisibility by specific divisor
|
||||
bool useByDivisor = false; // Iterative divisor scan across primes UInt128 divisor = UInt128.Zero;
|
||||
ByDivisorDeltasDevice byDivisorDeltasDevice = ByDivisorDeltasDevice.Cpu;
|
||||
ByDivisorMontgomeryDevice byDivisorMontgomeryDevice = ByDivisorMontgomeryDevice.Cpu;
|
||||
// Device routing
|
||||
bool useGpuCycles = true;
|
||||
bool mersenneOnGpu = true; // controls Lucas/incremental/pow2mod device
|
||||
@@ -200,6 +201,23 @@ internal static class Program
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (arg.StartsWith("--bydivisor-montgomery-device=", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
ReadOnlySpan<char> deviceValue = arg.AsSpan(arg.IndexOf('=') + 1);
|
||||
if (deviceValue.Equals("gpu", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
byDivisorMontgomeryDevice = ByDivisorMontgomeryDevice.Gpu;
|
||||
}
|
||||
else if (deviceValue.Equals("cpu", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
byDivisorMontgomeryDevice = ByDivisorMontgomeryDevice.Cpu;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Invalid --bydivisor-montgomery-device value. Expected cpu or gpu.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (arg.StartsWith("--prime-test-limit=", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
ReadOnlySpan<char> value = arg.AsSpan(arg.IndexOf('=') + 1);
|
||||
@@ -552,6 +570,7 @@ internal static class Program
|
||||
if (_byDivisorTester is MersenneNumberDivisorByDivisorCpuTester cpuByDivisorTester)
|
||||
{
|
||||
cpuByDivisorTester.DeltasDevice = byDivisorDeltasDevice;
|
||||
cpuByDivisorTester.MontgomeryDevice = byDivisorMontgomeryDevice;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1007,6 +1026,7 @@ internal static class Program
|
||||
Console.WriteLine(" --divisor-cycles-limit=<value> cycle search iterations when --mersenne=divisor");
|
||||
Console.WriteLine(" --prime-test-limit=<value> Time limit for --mersenne=bydivisor prime checks (e.g. 5s, 500ms)");
|
||||
Console.WriteLine(" --bydivisor-deltas-device=cpu|gpu Device for --mersenne=bydivisor residue batches (default: cpu)");
|
||||
Console.WriteLine(" --bydivisor-montgomery-device=cpu|gpu Device for Montgomery data when using --mersenne=bydivisor (default: cpu)");
|
||||
Console.WriteLine(" --use-order test primality via q order");
|
||||
Console.WriteLine(" --workaround-mod avoid '%' operator on the GPU");
|
||||
// mod-automaton removed
|
||||
|
||||
Reference in new issue
Block a user