You can try to use the program below, it uses cudaMalloc to allocate some memory which should then be no longer available for your game.
The program below accepts a single arguments, the amount of megabytes you would like to allocate on the GPU. If you specify no amount, 256MB is used as a default. Save it in a text file called gpumem.cu.
#include <stdio.h>
int main(int argc, char *argv[])
{
unsigned long long mem_size = 0;
void *gpu_mem = NULL;
cudaError_t err;
// get amount of memory to allocate in MB, default to 256
if(argc < 2 || sscanf(argv[1], " %llu", &mem_size) != 1) {
mem_size = 256;
}
mem_size *= 1024*1024;; // convert MB to bytes
// allocate GPU memory
err = cudaMalloc(&gpu_mem, mem_size);
if(err != cudaSuccess) {
printf("Error, could not allocate %llu bytes.\n", mem_size);
return 1;
}
// wait for a key press
printf("Press return to exit...\n");
getchar();
// free GPU memory and exit
cudaFree(gpu_mem);
return 0;
}
You will have to compile it yourself using nvcc (downloadable for Windows, Mac and Linux as the CUDA toolkit from the Nvidia website). Use the following command line to compile the program:
nvcc gpumem.cu -o gpumem
Execute the program by calling on the commandline: (allocates 1000MB in this example)
./gpumem 1000
Use the nvidia-smi tool (comes with the Nvidia) to verify how much GPU memory is available.