RmmCudaAsyncMemoryResource#

public class RmmCudaAsyncMemoryResource implements RmmDeviceMemoryResource#

A device memory resource that uses cudaMallocAsync and cudaFreeAsync for allocation and deallocation.

Constructor Summary

RmmCudaAsyncMemoryResource(long size, long releaseThreshold)

Create a new async memory resource.

RmmCudaAsyncMemoryResource(long size, long releaseThreshold, HandleType handleType)

Create a new async memory resource whose CUDA memory pool supports the given export handle type.

RmmCudaAsyncMemoryResource(long size, long releaseThreshold, boolean fabric)

Create a new async memory resource.

Method Summary

close()

getHandle()

Returns a pointer to the underlying C++ class that implements an RMM device memory resource.

getHandleType()

The export handle type the underlying CUDA memory pool was created with.

getPoolHandle()

Get the underlying cudaMemPool_t.

getSize()

toString()

Constructors

public RmmCudaAsyncMemoryResource(long size, long releaseThreshold)#

Create a new async memory resource.

Parameters:
  • size – the initial size of the pool

  • releaseThreshold – size in bytes for when memory is released back to cuda

public RmmCudaAsyncMemoryResource(
long size,
long releaseThreshold,
boolean fabric
)#

Create a new async memory resource.

Parameters:
  • size – the initial size of the pool

  • releaseThreshold – size in bytes for when memory is released back to cuda

  • fabric – if true request peer read+write accessible fabric handles when creating the pool

public RmmCudaAsyncMemoryResource(
long size,
long releaseThreshold,
HandleType handleType
)#

Create a new async memory resource whose CUDA memory pool supports the given export handle type.

Parameters:
  • size – the initial size of the pool

  • releaseThreshold – size in bytes for when memory is released back to cuda

  • handleType – the export handle type of the pool

Methods

public long getHandle()#

Returns a pointer to the underlying C++ class that implements an RMM device memory resource.

public long getSize()#
public HandleType getHandleType()#

The export handle type the underlying CUDA memory pool was created with.

public long getPoolHandle()#

Get the underlying cudaMemPool_t.

It can be exported with Cuda.memPoolExportToPosixFd(long) only if the resource was created with HandleType.POSIX_FILE_DESCRIPTOR.

public void close()#
public String toString()#
public enum HandleType#

The export handle type of the CUDA memory pool.

nativeId matches rmm::mr::cuda_async_memory_resource::allocation_handle_type, whose values are the CUDA cudaMemAllocationHandleType values. Like RMM, FABRIC is the literal 0x8 because cudaMemHandleTypeFabric is not defined in CUDA versions before 12.4.

Enum Constant Summary

FABRIC

The pool supports exporting fabric handles (cudaMemHandleTypeFabric).

NONE

The pool does not support exporting (cudaMemHandleTypeNone).

POSIX_FILE_DESCRIPTOR

The pool supports exporting POSIX file descriptors (cudaMemHandleTypePosixFileDescriptor).

Enum Constants

NONE#

The pool does not support exporting (cudaMemHandleTypeNone).

POSIX_FILE_DESCRIPTOR#

The pool supports exporting POSIX file descriptors (cudaMemHandleTypePosixFileDescriptor).

FABRIC#

The pool supports exporting fabric handles (cudaMemHandleTypeFabric).