updated main
This commit is contained in:
parent
436005cef5
commit
349ec669ad
1 changed files with 10 additions and 15 deletions
23
main.cu
23
main.cu
|
|
@ -1,18 +1,13 @@
|
|||
#include <stdio.h>
|
||||
#include "cuda.h"
|
||||
extern "C"
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
|
||||
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() {
|
||||
checkGpuMem();
|
||||
int main(){
|
||||
|
||||
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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue