public class Cuda extends Object
修饰符和类型 | 类和描述 |
---|---|
static class |
Cuda.Event |
static class |
Cuda.Stream
表示 CUDA stream 的类
|
修饰符和类型 | 字段和描述 |
---|---|
static Cuda.Stream |
DEFAULT_STREAM |
构造方法和描述 |
---|
Cuda() |
修饰符和类型 | 方法和描述 |
---|---|
static void |
asyncMemset(long dst, byte value, long count)
将从 dst 指向的内存区域开始的 count 字节设置为 value。
|
static void |
autoSetDevice()
将此线程的设备设置为适当的设备。
|
static void |
deviceSynchronize()
使用 cudaDeviceSynchronize 同步整个设备。
|
static void |
freeZero()
调用 cudaFree(0)。
|
static int |
getComputeCapabilityMajor()
获取当前设备的 CUDA 主要计算能力。
|
static int |
getComputeCapabilityMinor()
获取当前设备的 CUDA 次要计算能力。
|
static CudaComputeMode |
getComputeMode()
获取当前设备的 CUDA 计算模式。
|
static int |
getDevice()
获取当前设备的 ID。
|
static int |
getDeviceCount()
获取设备数量。
|
static int |
getDriverVersion()
获取 CUDA 驱动程序版本,这是驱动程序支持的最新 CUDA 版本。
|
static int |
getRuntimeVersion()
获取当前 CUDA Runtime 实例的 CUDA Runtime 版本。
|
static boolean |
isEnvCompatibleForTesting()
这仅应在测试中使用,用于在当前环境与此库版本不兼容时启用或禁用测试。
|
static boolean |
isPtdsEnabled()
是否启用每线程默认 stream。
|
static CudaMemInfo |
memGetInfo()
映射:cudaMemGetInfo(size_t *free, size_t *total)
|
static void |
memset(long dst, byte value, long count)
将从 dst 指向的内存区域开始的 count 字节设置为 value。
|
static void |
multiBufferCopyAsync(long[] destAddrs, long[] srcAddrs, long[] copySizes, Cuda.Stream stream)
将数据从多个设备缓冲区源复制到多个设备缓冲区目标。
|
static void |
profilerStart()
如果当前已附加性能分析器,则开始一个 Nsight 性能分析会话。
|
static void |
profilerStop()
停止活动的 Nsight 性能分析会话。
|
static void |
setDevice(int device)
设置当前设备的 ID。
|
public static final Cuda.Stream DEFAULT_STREAM
public static CudaComputeMode getComputeMode()
public static CudaMemInfo memGetInfo() throws CudaException
public static void memset(long dst, byte value, long count) throws CudaException
dst
- - 目标内存地址value
- - 用于设置 dst 的字节值count
- - 要设置的字节大小CudaException
public static void asyncMemset(long dst, byte value, long count) throws CudaException
dst
- - 目标内存地址value
- - 用于设置 dst 的字节值count
- - 要设置的字节大小CudaException
public static int getDevice() throws CudaException
CudaException
- 发生任何错误时public static int getDeviceCount() throws CudaException
CudaException
- 发生任何错误时public static void setDevice(int device) throws CudaException, CudfException
请注意,这相对于 CUDA_SET_VISIBLE_DEVICES 设置,例如,如果 CUDA_SET_VISIBLE_DEVICES=1,0,并且您调用 setDevice(0),您将获得设备 1。
请注意,如果 RMM 已初始化且请求的设备 ID 与用于初始化 RMM 的设备不匹配,则会抛出错误。
CudaException
- 发生任何错误时CudfException
public static void autoSetDevice() throws CudaException
CudaException
- 发生任何错误时public static int getDriverVersion() throws CudaException
CudaException
- 发生任何错误时public static int getRuntimeVersion() throws CudaException
CudaException
- 发生任何错误时public static int getComputeCapabilityMajor() throws CudaException
CudaException
- 发生任何错误时public static int getComputeCapabilityMinor() throws CudaException
CudaException
- 发生任何错误时public static void freeZero() throws CudaException
CudaException
- 发生任何错误时public static boolean isEnvCompatibleForTesting()
public static boolean isPtdsEnabled()
public static void multiBufferCopyAsync(long[] destAddrs, long[] srcAddrs, long[] copySizes, Cuda.Stream stream)
destAddrs
- - 设备目标地址向量srcAddrs
- - 设备源地址向量copySizes
- - 复制大小向量stream
- - 用于复制的 CUDA streampublic static void profilerStart()
public static void profilerStop()
public static void deviceSynchronize()
版权所有 © 2025。保留所有权利。