File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ int Memory::short_memory = sizeof(short); // 2.0 Byte
2323
2424int Memory::n_memory = 1000 ;
2525int Memory::n_now = 0 ;
26- bool Memory::init_flag = false ;
26+ bool Memory::init_flag = false ;
2727
2828#if defined(__CUDA) || defined(__ROCM)
2929
@@ -365,18 +365,15 @@ void Memory::finish(std::ofstream &ofs)
365365 delete[] name_gpu;
366366 delete[] class_name_gpu;
367367 delete[] consume_gpu;
368+ init_flag_gpu = false ;
368369 }
369370#endif
370371 return ;
371372}
372373
373374void Memory::print_all (std::ofstream &ofs)
374375{
375- if (!init_flag
376- #if defined(__CUDA) || defined(__ROCM)
377- && !init_flag_gpu
378- #endif
379- )
376+ if (!init_flag)
380377 {
381378 return ;
382379 }
@@ -437,6 +434,11 @@ void Memory::print_all(std::ofstream &ofs)
437434 }
438435
439436#if defined(__CUDA) || defined(__ROCM)
437+ if (!init_flag_gpu)
438+ {
439+ return ;
440+ }
441+
440442 ofs <<" \n NAME-------------------------|GPU MEMORY(MB)----" << std::endl;
441443 ofs <<std::setw (30 )<< " total" << std::setw (15 ) <<std::setprecision (4 )<< Memory::total_gpu << std::endl;
442444
You can’t perform that action at this time.
0 commit comments