Dedicated Memory : How to Get Current Dedicated Memory programmatically CUDA Toolkit 11.2

Hi ,

I want to get the Current Dedicated Memory of any NVIDIA CUDA GPU device . I tried with NVAPI but it is not working with TCC GPUs like Tesla T4. I obtained that kind of info with NVidiaGPUInfoUnmanaged.curAvailableDedicatedVideoMemory for non-TCC devices.
I know that nvidia-smi.exe obtained that kind of info. During a research I found that nvidia-smi.exe works using NVML . NVML is part of GPU Deployment Kit . GPU Deployment Kit is now inside of CUDA Toolkit 11.2 .
I am trying to find a simple C++ code that gives me the equivalent of the Current Dedicated Memory .

Any help I would appreciate,
Thanks .