Cuda.get_device_properties(0).total_memory gives larger value than cuda.get_device_properties(0)

The line torch.cuda.get_device_properties(0) gives me the output
_CudaDeviceProperties(name='NVIDIA A100-PCIE-40GB', major=8, minor=0, total_memory=40396MB, multi_processor_count=108),
but torch.cuda.get_device_properties(0).total_memory / 1000000 gives me the output
42358.472704.

Why is there a difference in ‘total memory’ here?

The difference would come from dividing by 1000 vs. 1024:

42358.472704 * 1000000 / 1024**2
# 40396.1875

Oh, I frankly didn’t know that 1 "kilo"byte is 1024 bytes. You learn something new every day. :slight_smile: