public class Rmm extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Rmm.LogConf
What to send RMM alloc and free logs to.
|
| Constructor and Description |
|---|
Rmm() |
| Modifier and Type | Method and Description |
|---|---|
static DeviceMemoryBuffer |
alloc(long size)
Allocate device memory and return a pointer to device memory, using stream 0.
|
static DeviceMemoryBuffer |
alloc(long size,
Cuda.Stream stream)
Allocate device memory and return a pointer to device memory.
|
static void |
clearEventHandler()
Clears the active RMM event handler if one is set.
|
static long |
getTotalBytesAllocated()
Return the amount of RMM memory allocated in bytes.
|
static void |
initialize(int allocationMode,
boolean enableLogging,
long poolSize)
Initialize memory manager state and storage.
|
static void |
initialize(int allocationMode,
boolean enableLogging,
long poolSize,
long maxPoolSize)
Initialize memory manager state and storage.
|
static void |
initialize(int allocationMode,
Rmm.LogConf logConf,
long poolSize)
Initialize memory manager state and storage.
|
static void |
initialize(int allocationMode,
Rmm.LogConf logConf,
long poolSize,
long maxPoolSize)
Initialize memory manager state and storage.
|
static void |
initialize(int allocationMode,
Rmm.LogConf logConf,
long poolSize,
long maxPoolSize,
long allocationAlignment,
long alignmentThreshold)
Initialize memory manager state and storage.
|
static boolean |
isInitialized()
Check if RMM has been initialized already or not.
|
static Rmm.LogConf |
logTo(File location)
Create a config that will write alloc/free logs to a file.
|
static Rmm.LogConf |
logToStderr()
Create a config that will write alloc/free logs to stderr.
|
static Rmm.LogConf |
logToStdout()
Create a config that will write alloc/free logs to stdout.
|
static void |
setEventHandler(RmmEventHandler handler)
Sets the event handler to be called on RMM events (e.g.: allocation failure).
|
static void |
shutdown()
Shut down any initialized RMM instance.
|
static void |
shutdown(long forceGCInterval,
long maxWaitTime,
TimeUnit units)
Shut down any initialized RMM instance.
|
public static Rmm.LogConf logTo(File location)
public static Rmm.LogConf logToStdout()
public static Rmm.LogConf logToStderr()
public static void initialize(int allocationMode,
boolean enableLogging,
long poolSize)
throws RmmException
NOTE: All cudf methods will set the chosen CUDA device in the CUDA context of the calling thread after this returns.
allocationMode - Allocation strategy to use. Bit set using
RmmAllocationMode.CUDA_DEFAULT,
RmmAllocationMode.POOL,
RmmAllocationMode.ARENA and
RmmAllocationMode.CUDA_MANAGED_MEMORYenableLogging - Enable logging memory manager eventspoolSize - The initial pool size in bytesIllegalStateException - if RMM has already been initializedRmmExceptionpublic static void initialize(int allocationMode,
boolean enableLogging,
long poolSize,
long maxPoolSize)
throws RmmException
NOTE: All cudf methods will set the chosen CUDA device in the CUDA context of the calling thread after this returns.
allocationMode - Allocation strategy to use. Bit set using
RmmAllocationMode.CUDA_DEFAULT,
RmmAllocationMode.POOL,
RmmAllocationMode.ARENA and
RmmAllocationMode.CUDA_MANAGED_MEMORYenableLogging - Enable logging memory manager eventspoolSize - The initial pool size in bytesmaxPoolSize - The maximum size the pool is allowed to grow. If the specified value
is <= 0 then the maximum pool size will not be artificially limited.IllegalStateException - if RMM has already been initializedRmmExceptionpublic static void initialize(int allocationMode,
Rmm.LogConf logConf,
long poolSize)
throws RmmException
NOTE: All cudf methods will set the chosen CUDA device in the CUDA context of the calling thread after this returns.
allocationMode - Allocation strategy to use. Bit set using
RmmAllocationMode.CUDA_DEFAULT,
RmmAllocationMode.POOL,
RmmAllocationMode.ARENA and
RmmAllocationMode.CUDA_MANAGED_MEMORYlogConf - How to do logging or null if you don't want topoolSize - The initial pool size in bytesIllegalStateException - if RMM has already been initializedRmmExceptionpublic static void initialize(int allocationMode,
Rmm.LogConf logConf,
long poolSize,
long maxPoolSize)
throws RmmException
NOTE: All cudf methods will set the chosen CUDA device in the CUDA context of the calling thread after this returns.
allocationMode - Allocation strategy to use. Bit set using
RmmAllocationMode.CUDA_DEFAULT,
RmmAllocationMode.POOL,
RmmAllocationMode.ARENA and
RmmAllocationMode.CUDA_MANAGED_MEMORYlogConf - How to do logging or null if you don't want topoolSize - The initial pool size in bytesmaxPoolSize - The maximum size the pool is allowed to grow. If the specified value
is <= 0 then the pool size will not be artificially limited.IllegalStateException - if RMM has already been initializedIllegalArgumentException - if a max pool size is specified but the allocation mode
is not RmmAllocationMode.POOL or
RmmAllocationMode.ARENA, or the maximum pool size is
below the initial size.RmmExceptionpublic static void initialize(int allocationMode,
Rmm.LogConf logConf,
long poolSize,
long maxPoolSize,
long allocationAlignment,
long alignmentThreshold)
throws RmmException
NOTE: All cudf methods will set the chosen CUDA device in the CUDA context of the calling thread after this returns.
allocationMode - Allocation strategy to use. Bit set using
RmmAllocationMode.CUDA_DEFAULT,
RmmAllocationMode.POOL,
RmmAllocationMode.ARENA and
RmmAllocationMode.CUDA_MANAGED_MEMORYlogConf - How to do logging or null if you don't want topoolSize - The initial pool size in bytesmaxPoolSize - The maximum size the pool is allowed to grow. If the specified value
is <= 0 then the pool size will not be artificially limited.allocationAlignment - The size to which allocations are aligned.alignmentThreshold - Only allocations with size larger than or equal to this threshold
are aligned with `allocationAlignment`.IllegalStateException - if RMM has already been initializedIllegalArgumentException - if a max pool size is specified but the allocation mode
is not RmmAllocationMode.POOL or
RmmAllocationMode.ARENA, or the maximum pool size is
below the initial size.RmmExceptionpublic static boolean isInitialized()
throws RmmException
RmmExceptionpublic static long getTotalBytesAllocated()
public static void setEventHandler(RmmEventHandler handler) throws RmmException
handler - event handler to invoke on RMM events or null to clear an existing handlerRmmException - if an active handler is already setpublic static void clearEventHandler()
throws RmmException
RmmExceptionpublic static void shutdown()
throws RmmException
RmmException - on any error. This includes if there are outstanding allocations that
could not be collected.public static void shutdown(long forceGCInterval,
long maxWaitTime,
TimeUnit units)
throws RmmException
forceGCInterval - how frequently should we force a JVM GC. This is just a recommendation
to the JVM to do a gc.maxWaitTime - the maximum amount of time to wait for all objects to be collected before
throwing an exception.units - the units for forceGcInterval and maxWaitTime.RmmException - on any error. This includes if there are outstanding allocations that
could not be collected before maxWaitTime.public static DeviceMemoryBuffer alloc(long size)
size - The size in bytes of the allocated memory regionpublic static DeviceMemoryBuffer alloc(long size, Cuda.Stream stream)
size - The size in bytes of the allocated memory regionstream - The stream in which to synchronize this command.Copyright © 2021. All rights reserved.