Skip to content
Snippets Groups Projects
Commit 1c2b2e1a authored by Benedikt Hegner's avatar Benedikt Hegner
Browse files

Merge branch 'dev/combSeq' into 'master'

Support for AthSequencers in Scheduler

See merge request !287
parents 6d9a4727 ce247b34
No related branches found
No related tags found
1 merge request!287Support for AthSequencers in Scheduler
Pipeline #
......@@ -15,7 +15,7 @@ endif()
# The list of sources to build into the library:
set( lib_sources src/lib/EventCounter.cpp
src/lib/GaudiSequencer.cpp src/lib/GaudiAlgorithm.cpp src/lib/GaudiTool.cpp
src/lib/GaudiAtomicSequencer.cpp src/lib/Prescaler.cpp
src/lib/Prescaler.cpp
src/lib/GaudiCommon.icpp src/lib/Sequencer.cpp src/lib/GetAlg.cpp
src/lib/Tuple.cpp src/lib/GaudiHistoID.cpp src/lib/TupleObj.cpp )
if( AIDA_FOUND )
......
// $Id: GaudiAtomicSequencer.h,v 0.1 2014/05/26 13:11:11 dfunke Exp $
#ifndef GAUDIATOMICSEQUENCER_H
#define GAUDIATOMICSEQUENCER_H 1
// Include files
// from Gaudi
#include "GaudiAlg/GaudiSequencer.h"
/** @class GaudiAtomicSequencer GaudiAtomicSequencer.h
* Sequencer for executing several algorithms, stopping when one is faulty.
* The algorithms are treated as an atomic block of operations and are NOT unrolled by
* the GaudiHive AlgResourcePool
*
* Default behaviour (ModeOR=False) is to execute all algorithms until one returns
* filterPassed() = False. If ShortCircuit is set to False, then all algorithms
* will be executed.
*
* In OR mode, the logic is opposite. All algorithms until one returns
* filterPassed() = True. To then exit one must onter-intuitively set
* ShortCircuit to False. If the default value ShortCircuit=True is left
* then all algorithms will be executed.
*
* @author Daniel Funke
* @date 2014-05-26
*/
class GAUDI_API GaudiAtomicSequencer: public GaudiSequencer {
public:
/// Standard constructor
GaudiAtomicSequencer( const std::string& name, ISvcLocator* pSvcLocator );
StatusCode initialize() override; ///< Algorithm initialization
/** copy and assignement are not allowed **/
GaudiAtomicSequencer( const GaudiAtomicSequencer& a ) = delete;
GaudiAtomicSequencer& operator=( const GaudiAtomicSequencer& a ) = delete;
};
#endif // GAUDIATOMICSEQUENCER_H
......@@ -75,7 +75,8 @@ private:
GaudiSequencer& operator=( const GaudiSequencer& a ) = delete;
Gaudi::Property<std::vector<std::string>> m_names{this, "Members", {}, "list of algorithms"};
Gaudi::Property<bool> m_modeOR{this, "ModeOR", false, "use OR loginc instead of AND"};
Gaudi::Property<bool> m_atomic{this, "Atomic", false, "Atomic sequence: don't unroll in MT"};
Gaudi::Property<bool> m_modeOR{this, "ModeOR", false, "use OR logic instead of AND"};
Gaudi::Property<bool> m_ignoreFilter{this, "IgnoreFilterPassed", false, "always continue"};
Gaudi::Property<bool> m_measureTime{this, "MeasureTime", false, "measure time"};
Gaudi::Property<bool> m_returnOK{this, "ReturnOK", false, "forces the sequencer to return a good status"};
......
......@@ -3,10 +3,8 @@
#include "GaudiAlg/Sequencer.h"
#include "GaudiAlg/GaudiAlgorithm.h"
#include "GaudiAlg/GaudiSequencer.h"
#include "GaudiAlg/GaudiAtomicSequencer.h"
DECLARE_COMPONENT( EventCounter )
DECLARE_COMPONENT( Prescaler )
DECLARE_COMPONENT( Sequencer )
DECLARE_COMPONENT( GaudiSequencer )
DECLARE_COMPONENT( GaudiAtomicSequencer )
// Include files
// from Gaudi
#include "GaudiAlg/GaudiAtomicSequencer.h"
//-----------------------------------------------------------------------------
// Implementation file for class : GaudiAtomicSequencer
//
// 2014-05-26 : Daniel Funke
//-----------------------------------------------------------------------------
//=============================================================================
// Standard constructor, initializes variables
//=============================================================================
GaudiAtomicSequencer::GaudiAtomicSequencer( const std::string& name,
ISvcLocator* pSvcLocator)
: GaudiSequencer ( name , pSvcLocator )
{}
//=============================================================================
// Initialisation. Check parameters
//=============================================================================
StatusCode GaudiAtomicSequencer::initialize() {
//in the GaudiSequencer::initalize the sysInitialize of all contained algorithms is called
//thereafter we have correct DataObjectHandles in the Algorithms
StatusCode status = GaudiSequencer::initialize();
if (msgLevel(MSG::DEBUG)) debug() << "==> Initialise" << endmsg;
if ( !status.isSuccess() ) return status;
// addSubAlgorithmDataObjectHandles();
return status;
}
......@@ -4,7 +4,7 @@ from Configurables import (HiveWhiteBoard, HiveSlimEventLoopMgr,
CPUCruncher,
ContextEventCounterPtr,
ContextEventCounterData,
GaudiAtomicSequencer)
GaudiSequencer)
# metaconfig -------------------------------------------------------------------
# It's confortable to collect the relevant parameters at the top of the optionfile
......@@ -75,9 +75,10 @@ for algo in [a1, a2, a3, a4]:
for algo in [a3]:
algo.Cardinality = cardinality
seq = GaudiAtomicSequencer("CriticalSection",
Members=[a1,a2,a4],
OutputLevel=VERBOSE)
seq = GaudiSequencer("CriticalSection",
Members=[a1,a2,a4],
Atomic=True,
OutputLevel=VERBOSE)
# Application Manager ----------------------------------------------------------
# We put everything together and change the type of message service
......
......@@ -182,17 +182,39 @@ StatusCode AlgResourcePool::flattenSequencer(Algorithm* algo, ListAlg& alglist,
StatusCode sc = StatusCode::SUCCESS;
bool isGaudiSequencer(false);
bool isAthSequencer(false);
bool isAtomicSeq(false);
if (algo->hasProperty("Members")) {
if (algo->hasProperty("ShortCircuit")) {
isGaudiSequencer = true;
isAtomicSeq = ( algo->hasProperty("Atomic") &&
(algo->getProperty("Atomic").toString() == "True") );
} else if (algo->hasProperty("StopOverride")) {
isAthSequencer = true;
isAtomicSeq = ( algo->hasProperty("Atomic") &&
(algo->getProperty("Atomic").toString() == "True") );
}
}
std::vector<Algorithm*>* subAlgorithms = algo->subAlgorithms();
auto isGaudiSequencer = dynamic_cast<GaudiSequencer*> (algo);
if ( //we only want to add basic algorithms -> have no subAlgs
// and exclude the case of empty GaudiSequencers
(subAlgorithms->empty() and not isGaudiSequencer)
// we want to add non-empty GaudiAtomicSequencers
or (algo->type() == "GaudiAtomicSequencer" and not subAlgorithms->empty())){
// and exclude the case of empty GaudiSequencers
(subAlgorithms->empty() and not (isGaudiSequencer
|| isAthSequencer) )
// we want to add non-empty AtomicSequencers
or (isAtomicSeq and not subAlgorithms->empty())
){
debug() << std::string(recursionDepth, ' ') << algo->name() << " is ";
if (isAtomicSeq) {
debug() << "an atomic sequencer";
} else {
debug() << "not a sequencer";
}
debug() << ". Appending it" << endmsg;
DEBUG_MSG << std::string(recursionDepth, ' ') << algo->name() << " is "
<< (algo->type() != "GaudiAtomicSequencer" ? "not a sequencer" : "an atomic sequencer")
<< ". Appending it" << endmsg;
alglist.emplace_back(algo);
m_PRGraph->addAlgorithmNode(algo, parentName, false, false).ignore();
......@@ -210,6 +232,11 @@ StatusCode AlgResourcePool::flattenSequencer(Algorithm* algo, ListAlg& alglist,
allPass = (algo->getProperty("IgnoreFilterPassed").toString() == "True")? true : false;
isLazy = (algo->getProperty("ShortCircuit").toString() == "True")? true : false;
if (allPass) isLazy = false; // standard GaudiSequencer behavior on all pass is to execute everything
} else if (isAthSequencer ) {
modeOR = (algo->getProperty("ModeOR").toString() == "True")? true : false;
allPass = (algo->getProperty("IgnoreFilterPassed").toString() == "True")? true : false;
isLazy = (algo->getProperty("StopOverride").toString() == "True")? false : true;
}
sc = m_PRGraph->addDecisionHubNode(algo, parentName, modeOR, allPass, isLazy);
if (sc.isFailure()) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment