public final class PinnedMemoryPool extends Object implements AutoCloseable
Modifier and Type | Method and Description |
---|---|
static HostMemoryBuffer |
allocate(long bytes)
Factory method to create a host buffer but preferably pointing to pinned memory.
|
static HostMemoryBuffer |
allocate(long bytes,
HostMemoryAllocator hostMemoryAllocator)
Factory method to create a host buffer but preferably pointing to pinned memory.
|
void |
close() |
static long |
getTotalPoolSizeBytes()
Get the number of bytes that the pinned memory pool was allocated with.
|
static void |
initialize(long poolSize)
Initialize the pool.
|
static void |
initialize(long poolSize,
int gpuId)
Initialize the pool.
|
static void |
initialize(long poolSize,
int gpuId,
boolean setCuioHostMemoryResource)
Initialize the pool.
|
static boolean |
isInitialized()
Check if the pool has been initialized or not.
|
static void |
shutdown()
Shut down the RMM pool_memory_resource, nulling out our reference.
|
static HostMemoryBuffer |
tryAllocate(long bytes)
Factory method to create a pinned host memory buffer.
|
public static void initialize(long poolSize)
poolSize
- size of the pool to initialize.public static void initialize(long poolSize, int gpuId)
poolSize
- size of the pool to initialize.gpuId
- gpu id to set to get memory pool from, -1 means to use defaultpublic static void initialize(long poolSize, int gpuId, boolean setCuioHostMemoryResource)
poolSize
- size of the pool to initialize.gpuId
- gpu id to set to get memory pool from, -1 means to use defaultsetCuioHostMemoryResource
- true if this pinned pool should be used by cuIO for host memorypublic static boolean isInitialized()
public static void shutdown()
public static HostMemoryBuffer tryAllocate(long bytes)
bytes
- size in bytes to allocatepublic static HostMemoryBuffer allocate(long bytes, HostMemoryAllocator hostMemoryAllocator)
bytes
- size in bytes to allocatepublic static HostMemoryBuffer allocate(long bytes)
bytes
- size in bytes to allocatepublic static long getTotalPoolSizeBytes()
public void close()
close
in interface AutoCloseable
Copyright © 2024. All rights reserved.