updated main
This commit is contained in:
parent
436005cef5
commit
349ec669ad
1 changed files with 10 additions and 15 deletions
21
main.cu
21
main.cu
|
|
@ -1,18 +1,13 @@
|
||||||
#include <stdio.h>
|
#include <unistd.h>
|
||||||
#include "cuda.h"
|
#include <iostream>
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(){
|
int main(){
|
||||||
checkGpuMem();
|
|
||||||
|
size_t mf, ma;
|
||||||
|
cudaMemGetInfo(&mf, &ma);
|
||||||
|
std::cout << "Free memory (gb): " << mf/1024/1024/1024 << std::endl;
|
||||||
|
std::cout << "Total memory (gb): " << ma/1024/1024/1024 << std::endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue