--gpu-ration command-line argument added. AscendingDivisorRemainderStepper implemented in PrimeTester.IsPrimeCpu. PrimeOrderCalculator.RunOnCpu adjusted for low GPU ratios to prevent infinite increase of the counter.
This commit is contained in:
1 parent
f43c67c86f
commit
85a90c70bf
9 files changed
+296
-212
No files matched your search
@@ -58,19 +58,11 @@ namespace PerfectNumbers.Core.Gpu
|
||||
var device = context.GetPreferredDevice(false);
|
||||
Context = context;
|
||||
Device = device;
|
||||
int acceleratorsInContext = 0;
|
||||
int acceleratorIndex = 0;
|
||||
Accelerators = [.. Enumerable.Range(0, capacity).Select(_ =>
|
||||
{
|
||||
Console.WriteLine($"Preparing accelerator {acceleratorIndex++}");
|
||||
Accelerator accelerator = device.CreateAccelerator(context);
|
||||
acceleratorsInContext++;
|
||||
if (acceleratorsInContext >= 128)
|
||||
{
|
||||
context = Context.CreateDefault();
|
||||
device = context.GetPreferredDevice(false);
|
||||
acceleratorsInContext = 0;
|
||||
}
|
||||
|
||||
return accelerator;
|
||||
})];
|
||||
|
||||
Reference in new issue
Block a user