--min-k command-line argument added. Partial factoring switched back to CPU.
This commit is contained in:
1 parent
13498dc460
commit
a296e62d4d
10 files changed
+485
-160
No files matched your search
@@ -1,9 +1,10 @@
|
||||
using ILGPU;
|
||||
using ILGPU.Runtime;
|
||||
using Open.Collections;
|
||||
|
||||
namespace PerfectNumbers.Core.Gpu
|
||||
{
|
||||
public struct AcceleratorPool
|
||||
public struct AcceleratorPool : IDisposable
|
||||
{
|
||||
internal readonly Context Context;
|
||||
internal readonly Device Device;
|
||||
@@ -28,6 +29,23 @@ namespace PerfectNumbers.Core.Gpu
|
||||
// Intentionally left empty - there's nothing to do here. We're not really renting anything.
|
||||
}
|
||||
|
||||
public readonly void Dispose()
|
||||
{
|
||||
Accelerator[] accelerators = Accelerators;
|
||||
HashSet<Context> contexts = new(accelerators.Length);
|
||||
foreach (var accelerator in accelerators)
|
||||
{
|
||||
contexts.Add(accelerator.Context);
|
||||
accelerator.Synchronize();
|
||||
accelerator.Dispose();
|
||||
}
|
||||
|
||||
foreach (var context in contexts)
|
||||
{
|
||||
context.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public static readonly AcceleratorPool Shared = new(PerfectNumberConstants.RollingAccelerators);
|
||||
|
||||
private readonly int Capacity;
|
||||
|
||||
Reference in new issue
Block a user