falahati / NvAPIWrapper

NvAPIWrapper is a .Net wrapper for NVIDIA public API, capable of managing all aspects of a display setup using NVIDIA GPUs
GNU Lesser General Public License v3.0
313 stars 55 forks source link

Question about "CUDA compute capability" #22

Open folker85 opened 4 years ago

folker85 commented 4 years ago

Hi! Is there any way I can get information about "CUDA compute capability" information from gpu ?

Thanks.

falahati commented 4 years ago

For this you need to use CUDA Toolkit, specifically these functions:

https://docs.nvidia.com/cuda/cuda-driver-api/group__CUDA__DEVICE.html

As far as I know, NVAPI does not provide any useful information about CUDA devices; at least not via the public endpoints. The only thing remotely related is a boolean value indicating if the GPU is in TCC mode which is not very useful since in majority of setups GPUs are not in TCC mode.

If you use CUDA toolkit, then you should be able to find the relative GPU's handle from NVAPI (since they are different) by matching the PCI and BUS information if needed.

folker85 commented 4 years ago

Sorry, I asked the question a little wrong. I meant not a CUDA compute capability, but a GPU compute capability (this version number identifies the features supported by the GPU hardware and is used by applications at runtime to determine which hardware features and/or instructions are available on the present GPU.). This topic reveals that I am looking for "SM version" https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#compute-capability

I've found a property NvAPIWrapper.GPU.GPUArchitectInformation.TotalNumberOfSMs (throws exception with a Message = "NVAPI_NOT_SUPPORTED"). Maybe this is it?

falahati commented 4 years ago

No, that one returns the number of shader pipelines/shader processing units.

Maybe this is the method you need: https://docs.nvidia.com/gameworks/content/gameworkslibrary/coresdk/nvapi/group__dx.html#ga677d37443aa36ae012a939668a154316

To query these: https://docs.nvidia.com/gameworks/content/gameworkslibrary/coresdk/nvapi/nvShaderExtnEnums_8h.html

If that's the case, no, not yet. None of DirectX methods are supported yet by this library since I didn't expect anyone using those. You can, however, add support for them easily if that's the case.

If this was in fact the method you needed, I will keep this issue open as a reminder.

falahati commented 4 years ago

Well, it seems that this method is, in fact, the ones most close to what you want (based on the link you provided). However, you then need to check the capabilities and find the right shader version correlated to it. So it should be a lot of work. I still suggest using the CUDA toolkit for this type of information since NVAPI does not concern itself with compute capabilities and barely provides limited information/functions for rendering. It is more or less concerned only about the driver settings and display settings.

folker85 commented 4 years ago

Thanks for the quick response!