MCPcopy Create free account
hub / github.com/LBANN/lbann / get_used_gpu_memory

Function get_used_gpu_memory

src/callbacks/memory_profiler.cpp:49–65  ·  view source on GitHub ↗

* @brief Returns the currently used memory, or 0 if LBANN was not compiled with * GPU support. */

Source from the content-addressed store, hash-verified

47 * GPU support.
48 */
49size_t get_used_gpu_memory()
50{
51#ifdef LBANN_HAS_GPU
52 size_t available;
53 size_t total;
54#ifdef LBANN_HAS_CUDA
55 FORCE_CHECK_CUDA(cudaMemGetInfo(&available, &total));
56#elif defined(LBANN_HAS_ROCM)
57 FORCE_CHECK_ROCM(hipMemGetInfo(&available, &total));
58#endif
59 // TODO(later): Might be nicer to return a struct with gathered information
60 // (min, max, median across ranks)
61 return total - available;
62#else
63 return 0;
64#endif
65}
66
67/**
68 * @brief Returns the total memory, or 0 if LBANN was not compiled with

Callers 10

print_progressFunction · 0.85
on_setup_beginMethod · 0.85
on_setup_endMethod · 0.85
first_step_accountingMethod · 0.85
on_batch_endMethod · 0.85
collect_peak_usageMethod · 0.85
on_forward_prop_beginMethod · 0.85
on_forward_prop_endMethod · 0.85
on_backward_prop_endMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected