Dear CS10-Gitlab-users, on Thursday, Feb 3 there will be maintenance. That will lead to a downtime of the CS10-Gitlab-service including Subversion and Mattermost chat from 09:30. This might take the whole day since we don't know how long it is going to take. We are sorry for the inconvenience! Best regards, CS10-Admin-Team

Commit 69d9606c authored by Christian Godenschwager's avatar Christian Godenschwager
Browse files

Enhanced lbm::PerformanceLogger

- can now use the current time step of an ITimeloop object as reference
- can now export data to SQLite databases
- added option to refresh cell counters on each call
parent c37d7827
......@@ -33,6 +33,8 @@
#include "field/FlagUID.h"
#include "timeloop/ITimeloop.h"
#include <limits>
namespace walberla {
......@@ -57,9 +59,23 @@ public:
const Set<SUID> & requiredSelectors = Set<SUID>::emptySet(),
const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() );
PerformanceLogger( const shared_ptr< StructuredBlockStorage > & blocks,
const ConstBlockDataID & flagFieldId, const Set< FlagUID > & fluid,
const timeloop::ITimeloop * const timeloop,
const uint_t interval,
const Set<SUID> & requiredSelectors = Set<SUID>::emptySet(),
const Set<SUID> & incompatibleSelectors = Set<SUID>::emptySet() );
void operator()();
void logOverallResultsOnRoot() const;
void enableRefreshCellCountOnCall() { refreshCellCountOnCall_ = true; }
void disableRefreshCellCountOnCall() { refreshCellCountOnCall_ = false; }
void getBestResultsForSQLOnRoot( std::map< std::string, int > & integerProperties,
std::map< std::string, double > & realProperties,
std::map< std::string, std::string > & stringProperties );
private:
enum Mode { MIN, MAX, AVG, LAST };
real_t getTiming( Mode mode ) const;
......@@ -68,6 +84,8 @@ private:
uint_t interval_;
uint_t timestep_;
WcTimer timer_;
bool refreshCellCountOnCall_;
const timeloop::ITimeloop * timeloop_;
}; // class PerformanceLogger
......@@ -79,7 +97,19 @@ PerformanceLogger<FlagField_T>::PerformanceLogger( const shared_ptr< StructuredB
const Set<SUID> & requiredSelectors /*= Set<SUID>::emptySet()*/,
const Set<SUID> & incompatibleSelectors /*= Set<SUID>::emptySet()*/ )
: performanceEvaluation_( blocks, flagFieldId, fluid, requiredSelectors, incompatibleSelectors ),
interval_(interval), timestep_(1)
interval_(interval), timestep_(1), refreshCellCountOnCall_(false), timeloop_(NULL)
{
}
template< typename FlagField_T >
PerformanceLogger<FlagField_T>::PerformanceLogger( const shared_ptr< StructuredBlockStorage > & blocks,
const ConstBlockDataID & flagFieldId, const Set< FlagUID > & fluid,
const timeloop::ITimeloop * const timeloop,
const uint_t interval,
const Set<SUID> & requiredSelectors /*= Set<SUID>::emptySet()*/,
const Set<SUID> & incompatibleSelectors /*= Set<SUID>::emptySet()*/ )
: performanceEvaluation_( blocks, flagFieldId, fluid, requiredSelectors, incompatibleSelectors ),
interval_( interval ), timestep_( 1 ), refreshCellCountOnCall_( false ), timeloop_( timeloop )
{
}
......@@ -106,13 +136,19 @@ real_t PerformanceLogger<FlagField_T>::getTiming( Mode mode ) const
template< typename FlagField_T >
void PerformanceLogger<FlagField_T>::operator()()
{
if( timestep_ == interval_ )
if( timeloop_ )
timestep_ = timeloop_->getCurrentTimeStep() + uint_t(1);
if( timestep_ % interval_ == 0 )
{
WALBERLA_MPI_BARRIER();
timer_.end();
if( refreshCellCountOnCall_ )
performanceEvaluation_.refresh();
performanceEvaluation_.logResultOnRoot( interval_, getTiming( LAST ) );
timer_.start();
timestep_ = 0;
}
++timestep_;
......@@ -126,6 +162,14 @@ void PerformanceLogger<FlagField_T>::logOverallResultsOnRoot() const
WALBERLA_LOG_RESULT_ON_ROOT( "Avg Performance:\n" << performanceEvaluation_.loggingString( interval_, getTiming( AVG ) ); );
}
template< typename FlagField_T >
void PerformanceLogger<FlagField_T>::getBestResultsForSQLOnRoot( std::map< std::string, int > & integerProperties,
std::map< std::string, double > & realProperties,
std::map< std::string, std::string > & stringProperties )
{
performanceEvaluation_.getResultsForSQLOnRoot( integerProperties, realProperties, stringProperties, interval_, getTiming( MAX ) );
}
} // namespace lbm
} // namespace walberla
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment