* @brief Returns the currently used memory, or 0 if LBANN was not compiled with * GPU support. */
| 47 | * GPU support. |
| 48 | */ |
| 49 | size_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 |
no outgoing calls
no test coverage detected