How to find out how much global memory is under consumption on the GPU. I know I can count bytes by enclosing cudaMalloc in another function but is there any other way to find out ?
unsigned int free_mem,total_mem, used_mem;
cuMemGetInfo( &free_mem, &total_mem );
used_mem = total_mem-free_mem;
printf("total mem: %0.3f MB, free: %0.3f MB, used : %0.3f MB\n",
((double)total_mem)/1024.0/1024.0,
((double)free_mem )/1024.0/1024.0,
((double)used_mem )/1024.0/1024.0 );
you need to link with cuda.lib