How much allocated memory


Is there a simple runtime API in CUDA Fortran that I can call to find out how much memory was allocated on the GPU.

Thank you,


Hi Kirk,

Try calling cudaMemGetInfo:

% cat memavail.cuf
program memavail
  use cudafor
  implicit none
  integer :: ierr
  integer(8) :: avail, total
  ierr = cudaMemGetInfo( avail, total );
  print *, "total     =", total
  print *, "avail     =", avail
end program memavail
% pgf90 memavail.cuf; a.out
 total     =              12079136768
 avail     =              11978764288
  • Mat

Thank you, that is exactly what I was looking for!

Have a good weekend.