MaMiCo 1.2
Loading...
Searching...
No Matches
coupling::MultiMDMediator< LinkedCell, dim > Class Template Reference

Class to handle interaction between MultiMDCellService and InstanceHandling This is currently mainly used for activating/deactivating and addtion/removal of md simulations. Works and interacts with the class coupling::InstanceHandling closely. More...

#include <MultiMDMediator.h>

Public Member Functions

 MultiMDMediator (coupling::services::MultiMDCellService< LinkedCell, dim > &multiMDCellService, coupling::InstanceHandling< LinkedCell, dim > &instanceHandling, tarch::utils::MultiMDService< dim > &multiMDService, coupling::interface::MacroscopicSolverInterface< dim > *macroscopicSolverInterface)
 
void addMDSimulation ()
 
void addMDSimulation (const unsigned int &communicator)
 
void addNMDSimulations (const unsigned int &N)
 
void addNMDSimulations (const unsigned int &communicator, const unsigned int &N)
 
void rmMDSimulation ()
 
void rmMDSimulation (const unsigned int &communicator, const unsigned int &index)
 
void rmMDSimulation (const unsigned int &communicator)
 
void rmNMDSimulations (const unsigned int &N)
 
void shutdownCommunicator (const unsigned int &communicator)
 
unsigned int getNumberOfActiveMDSimulations (const unsigned int communicator)
 
unsigned int getNumberOfActiveMDSimulations ()
 

Private Member Functions

void addMDSimulationBlock ()
 
void rmMDSimulationBlock ()
 
unsigned int getAvgNumberOfActiveMDSimulations ()
 
unsigned int findFirstCommWithLowLoad ()
 
unsigned int findFirstCommWithHighLoad ()
 
unsigned int findInactiveLocalIndex (const unsigned int &communicator)
 
unsigned int findActiveLocalIndex (const unsigned int &communicator)
 

Private Attributes

coupling::services::MultiMDCellService< LinkedCell, dim > & _multiMDCellService
 
coupling::InstanceHandling< LinkedCell, dim > & _instanceHandling
 
tarch::utils::MultiMDService< dim > & _multiMDService
 
std::vector< std::vector< bool > > _listActiveMDSimulations
 
coupling::interface::MacroscopicSolverInterface< dim > * _macroscopicSolverInterface
 

Detailed Description

template<class LinkedCell, unsigned int dim>
class coupling::MultiMDMediator< LinkedCell, dim >

Class to handle interaction between MultiMDCellService and InstanceHandling This is currently mainly used for activating/deactivating and addtion/removal of md simulations. Works and interacts with the class coupling::InstanceHandling closely.

Template Parameters
LinkedCelltype of the cell
dimNumber of dimensions; it can be 1, 2 or 3
See also
see also coupling::InstanceHandling
Author
Niklas Wittmer

Member Function Documentation

◆ addMDSimulation() [1/2]

template<class LinkedCell, unsigned int dim>
void coupling::MultiMDMediator< LinkedCell, dim >::addMDSimulation ( )

Autmatically add one MDSimulation trying to keep the number of MD simulation across communicators balanced by computing the average number of active simulations on communicators.

◆ addMDSimulation() [2/2]

template<class LinkedCell, unsigned int dim>
void coupling::MultiMDMediator< LinkedCell, dim >::addMDSimulation ( const unsigned int & communicator)

Add one MD simulation on specified communicator.

Parameters
communicator

◆ addMDSimulationBlock()

template<class LinkedCell, unsigned int dim>
void coupling::MultiMDMediator< LinkedCell, dim >::addMDSimulationBlock ( )
private

Add one block of free simulations which is evenly sliced over communicator groups.

◆ addNMDSimulations() [1/2]

template<class LinkedCell, unsigned int dim>
void coupling::MultiMDMediator< LinkedCell, dim >::addNMDSimulations ( const unsigned int & communicator,
const unsigned int & N )

ADD n MD Simulations to specified communicator

Parameters
communicator
Nnumber of new MD

◆ addNMDSimulations() [2/2]

template<class LinkedCell, unsigned int dim>
void coupling::MultiMDMediator< LinkedCell, dim >::addNMDSimulations ( const unsigned int & N)

Add n MD simulations

Parameters
Nnumber of new MD

