Allocation of 3D array of size 512 x 512 x 512 crashes program

If I try to allocate a 3D array of size 512 x 512 x 512 my program crashes. Such an array should use 512 MB of memory, and my GPU (GTX 690) has 2 GB of memory. What is the problem?

texture<float, 3, cudaReadModeElementType> tex_Volume;

VOLUME_SIZE = make_cudaExtent(DATA_W, DATA_H, DATA_D);
cudaMalloc3DArray(&d_Volume_Array, &floatTex, VOLUME_SIZE);

What are ‘floatTex’ and ‘d_Volume_Array’? Have You read the reference page for this routine?


Yes, the code works well up to approximately 400 x 400 x 400, I don’t see how I can run out of memory for 512 x 512 x 512.

cudaArray *d_Volume_Array;
floatTex = cudaCreateChannelDesc<float>();

Do You have any other heavy memory allocation in Your code? Asking just to certain…

The problem was not the allocation, but that my CUDA kernel took more than 2 seconds to run. Problem solved in this thread