ritter
ritter

Reputation: 7699

CUDA Driver API equivalent to cudaDeviceSetCacheConfig

Comparing the CUDA (latest, v11.3 as of writing) driver API with the runtime API reveals that the runtime API has function

__host__ ​cudaError_t cudaDeviceSetCacheConfig ( cudaFuncCache cacheConfig )
    Sets the preferred cache configuration for the current device. 

and it seems the driver API has no equivalent function. Any insight to why that is and is there a way to set the device-wide cache configuration with the driver API?

Upvotes: 0

Views: 122

Answers (1)

Robert Crovella
Robert Crovella

Reputation: 151849

The corresponding function is cuCtxSetCacheConfig documented here.

The reason for the difference is that the driver API focuses on context behavior. The runtime API generally posits that for a particular process owner, there is only one context per device. (Therefore it generally has a "device" in view instead of a context.) The same is not necessarily the case for the driver API. So you you are given the ability to set it per-context.

If you only have one context per device, that control is effectively "device-wide".

Upvotes: 1

Related Questions