Get Cuda DeviceId within the program


I wanted to ask whether it is possible to get the Cuda deviceId from inside an Optix program.
I found the exact question in this thread:
The solutions were only how to set the Device beforehand, but I need to find out which device the program is running on.

Thank you.

How about:

I’ve also tried it, but I didn’t manage to make it work. Might be because I’m working with Optix 3.8