Options
All
  • Public
  • Public/Protected
  • All
Menu

Class LoggingResourceAdapter

brief

Resource that uses an upstream MemoryResource to allocate memory and logs information about the requested allocation/deallocations.

An instance of this resource can be constructed with an existing, upstream resource in order to satisfy allocation requests and log allocation/deallocation activity.

Hierarchy

Index

Constructors

constructor

  • new LoggingResourceAdapter(upstreamMemoryResource: MemoryResource, logFilePath?: string, autoFlush?: boolean): LoggingResourceAdapter
  • summary

    Constructs a MemoryResource that logs information about allocations/deallocations performed by an upstream MemoryResource.

    Parameters

    • upstreamMemoryResource: MemoryResource

      The upstream MemoryResource to log.

    • Optional logFilePath: string

      Path to the file to which logs are written. If not provided, falls back to the RMM_LOG_FILE environment variable.

    • Optional autoFlush: boolean

      If true, flushes the log for every (de)allocation. Warning, this will degrade performance.

    Returns LoggingResourceAdapter

Properties

Readonly logFilePath

logFilePath: string

Path to the file to which logs are written.

Readonly memoryResource

memoryResource: MemoryResource

The MemoryResource to use for allocations larger than any of the bins.

Readonly supportsGetMemInfo

supportsGetMemInfo: boolean
summary

A boolean indicating whether the resource supports the getMemInfo() API.

Readonly supportsStreams

supportsStreams: boolean
summary

A boolean indicating whether the resource supports use of non-null CUDA streams for allocation/deallocation.

Methods

flush

  • flush(): void

getMemInfo

  • getMemInfo(stream?: number): [number, number]
  • Queries the amount of free and total memory for the resource.

    Parameters

    • Optional stream: number

      the stream whose memory manager we want to retrieve

    Returns [number, number]

    a tuple which contains [free memory, total memory] (in bytes)

isEqual

  • isEqual(other: MemoryResource): boolean
  • summary

    Compare this resource to another.

    remarks

    Two CudaMemoryResource instances always compare equal, because they can each deallocate memory allocated by the other.

    Parameters

    • other: MemoryResource

      The other resource to compare to

    Returns boolean

    true if the two resources are equal, else false