diff --git a/main.cu b/main.cu index 9a2f787..92b8891 100644 --- a/main.cu +++ b/main.cu @@ -1,16 +1,13 @@ -#include - -int main() -{ - int run_version, driver_version; - std::cout<< "Return Code Runtime Version: "; - std::cout< +#include "cuda.h" +extern "C" +void checkGpuMem() { + float free_m, total_m, used_m; + size_t free_t,total_t; + cudaMemGetInfo(&free_t,&total_t); + free_m =(uint)free_t/1048576.0 ; + total_m=(uint)total_t/1048576.0; + used_m=total_m-free_m; + printf("GPU memory usage: used = %f, free = %f MB, total = %f MB\n",used_m,free_m,total_m); +} \ No newline at end of file