Example #1
0
    def _do_action(self):
        import multiprocessing
        if (self.get_Value() == -1):
            self.set_Value(multiprocessing.cpu_count())
        elif (self.get_Value() < -1):
            from AthenaCommon.Logging import log
            log.fatal("nprocs cannot be < -1")
            import sys
            from AthenaCommon import ExitCodes
            sys.exit(ExitCodes.CONFIGURATION_ERROR)
        elif (self.get_Value() > multiprocessing.cpu_count()):
            from AthenaCommon.Logging import log
            log.warning("nprocs is larger than core count [%s]!",
                        multiprocessing.cpu_count())

        return
Example #2
0
    def _do_action(self):
        try:
            import GaudiHive  # noqa: F401
        except ImportError:
            from AthenaCommon.Logging import log
            log.fatal(
                "GaudiHive not in release - can't use --threads parameter")
            import sys
            from AthenaCommon import ExitCodes
            sys.exit(ExitCodes.IMPORT_ERROR)

        if (self.get_Value() < 0):
            from AthenaCommon.Logging import log
            log.fatal("Number of threads [%s] cannot be negative",
                      self.get_Value())
            import sys
            from AthenaCommon import ExitCodes
            sys.exit(ExitCodes.CONFIGURATION_ERROR)

        return
Example #3
0
nThreads = jp.ConcurrencyFlags.NumThreads()
nProc = jp.ConcurrencyFlags.NumProcs()

if nThreads >=1 :
    from AthenaCommon.AlgScheduler import AlgScheduler
    AlgScheduler.OutputLevel( INFO )
    AlgScheduler.ShowControlFlow( True )
    AlgScheduler.ShowDataDependencies( True )
    AlgScheduler.setDataLoaderAlg( 'SGInputLoader' )
    
    # Support for the MT-MP hybrid mode
    if (nProc > 0) :
        
        from AthenaCommon.Logging import log as msg
        if (theApp.EvtMax == -1) : 
            msg.fatal('EvtMax must be >0 for hybrid configuration')
            sys.exit(AthenaCommon.ExitCodes.CONFIGURATION_ERROR)

            if ( theApp.EvtMax % nProc != 0 ) :
                msg.warning('EvtMax[%s] is not divisible by nProcs[%s]: MP Workers will not process all requested events',theApp.EvtMax,nProc)

            chunkSize = int (theApp.EvtMax / nProc)

            from AthenaMP.AthenaMPFlags import jobproperties as jps 
            jps.AthenaMPFlags.ChunkSize= chunkSize
         
            msg.info('AthenaMP workers will process %s events each',chunkSize)
  
# MT-specific code
#---------------------------------------------------------------------------------#
Example #4
0
#
#  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
#

#
## can only run if Hive enabled
#
from AthenaCommon.Logging import log as msg

from AthenaCommon.ConcurrencyFlags import jobproperties as jp
nThreads = jp.ConcurrencyFlags.NumThreads()
if (nThreads < 1):
    msg.fatal('numThreads must be >0. Did you set the --threads=N option?')
    sys.exit(AthenaCommon.ExitCodes.CONFIGURATION_ERROR)

#
## Override Setup for Hive
#

from AthenaServices.AthenaServicesConf import AthenaHiveEventLoopMgr
# svcMgr.AthenaHiveEventLoopMgr.OutputLevel = INFO

from StoreGate.StoreGateConf import SG__HiveMgrSvc
# svcMgr.EventDataSvc.OutputLevel = INFO

from GaudiHive.GaudiHiveConf import AlgResourcePool
# svcMgr += AlgResourcePool( OutputLevel = INFO );

from AthenaCommon.AlgScheduler import AlgScheduler
AlgScheduler.OutputLevel(INFO)
AlgScheduler.ShowControlFlow(True)
Example #5
0
#

# Detector flags
from AthenaCommon.DetFlags import DetFlags
DetFlags.ID_setOn()
DetFlags.Calo_setOn()
DetFlags.Muon_setOn()
DetFlags.Lucid_setOff()
DetFlags.Truth_setOn()

# Check that we correctly configured number of threads from command line
from AthenaCommon.ConcurrencyFlags import jobproperties as jp
nThreads = jp.ConcurrencyFlags.NumThreads()
if (nThreads < 1):
    from AthenaCommon.Logging import log as msg
    msg.fatal('numThreads must be >0. Did you set the --threads=N option?')
    sys.exit(AthenaCommon.ExitCodes.CONFIGURATION_ERROR)

# Update message stream format to include slot number
msgFmt = "% F%40W%S%5W%e%s%7W%R%T %0W%M"
svcMgr.MessageSvc.Format = msgFmt

# Thread pool service and initialization
from GaudiHive.GaudiHiveConf import ThreadPoolSvc
svcMgr += ThreadPoolSvc("ThreadPoolSvc")
svcMgr.ThreadPoolSvc.ThreadInitTools = ["G4InitTool"]

# Performance monitoring probably not yet thread-safe
from PerfMonComps.PerfMonFlags import jobproperties
jobproperties.PerfMonFlags.doMonitoring.set_Value_and_Lock(False)
jobproperties.PerfMonFlags.doDsoMonitoring.set_Value_and_Lock(False)
Example #6
0
#
#  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
#

#
## can only run if Hive enabled
#
from AthenaCommon.Logging import log as msg

from AthenaCommon.ConcurrencyFlags import jobproperties as jp
nThreads = jp.ConcurrencyFlags.NumThreads()
if (nThreads < 1):
    msg.fatal('numThreads must be >0. Did you set the --threads=N option?')
    sys.exit(AthenaCommon.ExitCodes.CONFIGURATION_ERROR)

# setup the McEventSelector
import AthenaCommon.AtlasUnixGeneratorJob
svcMgr.EventSelector.FirstEvent = 0
svcMgr.EventSelector.RunNumber = 1
svcMgr.EventSelector.InitialTimeStamp = 0
svcMgr.EventSelector.TimeStampInterval = 1
svcMgr.EventSelector.FirstLB = 1

#
## Override Setup for Hive
#

from AthenaServices.AthenaServicesConf import AthenaHiveEventLoopMgr
# svcMgr.AthenaHiveEventLoopMgr.OutputLevel = INFO