◆ findActiveLocalIndex()

template<class LinkedCell, unsigned int dim>
unsigned int coupling::MultiMDMediator< LinkedCell, dim >::findActiveLocalIndex ( const unsigned int & communicator)
private

On a given communicator find a local index of an inactive md simulation

Parameters
communicator
Returns
local index of an inactive md simulation

◆ findFirstCommWithHighLoad()

template<class LinkedCell, unsigned int dim>
unsigned int coupling::MultiMDMediator< LinkedCell, dim >::findFirstCommWithHighLoad ( )
private

Try to find a communicator that has a relatively high number of active MD simulations. The average ov this communicator should should have an average or higher-than-average number of active simulations. This method begins lookup at the first communicator.

Returns
communicator with a relatively high number of active MD simulations

◆ findFirstCommWithLowLoad()

template<class LinkedCell, unsigned int dim>
unsigned int coupling::MultiMDMediator< LinkedCell, dim >::findFirstCommWithLowLoad ( )
private

Try to find a communicator that has a relatively low number of active MD simulations. This will be a communicator having an average or below-average number of active simulations. This method starts searching at the last communicator.

Returns
communicator with a relatively low number of active MD simulations

◆ findInactiveLocalIndex()

template<class LinkedCell, unsigned int dim>
unsigned int coupling::MultiMDMediator< LinkedCell, dim >::findInactiveLocalIndex ( const unsigned int & communicator)
private

On given communicator find an inactive index

Parameters
communicator
Returns
inactive index

◆ getAvgNumberOfActiveMDSimulations()

template<class LinkedCell, unsigned int dim>
unsigned int coupling::MultiMDMediator< LinkedCell, dim >::getAvgNumberOfActiveMDSimulations ( )
private

Get the average number of active simulations running on the communicator groups. The result will be correctly rounded to the nearest integer.

Returns
average number of active simulations

◆ getNumberOfActiveMDSimulations() [1/2]

template<class LinkedCell, unsigned int dim>
unsigned int coupling::MultiMDMediator< LinkedCell, dim >::getNumberOfActiveMDSimulations ( )

Find global number of active simulations

Returns
total number of active simulation

◆ getNumberOfActiveMDSimulations() [2/2]

template<class LinkedCell, unsigned int dim>
unsigned int coupling::MultiMDMediator< LinkedCell, dim >::getNumberOfActiveMDSimulations ( const unsigned int communicator)

Find number of active simulations local to communicator

Parameters
communicator
Returns
number of active simulations local to communicator

◆ rmMDSimulation() [1/3]

template<class LinkedCell, unsigned int dim>
void coupling::MultiMDMediator< LinkedCell, dim >::rmMDSimulation ( )

Automatically remove one MD simulation trying to keep the number of MD simulations across communicator balanced.

◆ rmMDSimulation() [2/3]

template<class LinkedCell, unsigned int dim>
void coupling::MultiMDMediator< LinkedCell, dim >::rmMDSimulation ( const unsigned int & communicator)

Remove MD Simulation on specific communicator

Parameters
communicator

◆ rmMDSimulation() [3/3]

template<class LinkedCell, unsigned int dim>
void coupling::MultiMDMediator< LinkedCell, dim >::rmMDSimulation ( const unsigned int & communicator,
const unsigned int & index )

Remove MD simulation with specified global identifier.

Parameters
communicator
indexglobal identifier
Todo
How to handle removal of empty places?

◆ rmMDSimulationBlock()

template<class LinkedCell, unsigned int dim>
void coupling::MultiMDMediator< LinkedCell, dim >::rmMDSimulationBlock ( )
private

Remove one sliced block of simulations if all of them are freed.

◆ rmNMDSimulations()

template<class LinkedCell, unsigned int dim>
void coupling::MultiMDMediator< LinkedCell, dim >::rmNMDSimulations ( const unsigned int & N)

Remove N MD Simulations

Parameters
Nnumber of new MD

◆ shutdownCommunicator()

template<class LinkedCell, unsigned int dim>
void coupling::MultiMDMediator< LinkedCell, dim >::shutdownCommunicator ( const unsigned int & communicator)

Remove ALL simulations on a communicator.

Parameters
communicator

The documentation for this class was generated from the following file: