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.
|
void |
close() |
static long |
getAvailableBytes()
Get the number of bytes free in the pinned memory pool.
|
static void |
initialize(long poolSize)
Initialize the pool.
|
static void |
initialize(long poolSize,
int gpuId)
Initialize the pool.
|
static boolean |
isInitialized()
Check if the pool has been initialized or not.
|
static void |
shutdown()
Shut down the pool of memory.
|
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 boolean isInitialized()
public static void shutdown()
public static HostMemoryBuffer tryAllocate(long bytes)
bytes - size in bytes to allocatepublic static HostMemoryBuffer allocate(long bytes)
bytes - size in bytes to allocatepublic static long getAvailableBytes()
public void close()
close in interface AutoCloseableCopyright © 2023. All rights reserved.