from StoreGate.StoreGateConf import StoreGateSvc
Example #7
0
def setupCommonServices():
    from AthenaCommon import CfgMgr
    from AthenaCommon.Logging import logging
    from AthenaCommon.Constants import INFO
    from AthenaCommon.AppMgr import ServiceMgr as svcMgr, theApp
    from AthenaCommon.ConcurrencyFlags import jobproperties as jps

    # Setup messaging for Python and C++
    from AthenaCommon.Logging import log
    log.setFormat("%(asctime)s  Py:%(name)-31s %(levelname)7s %(message)s")

    # Create our own logger
    log = logging.getLogger('TriggerUnixStandardSetup::setupCommonServices:')

    from TrigServices.TrigServicesConfig import setupMessageSvc
    setupMessageSvc()

    # Do the default Atlas job configuration first
    import AthenaCommon.AtlasUnixStandardJob  # noqa: F401

    # Now do HLT/thread specific configuration (see e.g. AtlasThreadedJob.py)
    from StoreGate.StoreGateConf import SG__HiveMgrSvc
    svcMgr += SG__HiveMgrSvc("EventDataSvc",
                             NSlots=jps.ConcurrencyFlags.NumConcurrentEvents())

    import StoreGate.StoreGateConf as StoreGateConf
    svcMgr += StoreGateConf.StoreGateSvc("ConditionStore")

    # Configure the CoreDumpSvc
    if not hasattr(svcMgr, "CoreDumpSvc"):
        from AthenaServices.Configurables import CoreDumpSvc
        svcMgr += CoreDumpSvc()

    # ThreadPoolService thread local initialization
    from GaudiHive.GaudiHiveConf import ThreadPoolSvc
    svcMgr += ThreadPoolSvc("ThreadPoolSvc")
    svcMgr.ThreadPoolSvc.ThreadInitTools = ["ThreadInitTool"]

    from GaudiHive.GaudiHiveConf import AlgResourcePool
    svcMgr += AlgResourcePool(OutputLevel=INFO,
                              TopAlg=["AthSequencer/AthMasterSeq"])

    from AthenaCommon.AlgSequence import AlgSequence
    from SGComps.SGCompsConf import SGInputLoader
    topSequence = AlgSequence()
    topSequence += SGInputLoader(
        FailIfNoProxy=False)  # change to True eventually

    from AthenaCommon.AlgScheduler import AlgScheduler
    AlgScheduler.ShowDataDependencies(False)
    AlgScheduler.ShowControlFlow(False)
    AlgScheduler.setDataLoaderAlg('SGInputLoader')

    # Setup SGCommitAuditor to sweep new DataObjects at end of Alg execute
    theApp.AuditAlgorithms = True
    from SGComps.SGCompsConf import SGCommitAuditor
    svcMgr.AuditorSvc += SGCommitAuditor()

    # setup ROOT6
    from PyUtils.Helpers import ROOT6Setup
    ROOT6Setup()

    # Setup online THistSvc unless specifically configured otherwise
    #    setup the THistSvc early and force the creation of the THistSvc
    #    so that it can be used by infrastructure services to book histograms
    #    (to avoid problems e.g. with histograms in ROBDataProviderSvc)
    if _Conf.useOnlineTHistSvc:
        if hasattr(svcMgr, 'THistSvc'):
            log.fatal(
                "The offline histogramming THistSvc is already in place.")
            raise RuntimeError(
                "Cannot setup online histogramming TrigMonTHistSvc")
        log.debug("Using online histogramming service (TrigMonTHistSvc)")
        from TrigServices.TrigServicesConf import TrigMonTHistSvc
        svcMgr += TrigMonTHistSvc("THistSvc")
    else:
        log.debug("Using offline histogramming service (THistSvc)")
        from GaudiSvc.GaudiSvcConf import THistSvc
        svcMgr += THistSvc()

    # StoreGateSvc
    svcMgr.StoreGateSvc.ActivateHistory = False

    # ProxyProviderSvc services configuration
    svcMgr += CfgMgr.ProxyProviderSvc()

    # --- ByteStreamAddressProviderSvc configuration
    svcMgr += CfgMgr.ByteStreamAddressProviderSvc()
    svcMgr.ProxyProviderSvc.ProviderNames += ["ByteStreamAddressProviderSvc"]
    theApp.CreateSvc += [svcMgr.ByteStreamAddressProviderSvc.getFullName()]

    # Initialization of DetDescrCnvSvc
    svcMgr += CfgMgr.DetDescrCnvSvc(
        # specify primary Identifier dictionary to be used
        IdDictName="IdDictParser/ATLAS_IDS.xml")

    theApp.CreateSvc += [svcMgr.DetDescrCnvSvc.getFullName()]
    svcMgr.EventPersistencySvc.CnvServices += ["DetDescrCnvSvc"]

    # Online services for ByteStream input/output
    from TrigByteStreamCnvSvc.TrigByteStreamCnvSvcConf import TrigEventSelectorByteStream
    from TrigByteStreamCnvSvc.TrigByteStreamCnvSvcConfig import TrigByteStreamInputSvc, TrigByteStreamCnvSvc
    svcMgr += TrigByteStreamCnvSvc(
        "ByteStreamCnvSvc")  # this name is hard-coded in some converters
    svcMgr.EventPersistencySvc.CnvServices += ["ByteStreamCnvSvc"]
    svcMgr += TrigByteStreamInputSvc("ByteStreamInputSvc")
    svcMgr += TrigEventSelectorByteStream(
        "EventSelector", ByteStreamInputSvc=svcMgr.ByteStreamInputSvc)
    theApp.EvtSel = "EventSelector"

    # Online event loop manager
    from TrigServices.TrigServicesConfig import HltEventLoopMgr
    loopMgr = HltEventLoopMgr("HltEventLoopMgr")
    loopMgr.WhiteboardSvc = "EventDataSvc"
    loopMgr.SchedulerSvc = AlgScheduler.getScheduler().getName()
    loopMgr.EvtSel = svcMgr.EventSelector
    loopMgr.OutputCnvSvc = svcMgr.ByteStreamCnvSvc
    svcMgr += loopMgr
    theApp.EventLoop = loopMgr.name()

    from TrigOutputHandling.TrigOutputHandlingConfig import HLTResultMTMakerCfg
    svcMgr.HltEventLoopMgr.ResultMaker = HLTResultMTMakerCfg()

    # Configuration of Interval of Validity Service
    svcMgr += CfgMgr.IOVSvc()

    # Configure COOL update helper tool
    from TrigServices.TrigServicesConfig import TrigCOOLUpdateHelper
    svcMgr.HltEventLoopMgr.CoolUpdateTool = TrigCOOLUpdateHelper()

    # Configure the online ROB data provider service
    from TrigServices.TrigServicesConfig import HltROBDataProviderSvc
    svcMgr += HltROBDataProviderSvc()

    # Explicitly set a few OutputLevels (needed because some services are created in
    # different order when running with the PSC)
    svcMgr.IncidentSvc.OutputLevel = theApp.OutputLevel
    svcMgr.ProxyProviderSvc.OutputLevel = theApp.OutputLevel
    svcMgr.StoreGateSvc.OutputLevel = theApp.OutputLevel

    return
