How to acquire the serialnumber of the GPU chip by the way of software?

I am developing a software recently,i need to get the serialnumber of the GPU chip .I want a unique identifier of the card,but i don’t konw how to get it,so if someone konws,please tell me.Thanks here first!

Try nvidia-smi -q. On my machine it reports the serial number as “N/A” for both GPUs, but it does report something called a UUID, which looks like it could be useful for your purpose of having a unique identifier for every GPU.

If you need to retrieve this information from inside an application rather than a script I would suggest looking at NVML. Sorry, I have not used NVML so I cannot provide a more precise pointer. I don’t even know whether NVML has a function that allows retrieval of such data at all, but if this functionality exists I would expect it to be exposed via NVML.

Thank you very much!