What happens when the GPU memory is not enough?

12,532

Solution 1

Modern GPUs will run a hybrid mode where the drivers/GPU start streaming texture data from system RAM over the PCIe bus to make up for the "missing" RAM. Since system RAM is 3-5X slower than GDDR5 with much higher latency, running out of "VRAM" would translate into a slower application and significant FPS loss.

However, the performance will be limited by the PCIe bandwitdh (6 GB/s).

When programming with the CUDA toolkit (v2.2+), this is known as zero-copy.

Here is the code for it, for anyone who is curious how it works.

float *a_h, *a_map;
cudaGetDeviceProperties(&prop, 0); 
if (!prop.canMapHostMemory) 
    exit(0); 
cudaSetDeviceFlags(cudaDeviceMapHost);
cudaHostAlloc(&a_h, nBytes, cudaHostAllocMapped);
cudaHostGetDevicePointer(&a_map, a_h, 0);
kernel<<<gridSize, blockSize>>>(a_map);

Read more at: http://docs.nvidia.com/cuda/cuda-c-best-practices-guide/index.html#ixzz3nEbijjQZ

Solution 2

What will happen when I run the program?

It will use 100% of the VRAM available to your system. It either will work without problems because it was implemented to use your system memory also or because you don't have enough VRAM it could behave in unexpected ways.

Does the application take the memory from RAM?

If the application requires 2GB of VRAM then having more system memory won't really help unless the application was designed to do so.

How does it handle the insufficient video memory?

This is entirely up to the implementation the author of the application chooses to implement.

Share:
12,532

Related videos on Youtube

rcs
Author by

rcs

Updated on September 18, 2022

Comments

  • rcs
    rcs over 1 year

    Let say I have a GPU with memory of 1GB, but my application requires 2GB of video card memory, what will happen when I run the program? Does the application take the memory from RAM? How does it handle the insufficient video memory?

    For some reason, I am still able to run the application, and noticed that the process system.exe takes quite a lot of memory (~800 MB), not sure whether this is related to the insufficient video memory or there is other issue.

    • Admin
      Admin over 8 years
      I answer the three questions I could. Your last question is unanswerable without more information.
  • DrZoo
    DrZoo over 8 years
    Many modern GPU's run in hybrid mode, and are allowed to access the host memory if the GPU runs out of VRAM.