Skip to content

Commit

Permalink
Remove function memoryUsage and affiliates (#2456)
Browse files Browse the repository at this point in the history
### Remove
- all instances of `memoryUsage`
- all instances of `valuesMemoryUsage`
- Function `memoryUsageAveragePerArea`
- Function `PreproHydroMemoryUsage`
- xcast.hxx (becomes unused)
### Consequences
Remove two lines of logs
- General memory usage (see src/libs/antares/study/runtime/runtime.cpp)
- Memory usage for variables (see
src/solver/simulation/include/antares/solver/simulation/solver.hxx)
  • Loading branch information
flomnes authored Oct 11, 2024
1 parent c84c843 commit 7805562
Show file tree
Hide file tree
Showing 94 changed files with 0 additions and 721 deletions.
7 changes: 0 additions & 7 deletions src/libs/antares/array/include/antares/array/matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -415,13 +415,6 @@ class Matrix
*/
bool empty() const;

//! Get the amount of memory used by the matrix
uint64_t memoryUsage() const;

//! Get the amount of memory used by the matrix
uint64_t valuesMemoryUsage() const;
//@}

/*!
** \brief Print the matrix to std::cout (debug)
*/
Expand Down
13 changes: 0 additions & 13 deletions src/libs/antares/array/include/antares/array/matrix.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -528,19 +528,6 @@ inline bool Matrix<T, ReadWriteT>::empty() const
return (!width) or (!height);
}

template<class T, class ReadWriteT>
inline uint64_t Matrix<T, ReadWriteT>::memoryUsage() const
{
return sizeof(Matrix<T, ReadWriteT>) + (sizeof(T) * (width * height))
+ ((jit) ? jit->memoryUsage() : 0);
}

template<class T, class ReadWriteT>
inline uint64_t Matrix<T, ReadWriteT>::valuesMemoryUsage() const
{
return (sizeof(T) * (width * height));
}

template<class T, class ReadWriteT>
void Matrix<T, ReadWriteT>::clear()
{
Expand Down
17 changes: 0 additions & 17 deletions src/libs/antares/correlation/correlation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,23 +557,6 @@ void Correlation::set(Matrix<>& m, const Area& from, const Area& to, double v)
m[to.index][from.index] = v;
}

uint64_t Correlation::memoryUsage() const
{
uint64_t r = sizeof(Correlation);
if (!annual.empty())
{
r += annual.memoryUsage();
}
if (!monthly.empty())
{
for (uint i = 0; i != 12; ++i)
{
r += monthly[i].memoryUsage();
}
}
return r;
}

bool Correlation::forceReload(bool reload) const
{
bool ret = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,6 @@ class Correlation final
const AreaNameMapping& mapping,
const Study& study);

/*!
** \brief Get the amount of memory used the correlation matrices
*/
uint64_t memoryUsage() const;

/*!
** \brief Invalidate all matrices
*/
Expand Down
3 changes: 0 additions & 3 deletions src/libs/antares/jit/include/antares/jit/jit.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,6 @@ class JIT final
*/
void markAsModified();

//! Get the amount of memory currently used
uint64_t memoryUsage() const;

public:
//! Filename/folder to consider if some data should be loaded
YString sourceFilename;
Expand Down
5 changes: 0 additions & 5 deletions src/libs/antares/jit/include/antares/jit/jit.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ inline bool JIT::IsReady(JIT::Informations* j)
return (!j or j->alreadyLoaded);
}

inline uint64_t JIT::Informations::memoryUsage() const
{
return sizeof(JIT::Informations) + sourceFilename.capacity();
}

