I can’t seem to find this function definition anywhere…
The CUDA Runtime API has lead me to believe that it should reside in “cuda_runtime.h” but I cannot find it anywhere.
I’m using CUDA2.3 on Ubuntu 9.04
Where is it?
Thanks in advance.
I can’t seem to find this function definition anywhere…
The CUDA Runtime API has lead me to believe that it should reside in “cuda_runtime.h” but I cannot find it anywhere.
I’m using CUDA2.3 on Ubuntu 9.04
Where is it?
Thanks in advance.
cuMemGetInfo (unsigned int free, unsigned int total)
Returns in free and total respectively, the free and total amount of memory available for allocation by the
CUDA context, in bytes.
please check it in CudaReferenceManual.pdf
Thanks, but that’s in the DRIVER API…
cudaMemGetInfo was new in 3.0 IIRC
alternately you can use cuMemGetInfo from an application that uses the runtime API so long as you include cuda.h and link against cuda.lib/libcuda.so
Thank you very much! :)
And don’t you also need to make sure that there’s been one cuda* call which will have caused a context to be established?
yeah, you do
Huh!? What does this mean? Where are you getting this information from?
runtime API exists on top of the driver API, so at a low level, the constraints imposed by the driver API still apply. this includes having a context present before making any calls that touch device state. runtime calls that need a context do this automatically, but you’d have to do it yourself if you’re going to use driver API calls before runtime API calls that create a context.
so, you’d do
cudaSetDevice(dev);
cudaFree(0); // context is now created
cuMemGetInfo(&total, &free); //or whatever the arguments are, I forget
I see! Once again, thank you Tim!
(Btw, 1st arg is &free :)