GEOS
MemoryInfos.hpp
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2024 Total, S.A
7  * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8  * Copyright (c) 2023-2024 Chevron
9  * Copyright (c) 2019- GEOS/GEOSX Contributors
10  * All rights reserved
11  *
12  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13  * ------------------------------------------------------------------------------------------------------------
14  */
15 
16 #ifndef GEOS_COMMON_MemoryInfos_HPP_
17 #define GEOS_COMMON_MemoryInfos_HPP_
18 
19 #include "umpire/util/MemoryResourceTraits.hpp"
20 #include "common/logger/Logger.hpp"
21 #include <unistd.h>
22 #include <iostream>
23 #if defined( GEOS_USE_CUDA )
24 #include <cuda.h>
25 #endif
26 
27 namespace geos
28 {
29 
35 {
36 public:
37 
42  MemoryInfos( umpire::MemoryResourceTraits::resource_type resourceType );
43 
48  size_t getTotalMemory() const;
49 
54  size_t getAvailableMemory() const;
55 
61 private:
62 
64  size_t m_totalMemory;
66  size_t m_availableMemory;
68  bool m_physicalMemoryHandled;
69 };
70 
71 }
72 
73 #endif
Class to fetch and store memory information for different resource types.
Definition: MemoryInfos.hpp:35
MemoryInfos(umpire::MemoryResourceTraits::resource_type resourceType)
Constructor for MemoryInfos.
size_t getAvailableMemory() const
Get the available memory for the resource type.
bool isPhysicalMemoryHandled() const
Check if physical memory is handled.
size_t getTotalMemory() const
Get the total memory available for the resource type.