Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions source/module_base/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ int Memory::short_memory = sizeof(short); // 2.0 Byte

int Memory::n_memory = 1000;
int Memory::n_now = 0;
bool Memory::init_flag = false;
bool Memory::init_flag = false;

#if defined(__CUDA) || defined(__ROCM)

Expand Down Expand Up @@ -365,18 +365,15 @@ void Memory::finish(std::ofstream &ofs)
delete[] name_gpu;
delete[] class_name_gpu;
delete[] consume_gpu;
init_flag_gpu = false;
}
#endif
return;
}

void Memory::print_all(std::ofstream &ofs)
{
if(!init_flag
#if defined(__CUDA) || defined(__ROCM)
&& !init_flag_gpu
#endif
)
if(!init_flag)
{
return;
}
Expand Down Expand Up @@ -437,6 +434,11 @@ void Memory::print_all(std::ofstream &ofs)
}

#if defined(__CUDA) || defined(__ROCM)
if(!init_flag_gpu)
{
return;
}

ofs <<"\n NAME-------------------------|GPU MEMORY(MB)----" << std::endl;
ofs <<std::setw(30)<< "total" << std::setw(15) <<std::setprecision(4)<< Memory::total_gpu << std::endl;

Expand Down
Loading