No. of divisor cycle iterations made configurable
This commit is contained in:
1 parent
c8c80f2f91
commit
f17f83e326
2 files changed
+11
-3
No files matched your search
@@ -31,7 +31,6 @@ internal static class Program
|
|||||||
private static ulong _divisor;
|
private static ulong _divisor;
|
||||||
private static MersenneNumberDivisorGpuTester? _divisorTester;
|
private static MersenneNumberDivisorGpuTester? _divisorTester;
|
||||||
private static (ulong divisor, uint cycle)[]? _divisorCandidates;
|
private static (ulong divisor, uint cycle)[]? _divisorCandidates;
|
||||||
private const int ExtraDivisorCycleSearchLimit = 32;
|
|
||||||
private static ulong? _orderWarmupLimitOverride;
|
private static ulong? _orderWarmupLimitOverride;
|
||||||
private static unsafe delegate*<ulong, ref ulong, ulong> _transformP;
|
private static unsafe delegate*<ulong, ref ulong, ulong> _transformP;
|
||||||
private static long _state;
|
private static long _state;
|
||||||
@@ -76,6 +75,7 @@ private static ulong? _orderWarmupLimitOverride;
|
|||||||
string cyclesPath = DefaultCyclesPath;
|
string cyclesPath = DefaultCyclesPath;
|
||||||
int cyclesBatchSize = 512;
|
int cyclesBatchSize = 512;
|
||||||
bool continueCyclesGeneration = false;
|
bool continueCyclesGeneration = false;
|
||||||
|
int divisorCyclesSearchLimit = PerfectNumberConstants.ExtraDivisorCycleSearchLimit;
|
||||||
|
|
||||||
// NTT backend selection (GPU): reference vs staged
|
// NTT backend selection (GPU): reference vs staged
|
||||||
for (int i = 0; i < args.Length; i++)
|
for (int i = 0; i < args.Length; i++)
|
||||||
@@ -137,6 +137,11 @@ private static ulong? _orderWarmupLimitOverride;
|
|||||||
int eq = arg.IndexOf('=');
|
int eq = arg.IndexOf('=');
|
||||||
divisor = ulong.Parse(arg.AsSpan(eq + 1));
|
divisor = ulong.Parse(arg.AsSpan(eq + 1));
|
||||||
}
|
}
|
||||||
|
else if (arg.StartsWith("--divisor-cycles-limit=", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
int eq = arg.IndexOf('=');
|
||||||
|
divisorCyclesSearchLimit = int.Parse(arg.AsSpan(eq + 1));
|
||||||
|
}
|
||||||
else if (arg.StartsWith("--residue-max-k=", StringComparison.OrdinalIgnoreCase))
|
else if (arg.StartsWith("--residue-max-k=", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
int eq = arg.IndexOf('=');
|
int eq = arg.IndexOf('=');
|
||||||
@@ -714,6 +719,7 @@ private static ulong? _orderWarmupLimitOverride;
|
|||||||
Console.WriteLine(" --divisor-cycles-device=cpu|gpu device for cycles generation (default gpu)");
|
Console.WriteLine(" --divisor-cycles-device=cpu|gpu device for cycles generation (default gpu)");
|
||||||
Console.WriteLine(" --divisor-cycles-batch-size=<value> batch size for cycles generation (default 512)");
|
Console.WriteLine(" --divisor-cycles-batch-size=<value> batch size for cycles generation (default 512)");
|
||||||
Console.WriteLine(" --divisor-cycles-continue continue divisor cycles generation");
|
Console.WriteLine(" --divisor-cycles-continue continue divisor cycles generation");
|
||||||
|
Console.WriteLine(" --divisor-cycles-limit=<value> cycle search iterations when --mersenne=divisor");
|
||||||
|
|
||||||
Console.WriteLine(" --use-order test primality via q order");
|
Console.WriteLine(" --use-order test primality via q order");
|
||||||
Console.WriteLine(" --workaround-mod avoid '%' operator on the GPU");
|
Console.WriteLine(" --workaround-mod avoid '%' operator on the GPU");
|
||||||
@@ -948,7 +954,7 @@ private static ulong? _orderWarmupLimitOverride;
|
|||||||
return IsEvenPerfectCandidate(p, out _, out _);
|
return IsEvenPerfectCandidate(p, out _, out _);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static bool IsEvenPerfectCandidate(ulong p, out bool searchedMersenne, out bool detailedCheck)
|
internal static bool IsEvenPerfectCandidate(ulong p, int divisorCyclesSearchLimit, out bool searchedMersenne, out bool detailedCheck)
|
||||||
{
|
{
|
||||||
searchedMersenne = false;
|
searchedMersenne = false;
|
||||||
detailedCheck = false;
|
detailedCheck = false;
|
||||||
@@ -1043,7 +1049,7 @@ private static ulong? _orderWarmupLimitOverride;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int k = 1; k <= ExtraDivisorCycleSearchLimit; k++)
|
for (int k = 1; k <= divisorCyclesSearchLimit; k++)
|
||||||
{
|
{
|
||||||
ulong kMul2 = 2UL * (ulong)k;
|
ulong kMul2 = 2UL * (ulong)k;
|
||||||
if (p > ulong.MaxValue / kMul2)
|
if (p > ulong.MaxValue / kMul2)
|
||||||
|
|||||||
@@ -5,4 +5,6 @@ public static class PerfectNumberConstants
|
|||||||
public const ulong BiggestKnownEvenPerfectP = 136279841UL;
|
public const ulong BiggestKnownEvenPerfectP = 136279841UL;
|
||||||
public static readonly uint PrimesLimit = 1_000_000; //(ulong)Array.MaxLength;// 1_000_000;
|
public static readonly uint PrimesLimit = 1_000_000; //(ulong)Array.MaxLength;// 1_000_000;
|
||||||
public const int MaxQForDivisorCycles = 4_000_000;
|
public const int MaxQForDivisorCycles = 4_000_000;
|
||||||
|
public const int ExtraDivisorCycleSearchLimit = 64;
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user