The information is readily available through the nvidia-smi command line tool.
But what about from inside the program?
Is there a good reason for providing the total allocated memory on GPUs
(including non-PETSc memory) through PETSc? If so, why don't we already print
the total system memory usage?
Not sure what you mean. PetscMemoryGetCurrentUsage() returns the current
usage as reported by /proc or getrusage and PetscMemoryGetMaxiumUsage() reports
the high-water mark. The command line option -memory_view reports this
information at the end of the run. So couldn't you easily rig up the same
thing for the GPU memory?
apparently PETSc already *is* a computational science operating system :-)
Shame on me, I wasn't aware that these functions exists. In such case it
only makes sense to add the same thing for GPUs (should be easy for
CUDA, but may be hard for OpenCL).
Best regards,
Karli