-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Umpire logs refactor - table output + adding percentages (#3052)
- Loading branch information
Showing
4 changed files
with
214 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ set( common_headers | |
Format.hpp | ||
GEOS_RAJA_Interface.hpp | ||
GeosxMacros.hpp | ||
MemoryInfos.hpp | ||
Logger.hpp | ||
MpiWrapper.hpp | ||
Path.hpp | ||
|
@@ -40,6 +41,7 @@ endif( ) | |
set( common_sources | ||
BufferAllocator.cpp | ||
DataTypes.cpp | ||
MemoryInfos.cpp | ||
Logger.cpp | ||
MpiWrapper.cpp | ||
Path.cpp | ||
|
@@ -93,6 +95,8 @@ if( ENABLE_CALIPER ) | |
endif() | ||
endif() | ||
|
||
set( dependencyList ${dependencyList} fileIO codingUtilities ) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
MelReyCG
Contributor
|
||
|
||
blt_add_library( NAME common | ||
SOURCES ${common_sources} | ||
HEADERS ${common_headers} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* ------------------------------------------------------------------------------------------------------------ | ||
* SPDX-LiCense-Identifier: LGPL-2.1-only | ||
* | ||
* Copyright (c) 2018-2020 Lawrence Livermore National Security LLC | ||
* Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University | ||
* Copyright (c) 2018-2020 TotalEnergies | ||
* Copyright (c) 2019- GEOSX Contributors | ||
* All rights reserved | ||
* | ||
* See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. | ||
* ------------------------------------------------------------------------------------------------------------ | ||
*/ | ||
|
||
#include "MemoryInfos.hpp" | ||
|
||
namespace geos | ||
{ | ||
MemoryInfos::MemoryInfos( umpire::MemoryResourceTraits::resource_type resourceType ): | ||
m_totalMemory( 0 ), | ||
m_availableMemory( 0 ), | ||
m_physicalMemoryHandled( 1 ) | ||
{ | ||
switch( resourceType ) | ||
{ | ||
case umpire::MemoryResourceTraits::resource_type::host: | ||
case umpire::MemoryResourceTraits::resource_type::pinned: | ||
#if defined( _SC_PHYS_PAGES ) && defined( _SC_PAGESIZE ) | ||
m_totalMemory = sysconf( _SC_PHYS_PAGES ) * sysconf( _SC_PAGESIZE ); | ||
m_availableMemory = sysconf( _SC_AVPHYS_PAGES ) * sysconf( _SC_PAGESIZE ); | ||
#else | ||
GEOS_WARNING( "Unknown device physical memory size getter for this compiler." ); | ||
m_physicalMemoryHandled = 0; | ||
#endif | ||
break; | ||
case umpire::MemoryResourceTraits::resource_type::device: | ||
case umpire::MemoryResourceTraits::resource_type::device_const: | ||
case umpire::MemoryResourceTraits::resource_type::um: | ||
#if defined( GEOS_USE_CUDA ) | ||
cudaMemGetInfo( &m_availableMemory, &m_totalMemory ); | ||
#else | ||
GEOS_WARNING( "Unknown device physical memory size getter for this compiler." ); | ||
m_physicalMemoryHandled = 0; | ||
#endif | ||
break; | ||
default: | ||
GEOS_WARNING( "Physical memory lookup not implemented" ); | ||
m_physicalMemoryHandled = 0; | ||
break; | ||
} | ||
} | ||
|
||
size_t MemoryInfos::getTotalMemory() const | ||
{ | ||
return m_totalMemory; | ||
} | ||
|
||
size_t MemoryInfos::getAvailableMemory() const | ||
{ | ||
return m_availableMemory; | ||
} | ||
|
||
bool MemoryInfos::isPhysicalMemoryHandled() const | ||
{ | ||
return m_physicalMemoryHandled; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* ------------------------------------------------------------------------------------------------------------ | ||
* SPDX-LiCense-Identifier: LGPL-2.1-only | ||
* | ||
* Copyright (c) 2018-2020 Lawrence Livermore National Security LLC | ||
* Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University | ||
* Copyright (c) 2018-2020 TotalEnergies | ||
* Copyright (c) 2019- GEOSX Contributors | ||
* All rights reserved | ||
* | ||
* See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details. | ||
* ------------------------------------------------------------------------------------------------------------ | ||
*/ | ||
|
||
#ifndef GEOS_COMMON_MemoryInfos_HPP_ | ||
#define GEOS_COMMON_MemoryInfos_HPP_ | ||
|
||
#include "umpire/util/MemoryResourceTraits.hpp" | ||
#include "common/Logger.hpp" | ||
#include <unistd.h> | ||
#include <iostream> | ||
#if defined( GEOS_USE_CUDA ) | ||
#include <cuda.h> | ||
#endif | ||
|
||
namespace geos | ||
{ | ||
|
||
/** | ||
* @class MemoryInfos | ||
* @brief Class to fetch and store memory information for different resource types. | ||
*/ | ||
class MemoryInfos | ||
{ | ||
public: | ||
|
||
/** | ||
* @brief Constructor for MemoryInfos. | ||
* @param resourceType The type of memory resource. | ||
*/ | ||
MemoryInfos( umpire::MemoryResourceTraits::resource_type resourceType ); | ||
|
||
/** | ||
* @brief Get the total memory available for the resource type. | ||
* @return Total memory in bytes. | ||
*/ | ||
size_t getTotalMemory() const; | ||
|
||
/** | ||
* @brief Get the available memory for the resource type. | ||
* @return Available memory in bytes. | ||
*/ | ||
size_t getAvailableMemory() const; | ||
|
||
/** | ||
* @brief Check if physical memory is handled. | ||
* @return True if physical memory is handled, false otherwise. | ||
*/ | ||
bool isPhysicalMemoryHandled() const; | ||
private: | ||
|
||
///total memory available. | ||
size_t m_totalMemory; | ||
///Available memory. | ||
size_t m_availableMemory; | ||
///Flag indicating if physical memory is handled. | ||
bool m_physicalMemoryHandled; | ||
}; | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@arng40 @MelReyCG
I didn't catch it at the time, but this is a pretty substantial circular dependency with both of these components. I think
common
shouldn't have a dependency on anything inside of geos.