Deep.Net


Cuda

Namespace: Tensor.Utils

Cuda support types functions

Nested types and modules

TypeDescription
BlockDim

CUDA block dimension (x, y, z)

GridDim

CUDA grid dimension (x, y, z)

LaunchDim

CUDA launch dimension

WorkDim

dimensionality of parallel work to perform (x, y, z)

Functions and values

Function or valueDescription
blas
Signature: CudaBlas
callback cuStream fn
Signature: cuStream:CUstream -> fn:(unit -> unit) -> unit

Places a callback function on a CUDA stream. The function is executed on a global callback thread and is allowed to make CUDA calls. The thread's CUDA context has been set to the libraries CUDA context. The CUDA stream continues execution while the callback function is being invoked. The callback can be blocked by waiting for other callbacks.

callbackWithResult cuStream fn
Signature: cuStream:CUstream -> fn:(CUResult -> unit) -> unit

Places a callback function on a CUDA stream. The function is executed on a thread-pool thread and is allowed to make CUDA calls. This function is less efficient than Cuda.callback.

checkContext ()
Signature: unit -> unit

Checks that the thread's current CUDA context is the CUDA context that was active or created while this module was initialized.

computeLaunchDim (...)
Signature: (int64 * int64 * int64) -> maxBlockSize:int -> LaunchDim

Computes CUDA launch dimensions from work dimensions and maximum block size. It is possible that the calculated launch dimensions will be smaller than the specified work dimensions, since the maximum block and grid sizes are limited.

context
Signature: CudaContext

CUDA context

deviceInfo
Signature: CudaDeviceProperties

CUDA device info

divCeil a b
Signature: a:int64 -> b:int64 -> int64

Is equivalent to int64 (ceil(float a / float b)).

getIntPtr cuPtr
Signature: cuPtr:CUdeviceptr -> IntPtr

gets device pointer as IntPtr

init ()
Signature: unit -> unit

Ensures that CUDA is initialized. Multiple calls are allowed and have no effect.

keepAlive cuStream x
Signature: cuStream:CUstream -> x:obj -> unit

Keeps the given object alive (i.e. prevent it from being GCed) until all operations that were queued on the given CUDA stream up to now have been executed.

keepAliveMany cuStream xs
Signature: cuStream:CUstream -> xs:obj list -> unit

Keeps the given objects alive (i.e. prevent them from being GCed) until all operations that were queued on the given CUDA stream up to now have been executed.

maxBlockDim
Signature: BlockDim

CUDA maximum block dimension

maxGridDim
Signature: GridDim

CUDA maximum grid dimension

nvccArch
Signature: string

nvcc arch code

nvccCode
Signature: string

nvcc sm code

printDevice ()
Signature: unit -> unit

prints short CUDA device information

printInfo ()
Signature: unit -> unit

prints CUDA info

setContext ()
Signature: unit -> unit

Sets the thread's current CUDA context to the CUDA context that was active or created while this module was initialized.

shutdown ()
Signature: unit -> unit

shutsdown CUDA (necessary for correct profiler results)

toDim3 (arg1, arg2, arg3)
Signature: (int * int * int) -> dim3

convert block/grid dimension (x, y, z) to VectorTypes.dim3

Fork me on GitHub