Traction control and core

I use Thrust in my current project, so I don’t need to write abstraction or (segmented) scans of the device_vector kernel.

So far, I have done all my work using traction abstractions, but for simple kernels or kernels that don’t easily transform into for_each or transform abstractions, I would rather write my own kernels at some point.

So my question is: can I ask through Thrust (or, possibly, CUDA) which device is currently used and what properties it has (maximum block size, maximum shared memory, all this)?

If I cannot get the current device, is there any way to get me to calculate the kernel sizes if I provide kernel registers and shared memory requirements?

+4
source share
1 answer

You can query the current device using CUDA. See CUDA Documentation in Device Management . Find cudaGetDevice() , cudaSetDevice() , cudaGetDeviceProperties() , etc.

Thrust has no idea about device management at this time. I'm not sure what you mean by β€œget a push to calculate the size of the kernel,” but if you want to determine the size of the grid to run your own kernel, you need to do it yourself. This can help request kernel properties with cudaFuncGetAttributes() , which Thrust uses.

+3
source

All Articles