#
#  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
#

#
# Job options file for multi-threaded Geant4 ATLAS detector simulation.
# Run this by specifying the number of threads on the command line:
# $ athena --threads=4 G4AtlasApps/jobOptions.G4AtlasMT.py
#

from AthenaCommon.Logging import log as msg

from AthenaCommon.ConcurrencyFlags import jobproperties as jp
nThreads = jp.ConcurrencyFlags.NumThreads()
if (nThreads < 1) :
   msg.fatal('numThreads must be >0. Did you set the --threads=N option?')
   sys.exit(AthenaCommon.ExitCodes.CONFIGURATION_ERROR)

# Message stream format
msgFmt = "% F%40W%S%5W%e%s%7W%R%T %0W%M"
svcMgr.MessageSvc.Format = msgFmt

# Make the scheduler dump some information
from AthenaCommon.AlgScheduler import AlgScheduler
#AlgScheduler.ShowControlFlow( True )
#AlgScheduler.ShowDataDependencies( True )

# Thread pool service and G4 thread initialization
from GaudiHive.GaudiHiveConf import ThreadPoolSvc
svcMgr += ThreadPoolSvc("ThreadPoolSvc")
svcMgr.ThreadPoolSvc.ThreadInitTools = ["G4ThreadInitTool"]
Example #9
0
def _setupCommonServices():
    from AthenaCommon.Constants import VERBOSE, DEBUG, INFO, ERROR
    
    # Add timestamp to python logger
    from AthenaCommon.Logging import log
    log.setFormat("%(asctime)s  Py:%(name)-31s %(levelname)7s %(message)s")

    from AthenaCommon.Logging import logging
    log = logging.getLogger( 'TriggerUnixStandardSetup::setupCommonServices:' )
     
    # Do the default Atlas job configuration first
    import AthenaCommon.AtlasUnixStandardJob

    # Now do HLT specific configuration
    from AthenaCommon import CfgMgr
    from AthenaCommon.AppMgr import theApp
    from AthenaCommon.AppMgr import ServiceMgr as svcMgr
    from AthenaCommon.AppMgr import ToolSvc

    # Check whether we are running in athenaXT
    # Only a minimal set of properties should depend on this
    import sys
    if sys.modules.has_key('HLTTestApps'):
        _Conf.athenaXT = True
        log.debug("Configuration for athenaXT running")
    else:
        _Conf.athenaXT = False
        log.debug("Configuration for online running")
        
    # setup ROOT6 if needed
    _setupRoot6IfNeeded()

    # StoreGateSvc
    svcMgr.StoreGateSvc.ActivateHistory = False
    
    # ProxyProviderSvc services configuration
    svcMgr += CfgMgr.ProxyProviderSvc()

    # --- ByteStreamAddressProviderSvc configuration
    svcMgr += CfgMgr.ByteStreamAddressProviderSvc()
    svcMgr.ProxyProviderSvc.ProviderNames += [ "ByteStreamAddressProviderSvc" ]
    theApp.CreateSvc += [ svcMgr.ByteStreamAddressProviderSvc.getFullName() ]

    # Initialization of DetDescrCnvSvc
    svcMgr += CfgMgr.DetDescrCnvSvc(
        # specify primary Identifier dictionary to be used
        IdDictName = "IdDictParser/ATLAS_IDS.xml"
        )
    theApp.CreateSvc += [ svcMgr.DetDescrCnvSvc.getFullName() ]
    svcMgr.EventPersistencySvc.CnvServices += [ "DetDescrCnvSvc" ]

    # --- ByteStreamCnvSvc configuration
    svcMgr += CfgMgr.ByteStreamCnvSvc("ByteStreamCnvSvc")
    svcMgr.EventPersistencySvc.CnvServices += [ "ByteStreamCnvSvc" ]
    
    # Disable history
    svcMgr += CfgMgr.HistorySvc()
    svcMgr.HistorySvc.Activate = False

    # Configuration of Interval of Validity Service
    svcMgr += CfgMgr.IOVSvc()
    
    # Configure TrigISHelper
    from TrigServices.TrigServicesConf import TrigISHelper
    ToolSvc += TrigISHelper("TrigISHelper")

    # Configure TrigPreFlightCheck
    from TrigServices.TrigServicesConf import TrigPreFlightCheck
    ToolSvc += TrigPreFlightCheck("TrigPreFlightCheck",
                                  ReleaseDirs = ["AtlasP1HLT","AtlasHLT"]
                                  )

    # Configure CoreDumpSvc
    if not hasattr(svcMgr,"CoreDumpSvc"):
        from AthenaServices.Configurables import CoreDumpSvc
        svcMgr += CoreDumpSvc()
        
    # Configure COOL update helper tool
    from TrigServices.TrigServicesConfig import TrigCOOLUpdateHelper
    _eventLoopMgr(svcMgr).CoolUpdateTool = TrigCOOLUpdateHelper()
            
    # Setup online THistSvc unless specifically configured otherwise
    if _Conf.useOnlineTHistSvc:
        if hasattr(svcMgr, 'THistSvc'):
            log.fatal("The offline histogramming THistSvc is already in place.")
            raise RuntimeError("Cannot setup online histogramming TrigMonTHistSvc")
        log.debug("Using online histogramming service (TrigMonTHistSvc)")
        from TrigServices.TrigServicesConf import TrigMonTHistSvc
        svcMgr += TrigMonTHistSvc("THistSvc")
    else:
        log.debug("Using offline histogramming service (THistSvc)")
        from GaudiSvc.GaudiSvcConf import THistSvc
        svcMgr += THistSvc()

    # Explicitly set a few OutputLevels (needed because some services are created in
    # different order when running with the PSC)
    svcMgr.StatusCodeSvc.OutputLevel = theApp.OutputLevel
    svcMgr.IncidentSvc.OutputLevel = theApp.OutputLevel
    svcMgr.ProxyProviderSvc.OutputLevel = theApp.OutputLevel
    svcMgr.StoreGateSvc.OutputLevel = theApp.OutputLevel
    
    return