GPU memory allocations protected with lock to prevent shared memory access issues. GPU usage limited for the best performance.

This commit is contained in:
mlemanczyk committed 2025-11-19 16:49:01 +01:00
1 parent 02d16bf05c
commit 5cac51479e
12 files changed
+236 -148

No files matched your search

+4 -3
View File
@@ -840,6 +840,8 @@ public class MersenneDivisorCycles
}
var divisorCycleKernel = GetDivisorCycleKernel(acceleratorIndex);
var kernelLauncher = divisorCycleKernel.CreateLauncherDelegate<Action<AcceleratorStream, Index1D, ArrayView1D<ulong, Stride1D.Dense>, ArrayView1D<ulong, Stride1D.Dense>>>();
while (start <= maxDivisor)
{
end = Math.Min(start + batchSizeUL - 1UL, maxDivisor);
@@ -860,15 +862,14 @@ public class MersenneDivisorCycles
// GpuKernelPool.Run((accelerator, stream) =>
MemoryBuffer1D<ulong, Stride1D.Dense>? bufferDiv;
MemoryBuffer1D<ulong, Stride1D.Dense>? bufferCycle;
// lock(accelerator)
lock(accelerator)
{
bufferDiv = accelerator.Allocate1D(validDivisors);
bufferCycle = accelerator.Allocate1D<ulong>(idx);
}
divisorCycleKernel.Launch(
kernelLauncher(
stream,
1,
idx,
bufferDiv.View,
bufferCycle.View);