6.2. 设备管理 [已弃用]
本节介绍CUDA运行时应用程序编程接口中已弃用的设备管理函数。
Functions
- __host__ __device__ cudaError_t cudaDeviceGetSharedMemConfig ( cudaSharedMemConfig ** pConfig )
- Returns the shared memory configuration for the current device.
- __host__ cudaError_t cudaDeviceSetSharedMemConfig ( cudaSharedMemConfig config )
- Sets the shared memory configuration for the current device.
Functions
- __host__ __device__ cudaError_t cudaDeviceGetSharedMemConfig ( cudaSharedMemConfig ** pConfig )
-
返回当前设备的共享内存配置。
参数
- pConfig
- - Returned cache configuration
已弃用
描述
This function will return in pConfig the current size of shared memory banks on the current device. On devices with configurable shared memory banks, cudaDeviceSetSharedMemConfig can be used to change this setting, so that all subsequent kernel launches will by default use the new bank size. When cudaDeviceGetSharedMemConfig is called on devices without configurable shared memory, it will return the fixed bank size of the hardware.返回的银行配置可以是以下之一:
-
cudaSharedMemBankSizeFourByte - 共享内存存储体宽度为4字节。
-
cudaSharedMemBankSizeEightByte - 共享内存存储体宽度为8字节。
Note:-
请注意,此函数也可能返回之前异步启动的错误代码。
-
请注意,如果此调用尝试初始化CUDA RT内部状态,该函数也可能返回cudaErrorInitializationError、cudaErrorInsufficientDriver或cudaErrorNoDevice。
-
请注意,根据cudaStreamAddCallback的规定,回调函数中不得调用任何CUDA函数。在这种情况下,可能会(但不保证)返回cudaErrorNotPermitted作为诊断信息。
另请参阅:
cudaDeviceSetCacheConfig, cudaDeviceGetCacheConfig, cudaDeviceSetSharedMemConfig, cudaFuncSetCacheConfig, cuCtxGetSharedMemConfig
- __host__ cudaError_t cudaDeviceSetSharedMemConfig ( cudaSharedMemConfig config )
-
为当前设备设置共享内存配置。
参数
- config
- - Requested cache configuration
已弃用
描述
On devices with configurable shared memory banks, this function will set the shared memory bank size which is used for all subsequent kernel launches. Any per-function setting of shared memory set via cudaFuncSetSharedMemConfig will override the device wide setting.在两次启动之间更改共享内存配置可能会引入设备端的同步点。
更改共享内存的存储体大小不会增加共享内存的使用量或影响内核的占用率,但可能会对性能产生重大影响。较大的存储体大小可以带来更高的共享内存潜在带宽,但会改变哪些类型的共享内存访问会导致存储体冲突。
此函数在具有固定共享内存库大小的设备上将不执行任何操作。
支持的银行配置包括:
-
cudaSharedMemBankSizeDefault:将存储体宽度设为设备默认值(当前为4字节)
-
cudaSharedMemBankSizeFourByte: 将共享内存的存储体宽度原生设置为4字节。
-
cudaSharedMemBankSizeEightByte: 将共享内存的存储体宽度原生设置为8字节。
Note:-
请注意,此函数也可能返回之前异步启动的错误代码。
-
请注意,如果此调用尝试初始化CUDA RT内部状态,该函数也可能返回cudaErrorInitializationError、cudaErrorInsufficientDriver或cudaErrorNoDevice。
-
请注意,根据cudaStreamAddCallback的规定,回调函数中不得调用任何CUDA函数。在这种情况下,可能会(但不保证)返回cudaErrorNotPermitted作为诊断信息。
另请参阅:
cudaDeviceSetCacheConfig, cudaDeviceGetCacheConfig, cudaDeviceGetSharedMemConfig, cudaFuncSetCacheConfig, cuCtxSetSharedMemConfig