inline void JIT::Informations::markAsModified()
{
modified = true;
Expand Down
5 changes: 0 additions & 5 deletions src/libs/antares/memory/include/antares/memory/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ class Memory final: public Yuni::Policy::ObjectLevelLockable<Memory>
void cacheFolder(const AnyString& folder);
//@}

/*!
** \brief Get the amount of memory currently used
*/
uint64_t memoryUsage() const;

/*!
** \brief Get the process ID of the application
**
Expand Down
1 change: 0 additions & 1 deletion src/libs/antares/series/include/antares/series/series.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ class TimeSeries

bool forceReload(bool reload = false) const;
void markAsModified() const;
uint64_t memoryUsage() const;

TS timeSeries;
TimeSeriesNumbers& timeseriesNumbers;
Expand Down
4 changes: 0 additions & 4 deletions src/libs/antares/series/series.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,4 @@ void TimeSeries::markAsModified() const
timeSeries.markAsModified();
}

uint64_t TimeSeries::memoryUsage() const
{
return timeSeries.memoryUsage();
}
} // namespace Antares::Data
1 change: 0 additions & 1 deletion src/libs/antares/study/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ source_group("study\\constraint" FILES ${SRC_STUDY_BINDING_CONSTRAINT})
set(SRC_XCAST
include/antares/study/xcast.h
include/antares/study/xcast/xcast.h
include/antares/study/xcast/xcast.hxx
xcast/xcast.cpp
)
source_group("study\\xcast" FILES ${SRC_XCAST})
Expand Down
46 changes: 0 additions & 46 deletions src/libs/antares/study/area/area.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,52 +167,6 @@ const AreaLink* Area::findExistingLinkWith(const Area& with) const
return nullptr;
}

uint64_t Area::memoryUsage() const
{
uint64_t ret = 0;

// Misc gen. (previously called Fatal hors hydro)
ret += miscGen.valuesMemoryUsage();
// Reserves
ret += reserves.valuesMemoryUsage();

ret += sizeof(Area);
// Load
ret += load.memoryUsage();
// Solar
ret += solar.memoryUsage();
// Wind
ret += wind.memoryUsage();

// Hydro
ret += PreproHydroMemoryUsage(hydro.prepro.get());
if (hydro.series)
{
ret += hydro.series->memoryUsage();
}

// Thermal
ret += thermal.list.memoryUsage();

// Renewable
ret += renewable.list.memoryUsage();

// UI
if (ui)
{
ret += ui->memoryUsage();
}

// links
auto end = links.end();
for (auto i = links.begin(); i != end; ++i)
{
ret += (i->second)->memoryUsage();
}

return ret;
}

void Area::createMissingData()
{
createMissingTimeSeries();
Expand Down
10 changes: 0 additions & 10 deletions src/libs/antares/study/area/links.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -769,16 +769,6 @@ void AreaLinkRemove(AreaLink* link)
delete link;
}

uint64_t AreaLink::memoryUsage() const
{
uint64_t to_return = sizeof(AreaLink);
to_return += parameters.valuesMemoryUsage();
to_return += directCapacities.memoryUsage();
to_return += indirectCapacities.memoryUsage();

return to_return;
}

bool AreaLink::forceReload(bool reload) const
{
return parameters.forceReload(reload) && directCapacities.forceReload(reload)
Expand Down
7 changes: 0 additions & 7 deletions src/libs/antares/study/area/list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1394,13 +1394,6 @@ void AreaListEnsureDataThermalPrepro(AreaList* l)
l->each([](Data::Area& area) { area.thermal.list.ensureDataPrepro(); });
}

uint64_t AreaList::memoryUsage() const
{
uint64_t ret = sizeof(AreaList) + sizeof(Area**) * areas.size();
each([&ret](const Data::Area& area) { ret += area.memoryUsage(); });
return ret;
}

uint AreaList::areaLinkCount() const
{
uint ret = 0;
Expand Down
5 changes: 0 additions & 5 deletions src/libs/antares/study/area/ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,11 +363,6 @@ bool AreaUI::saveToFile(const AnyString& filename, bool force) const
return true;
}

uint64_t AreaUI::memoryUsage() const
{
return sizeof(AreaUI);
}

bool AreaUI::modified() const
{
return pModified;
Expand Down
17 changes: 0 additions & 17 deletions src/libs/antares/study/binding_constraint/BindingConstraint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,23 +506,6 @@ void BindingConstraint::buildFormula(Yuni::String& s) const
}
}

uint64_t BindingConstraint::memoryUsage() const
{
return sizeof(BindingConstraint)
// comments
+ pComments.capacity()
// Values
+ RHSTimeSeries().memoryUsage()
// Estimation
+ pLinkWeights.size() * (sizeof(double) + 3 * sizeof(void*))
// Estimation
+ pLinkOffsets.size() * (sizeof(int) + 3 * sizeof(void*))
// Estimation
+ pClusterWeights.size() * (sizeof(double) + 3 * sizeof(void*))
// Estimation
+ pClusterOffsets.size() * (sizeof(int) + 3 * sizeof(void*));
}

bool BindingConstraint::contains(const BindingConstraint* bc) const
{
return (this == bc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,16 +315,6 @@ void BindingConstraintsRepository::reverseWeightSign(const AreaLink* lnk)
each([&lnk](BindingConstraint& constraint) { constraint.reverseWeightSign(lnk); });
}

uint64_t BindingConstraintsRepository::memoryUsage() const
{
uint64_t m = sizeof(BindingConstraintsRepository);
for (const auto& i: constraints_)
{
m += i->memoryUsage();
}
return m;
}

namespace // anonymous
{
template<class T>
Expand Down
27 changes: 0 additions & 27 deletions src/libs/antares/study/include/antares/study/area/area.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,17 +188,6 @@ class Area final: private Yuni::NonCopyable<Area>
*/
void markAsModified() const;

/*!
** \brief Get the amount of memory currently used by the area
*/
uint64_t memoryUsage() const;

/*!
** \brief Try to estimate the amount of memory required by the area for a simulation
*/

//@}

//! \name Thermal clusters min stable power validity checking
//@{
/*!
Expand Down Expand Up @@ -656,22 +645,6 @@ class AreaList final: public Yuni::NonCopyable<AreaList>
/// create a map with the corresponding scratchpad for each area link to this numspace
Area::ScratchMap buildScratchMap(uint numspace);

//! \name Memory management
//@{
/*!
** \brief Try to estimate the amount of memory required by the class for a simulation
*/

/*!
** \brief Get the average amount of memory currently used by each area
*/
double memoryUsageAveragePerArea() const;

/*!
** \brief Get the amount of memory currently used by the class
*/
uint64_t memoryUsage() const;

/*!
** \brief Update the name id set
*/
Expand Down
7 changes: 0 additions & 7 deletions src/libs/antares/study/include/antares/study/area/links.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,6 @@ class AreaLink final: public Yuni::NonCopyable<AreaLink>
void markAsModified() const;
//@}

//! \name Memory management
//@{
/*!
** \brief Get the size (bytes) in memory occupied by a `AreaLink` structure
*/
uint64_t memoryUsage() const;

bool isVisibleOnLayer(const size_t& layerID) const;

Yuni::String getName() const;
Expand Down
5 changes: 0 additions & 5 deletions src/libs/antares/study/include/antares/study/area/ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,6 @@ class AreaUI final
*/
bool saveToFile(const AnyString& filename, bool force = false) const;

/*!
** \brief Amount of memory consummed by the instance
*/
uint64_t memoryUsage() const;

/*!
** \brief Get if the structure has been modified
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,14 +338,6 @@ class BindingConstraint final: public Yuni::NonCopyable<BindingConstraint>
*/
void markAsModified() const;

//! \name Memory Usage
//@{
/*!
** \brief Get the memory usage
*/
uint64_t memoryUsage() const;
//@}

/*!
** \brief Reverse the sign of the weight for a given interconnection or thermal cluster
**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,6 @@ class BindingConstraintsRepository final: public Yuni::NonCopyable<BindingConstr
*/
void changeConstraintsWeeklyToDaily();

/*!
** \brief Get the memory usage
*/
[[nodiscard]] uint64_t memoryUsage() const;

/*!
** \brief Invalidate all matrices of all binding constraints
*/
Expand Down
5 changes: 0 additions & 5 deletions src/libs/antares/study/include/antares/study/parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,6 @@ class Parameters final
*/
void fixGenRefreshForNTC();

/*!
** \brief Get the amount of memory used by the general data
*/
uint64_t memoryUsage() const;

/*!
** \brief Reset MC year weight to 1 for all years
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,6 @@ class Cluster
*/
virtual bool integrityCheck() = 0;

/*!
** \brief Get the memory consummed by the cluster (in bytes)
*/
virtual uint64_t memoryUsage() const = 0;
//@}

/*!
** \brief Invalidate all data associated to the cluster
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,6 @@ class ClusterList
*/
void markAsModified() const;

/*!
** \brief Get the size (bytes) occupied in memory by a `ClusterList` structure
** \return A size (in bytes)
*/
virtual uint64_t memoryUsage() const = 0;

/// \name IO functions
/// @{
bool loadDataSeriesFromFolder(Study& study, const std::filesystem::path& folder);
Expand Down
Loading

0 comments on commit 7805562

Please sign in to comment.