available memory

How can I know how much available global device memory I have at any moment ? The problem : program works at my PC but not at my customer PC although his PC has 800 Mb while my - 384. CudaMalloc fails. I want to know do I have contiguous block of enough size to make memory request.

I think his memory was occupied by another program. Is there a way to get memory map ?

[url=“http://www.nvidia.com/content/cudazone/cuda_sdk/CUDA_Basic_Topics.html#deviceQuery”]http://www.nvidia.com/content/cudazone/cud...tml#deviceQuery[/url]

Try this. You will get the amount of your global memory.

that’s not what he wants, he wants to see total free memory

cuMemGetInfo does what you want, even from a runtime API app.

Thank you very much.

are you mixing 32-bit cuda libraries on 64-bit platform – this one has a known issue with cudaMalloc.

btw, print the error number on failure. That would help.

Also, if the user is having his desktop on the card – he could consider moving to very low resolutin – juss in case if that was the problem

Could we please get an example of this in runtime please? I don’t see the value in the deviceQuery example.

(I’m trying to detect a memory leak in my program. Would there be a better way?)

A google search turns up: http://forums.nvidia.com/index.php?showtopic=64337

Yes. Compile in emulation mode with debug symbols and run in valgrind. It can tell you which line of code allocated memory that was not freed.

Thanks for the help, especially the valgrind hint. I’ll have a look.

The google search shows a driver API method of accessing an available memory value. I’m trying to do the same thing using the runtime API. ‘tmurray’ (who I guess works at NVIDIA) said above that it could be accessed using runtime.

And he said it even works from a runtime API application… It is one of the few driver API functions you can call from the runtime API without causing any problems. Just make sure you’ve initialized the context first by calling cudaMalloc() or something.