Memory problem

My code allocate 3 float* on GPU memory. The total size allocated depends on 3 variables N,M,D.
The total size is (ND + MD + N*M) * 4 Bytes.
The problem is that the total memory copy on device is approximately 300Mo while my 8800 GTX have 768Mo.
Do you have any idea of what can be my problem?
And another question : Do I have to allocate the maximum amount of memory available because now I split my data to manage memory problem.

You have not said yet what your problem is.

I suspect some device memory must be preserved by OS,
after all, the GPU device is also a graphic controller

The problem is that I have 4 float*. Each one is copyed on the device memory.
The total size is less than memory avaible :

N = 38400
D = 96
M = …

The memory computation is ((ND+MD+M+N*M)*4)/1000000 Mo

for M = 2048, the total memory is 330Mo,
for M = 2304, the total memory is 370Mo.

I don’t understand why it doesn’t work.
I am sure that my code works because I’ve tested it with different values.
My question is : Do I have access to the 768Mo of my graphic card?

There is a framebuffer and such, but you should have access to at least 600MB. You can call cuGetMemInfo (IIRC) to find out for sure. What OS/windowing system are you running? If it is a compositing window manager in X windows, the framebuffer usage for all those fancy window effects will jump up considerably.

Actually, the problem is that the memory allocated is bigger than the free memory… I’ve forgotten to take into account the pitch… My bad!
Thanks for cuGetMemInfo(). Very usefull command ;)

I am wondering if anybody can tell me how to use the cuGetMemInfo (IIRC). I try to call cuGetMemInfo (IIRC) or cuGetMemInfo () from my file, but got “identifier “cuGetMemInfo” is undefined” error message. many thanks!

#include <cuda.h> ?? Is a runtime call. cuda.lib must be specified as library dependency to avoid problems in linking phase.

For all of you that want to use cuGetMemInfo(), it is cuMemGetInfo()

Heh, my bad. In my defense, I did say “IIRC” after mentioning it the first time because I didn’t know the exact method name. This goes to show how many people don’t look things up in the programming guide ;)