MCPcopy Create free account
hub / github.com/SeisSol/SeisSol / reportDeviceMemoryStatus

Function reportDeviceMemoryStatus

src/Initializer/InitProcedure/Init.cpp:25–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23namespace {
24
25void reportDeviceMemoryStatus() {
26#ifdef ACL_DEVICE
27 device::DeviceInstance& device = device::DeviceInstance::getInstance();
28 const auto rank = seissol::MPI::mpi.rank();
29 if (device.api->getCurrentlyOccupiedMem() > device.api->getMaxAvailableMem()) {
30 std::stringstream stream;
31
32 stream << "Memory of device (" << rank << ") is overloaded." << std::endl
33 << "Totally allocated device memory: "
34 << UnitByte.formatPrefix(device.api->getCurrentlyOccupiedMem()) << std::endl
35 << "Allocated unified memory: "
36 << UnitByte.formatPrefix(device.api->getCurrentlyOccupiedUnifiedMem()) << std::endl
37 << "Memory capacity of device: "
38 << UnitByte.formatPrefix(device.api->getMaxAvailableMem());
39
40 logError() << stream.str();
41 } else {
42 const double fraction = device.api->getCurrentlyOccupiedMem() /
43 static_cast<double>(device.api->getMaxAvailableMem());
44 const auto summary = seissol::statistics::parallelSummary(fraction * 100.0);
45 logInfo(rank) << "occupied memory on devices (%):"
46 << " mean =" << summary.mean << " std =" << summary.std << " min =" << summary.min
47 << " median =" << summary.median << " max =" << summary.max;
48 }
49#endif
50}
51
52void initSeisSol(seissol::SeisSol& seissolInstance) {
53 const auto& seissolParams = seissolInstance.getSeisSolParameters();

Callers 1

Calls 2

rankMethod · 0.80
formatPrefixMethod · 0.80

Tested by

no test coverage detected