public class Cuda extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Cuda.Event |
static class |
Cuda.Stream
A class representing a CUDA stream
|
Modifier and Type | Field and Description |
---|---|
static Cuda.Stream |
DEFAULT_STREAM |
Constructor and Description |
---|
Cuda() |
Modifier and Type | Method and Description |
---|---|
static void |
asyncMemset(long dst,
byte value,
long count)
Sets count bytes starting at the memory area pointed to by dst, with value.
|
static void |
autoSetDevice()
Set the device for this thread to the appropriate one.
|
static void |
deviceSynchronize()
Synchronizes the whole device using cudaDeviceSynchronize.
|
static void |
freeZero()
Calls cudaFree(0).
|
static int |
getComputeCapabilityMajor()
Gets the major CUDA compute capability of the current device.
|
static int |
getComputeCapabilityMinor()
Gets the minor CUDA compute capability of the current device.
|
static CudaComputeMode |
getComputeMode()
Gets the CUDA compute mode of the current device.
|
static int |
getDevice()
Get the id of the current device.
|
static int |
getDeviceCount()
Get the device count.
|
static int |
getDriverVersion()
Get the CUDA Driver version, which is the latest version of CUDA supported by the driver.
|
static int |
getRuntimeVersion()
Get the CUDA Runtime version of the current CUDA Runtime instance.
|
static boolean |
isEnvCompatibleForTesting()
This should only be used for tests, to enable or disable tests if the current environment
is not compatible with this version of the library.
|
static boolean |
isPtdsEnabled()
Whether per-thread default stream is enabled.
|
static CudaMemInfo |
memGetInfo()
Mapping: cudaMemGetInfo(size_t *free, size_t *total)
|
static void |
memset(long dst,
byte value,
long count)
Sets count bytes starting at the memory area pointed to by dst, with value.
|
static void |
multiBufferCopyAsync(long[] destAddrs,
long[] srcAddrs,
long[] copySizes,
Cuda.Stream stream)
Copy data from multiple device buffer sources to multiple device buffer destinations.
|
static void |
profilerStart()
Begins an Nsight profiling session, if a profiler is currently attached.
|
static void |
profilerStop()
Stops an active Nsight profiling session.
|
static void |
setDevice(int device)
Set the id of the current device.
|
public static final Cuda.Stream DEFAULT_STREAM
public static CudaComputeMode getComputeMode()
public static CudaMemInfo memGetInfo() throws CudaException
CudaException
public static void memset(long dst, byte value, long count) throws CudaException
dst
- - Destination memory addressvalue
- - Byte value to set dst withcount
- - Size in bytes to setCudaException
public static void asyncMemset(long dst, byte value, long count) throws CudaException
dst
- - Destination memory addressvalue
- - Byte value to set dst withcount
- - Size in bytes to setCudaException
public static int getDevice() throws CudaException
CudaException
- on any errorpublic static int getDeviceCount() throws CudaException
CudaException
- on any errorpublic static void setDevice(int device) throws CudaException, CudfException
Note this is relative to CUDA_SET_VISIBLE_DEVICES, e.g. if CUDA_SET_VISIBLE_DEVICES=1,0, and you call setDevice(0), you will get device 1.
Note if RMM has been initialized and the requested device ID does not match the device used to initialize RMM then this will throw an error.
CudaException
- on any errorCudfException
public static void autoSetDevice() throws CudaException
CudaException
- on any errorpublic static int getDriverVersion() throws CudaException
CudaException
- on any errorpublic static int getRuntimeVersion() throws CudaException
CudaException
- on any errorpublic static int getComputeCapabilityMajor() throws CudaException
CudaException
- on any errorpublic static int getComputeCapabilityMinor() throws CudaException
CudaException
- on any errorpublic static void freeZero() throws CudaException
CudaException
- on any errorpublic static boolean isEnvCompatibleForTesting()
public static boolean isPtdsEnabled()
public static void multiBufferCopyAsync(long[] destAddrs, long[] srcAddrs, long[] copySizes, Cuda.Stream stream)
destAddrs
- vector of device destination addressessrcAddrs
- vector of device source addressescopySizes
- vector of copy sizesstream
- CUDA stream to use for the copypublic static void profilerStart()
public static void profilerStop()
public static void deviceSynchronize()
Copyright © 2024. All rights reserved.