| 1159 | namespace |
| 1160 | { |
| 1161 | size_t reportGpuMemory() |
| 1162 | { |
| 1163 | static size_t prevFree{0}; |
| 1164 | size_t free{0}; |
| 1165 | size_t total{0}; |
| 1166 | size_t newlyAllocated{0}; |
| 1167 | cudaCheck(cudaMemGetInfo(&free, &total)); |
| 1168 | sample::gLogInfo << "Free GPU memory = " << free / 1024.0_MiB << " GiB"; |
| 1169 | if (prevFree != 0) |
| 1170 | { |
| 1171 | newlyAllocated = (prevFree - free); |
| 1172 | sample::gLogInfo << ", newly allocated GPU memory = " << newlyAllocated / 1024.0_MiB << " GiB"; |
| 1173 | } |
| 1174 | sample::gLogInfo << ", total GPU memory = " << total / 1024.0_MiB << " GiB" << std::endl; |
| 1175 | prevFree = free; |
| 1176 | return newlyAllocated; |
| 1177 | } |
| 1178 | } // namespace |
| 1179 | |
| 1180 | //! Returns true if deserialization is slower than expected or fails. |
no test coverage detected