Commit 7c3b196a authored by Bram Veenboer's avatar Bram Veenboer

Add print_device_memory_info method to InstanceCUDA

parent be82256b
......@@ -1211,6 +1211,19 @@ namespace idg {
dtohstream.reset(new cu::Stream());
}
void InstanceCUDA::print_device_memory_info() {
#if defined(DEBUG)
std::cout << "InstanceCUDA::" << __func__ << std::endl;
#endif
auto memory_total = device->get_total_memory() / ((float) 1024*1024*1024); // GBytes
auto memory_free = device->get_free_memory() / ((float) 1024*1024*1024); // GBytes
auto memory_used = memory_total - memory_free;
std::clog << "Device memory -> ";
std::clog << "total: " << memory_total << " Gb, ";
std::clog << "used: " << memory_used << " Gb, ";
std::clog << "free: " << memory_free << " Gb" << std::endl;
}
} // end namespace cuda
} // end namespace kernel
} // end namespace idg
......@@ -275,6 +275,7 @@ namespace idg {
void free_fft_plans();
void reset();
int get_tile_size_grid() const { return tile_size_grid; };
void print_device_memory_info();
protected:
cu::Module* compile_kernel(std::string& flags, std::string& src, std::string& bin);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment