Skip to content

Commit 9bff888

Browse files
authored
Merge pull request #58 from rfhaque/master
Add umpire memory usage to caliper
2 parents 636e7f8 + 2dd8236 commit 9bff888

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

remhos.cpp

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,15 @@
5050

5151
#if (defined(HYPRE_USING_UMPIRE) || defined(MFEM_USE_UMPIRE)) && (defined(MFEM_USE_CUDA) || defined(MFEM_USE_HIP))
5252
#define REMHOS_USE_DEVICE_UMPIRE
53+
#define REMHOS_DEVICE_ALLOCATOR_NAME "REMHOS_DEVICE_POOL"
5354
#include <umpire/Umpire.hpp>
5455
#include <umpire/strategy/QuickPool.hpp>
56+
57+
double getDeviceMemoryHighWatermark() {
58+
auto &rm = umpire::ResourceManager::getInstance();
59+
auto allocator = rm.getAllocator(REMHOS_DEVICE_ALLOCATOR_NAME);
60+
return ((double) allocator.getHighWatermark()) / (1024 * 1024 * 1024);
61+
}
5562
#endif
5663

5764
#ifdef REMHOS_USE_CALIPER
@@ -334,10 +341,13 @@ MFEM_EXPORT int remhos(int argc, char *argv[], double &final_mass_u)
334341

335342
#ifdef REMHOS_USE_DEVICE_UMPIRE
336343
auto &rm = umpire::ResourceManager::getInstance();
337-
const char * allocator_name = "remhos_device_alloc";
344+
const char * allocator_name = REMHOS_DEVICE_ALLOCATOR_NAME;
338345
size_t umpire_dev_pool_size = ((size_t) dev_pool_size) * 1024 * 1024 * 1024;
339346
size_t umpire_dev_block_size = 1024 * 1024;
340-
rm.makeAllocator<umpire::strategy::QuickPool>(allocator_name, rm.getAllocator("DEVICE"), umpire_dev_pool_size, umpire_dev_block_size);
347+
rm.makeAllocator<umpire::strategy::QuickPool>(allocator_name,
348+
rm.getAllocator("DEVICE"),
349+
umpire_dev_pool_size,
350+
umpire_dev_block_size);
341351

342352
#ifdef HYPRE_USING_UMPIRE
343353
HYPRE_SetUmpireDevicePoolName(allocator_name);
@@ -1490,6 +1500,18 @@ MFEM_EXPORT int remhos(int argc, char *argv[], double &final_mass_u)
14901500
adiak::fini();
14911501
calimgr.flush();
14921502
#endif
1503+
1504+
#ifdef REMHOS_USE_DEVICE_UMPIRE
1505+
if (myid == 0)
1506+
{
1507+
cout << "Umpire device memory pool size: " << dev_pool_size << " GB" << endl;
1508+
cout << "Umpire device memory high water mark: " << getDeviceMemoryHighWatermark() << " GB" << endl;
1509+
#ifdef REMHOS_USE_CALIPER
1510+
adiak::value("umpire_device_pool_size", dev_pool_size);
1511+
adiak::value("umpire_device_high_water_mark", getDeviceMemoryHighWatermark());
1512+
#endif
1513+
}
1514+
#endif
14931515
return 0;
14941516
}
14951517

0 commit comments

Comments
 (0)