CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions | Variables
parallelization Namespace Reference

Functions

def adjust_pset
 
def cleanupandexit
 
def uint
 

Variables

tuple actual_int_jobs = len([string for string in os.listdir('Herwig-scratch/Build') if re.match(r'integrationJob[0-9]+', string)])
 Integrate ##. More...
 
tuple args = parser.parse_args()
 
string build_name = template_name+'_build.py'
 
list cleanupfiles = []
 
string integration_name = template_name+'_integrate_'
 
list parameters = ['runModeList = cms.untracked.string(\'build\')']
 Execute the different run modes. More...
 
tuple parser = argparse.ArgumentParser()
 Get command line arguments. More...
 
tuple process = subprocess.Popen(['cmsRun', build_name], stdout=build_log, stderr=subprocess.STDOUT)
 
list processes = []
 Run mode ##. More...
 
string run_name = template_name+'_run_'
 
tuple template_name = args.cmsRunfile.replace('.', '_')
 

Function Documentation

def parallelization.adjust_pset (   cmsrunfilename,
  savefilename,
  par_list 
)
Takes the cmsRun filem, removes all occurences of runMode, jobs,
   maxJobs and integrationList parameters in the process.generator
   part.
   The the parameters in par_list are set instead and saved.

Definition at line 60 of file parallelization.py.

References sistrip::SpyUtilities.range().

60 
61 def adjust_pset(cmsrunfilename, savefilename, par_list):
62  """Takes the cmsRun filem, removes all occurences of runMode, jobs,
63  maxJobs and integrationList parameters in the process.generator
64  part.
65  The the parameters in par_list are set instead and saved.
66  """
67 
68  with open(cmsrunfilename, 'r') as readfile:
69  parsestring = readfile.read()
70 
71  # get first opening bracket after process.generator
72  begin_gen_step = parsestring.find('(', parsestring.find('process.generator'))
73 
74  # find matching bracket
75  end_gen_step = begin_gen_step
76  bracket_counter = 1
77  for position in range(begin_gen_step+1, len(parsestring)):
78  if parsestring[position] == '(':
79  bracket_counter += 1
80  if parsestring[position] == ')':
81  bracket_counter -= 1
82  if not bracket_counter:
83  end_gen_step = position
84  break
85 
86  # get string between brackets
87  gen_string = parsestring[begin_gen_step+1:end_gen_step]
88 
89  # remove all parameters that would interfere
90  gen_string = re.sub(r',\s*runModeList\s*=\s*cms.untracked.string\((.*?)\)', '', gen_string)
91  gen_string = re.sub(r',\s*jobs\s*=\s*cms.untracked.int32\((.*?)\)', '', gen_string)
92  gen_string = re.sub(r',\s*integrationList\s*=\s*cms.untracked.string\((.*?)\)', '', gen_string)
93  gen_string = re.sub(r',\s*maxJobs\s*=\s*cms.untracked.uint32\((.*?)\)', '', gen_string)
94  gen_string = re.sub(r',\s*seed\s*=\s*cms.untracked.int32\((.*?)\)', '', gen_string)
95 
96 
97  # write the savefile with all parameters given in par_list
98  with open(savefilename,'w') as savefile:
99  savefile.write(parsestring[:begin_gen_step+1])
100  savefile.write(gen_string)
101  for item in par_list:
102  savefile.write(',\n')
103  savefile.write(item)
104  savefile.write(parsestring[end_gen_step:])
105 
106 
const uint16_t range(const Frame &aFrame)
def parallelization.cleanupandexit (   filelist)
Delete the files in filelist and exit

Definition at line 107 of file parallelization.py.

108 def cleanupandexit(filelist):
109  """Delete the files in filelist and exit"""
110  for filename in filelist:
111  os.remove(filename)
112  sys.exit(0)
113 
114 
115 
def parallelization.uint (   string)
Unsigned int type

Definition at line 50 of file parallelization.py.

Referenced by SiStripMonitorDigi.AddApvShotsToSubDet(), FWRecoGeometryESProducer.addCaloGeometry(), L1Scalers.analyze(), SiStripMonitorHLT.analyze(), HLTFiltersDQMonitor.analyze(), SiStripMonitorDigi.analyze(), MonitorTrackResidualsBase< pixel_or_strip >.analyze(), SiPixelTrackResidualSource.analyze(), SiPixelHitEfficiencySource.analyze(), SiStripMonitorCluster.analyze(), TkConvValidator.analyze(), L1TS2PFJetInputPatternWriter.analyze(), L1Validator.analyze(), MuIsoValidation.analyze(), TrackingMonitor.analyze(), ZToMuMuGammaAnalyzer.analyze(), SplitVertexResolution.analyze(), PhotonAnalyzer.analyze(), OverlapValidation.analyzeTrajectory(), reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2.beginEvent(), SiPixelLorentzAnglePCLHarvester.beginRun(), PhotonOfflineClient.book2DHistoVector(), PhotonAnalyzer.book2DHistoVector(), PhotonOfflineClient.book3DHistoVector(), PhotonAnalyzer.book3DHistoVector(), L1Scalers.bookHistograms(), SiPixelPhase1MonitorTrackSoA.bookHistograms(), TrackingMonitor.bookHistograms(), PhotonAnalyzer.bookHistogramsEfficiency(), TriggerDQMBase.bookME(), TrackerOfflineValidation.bookSummaryHists(), L1TkMuonProducer.build_tkMuons_from_idxs(), CmsMTDConstruction< FilteredView >.buildETLModule(), L1TMuonBarrelKalmanStubProcessor.buildStub(), CacheData.CacheData(), L1METPFProducer.CalcMetHLS(), tmtt::ChiSquaredFitBase.calculateChiSq(), L1TMuonBarrelKalmanAlgo.calculateEta(), GsfElectronAlgo.calculateShowerShape(), EffectiveAreas.checkConsistency(), riemannFit.circleFit(), FlagsCleanerECAL.clean(), L1TMuonBarrelKalmanAlgo.clean(), L1TMuonBarrelKalmanRegionModule.cleanHigher(), L1TMuonBarrelKalmanRegionModule.cleanLower(), L1TMuonBarrelKalmanLUTs.coarseEta(), riemannFit.computeRadLenUniformMaterial(), EERecHitFromSoA.convert_soa_data_to_collection_(), HEFRecHitFromSoA.convert_soa_data_to_collection_(), HEBRecHitFromSoA.convert_soa_data_to_collection_(), JetCoreMCtruthSeedGenerator.coreTracksFilling(), JetCoreMCtruthSeedGenerator.coreTracksFillingDeltaR(), riemannFit.cov_carttorad(), riemannFit.cov_carttorad_prefit(), riemannFit.cov_radtocart(), GsfElectronAlgo.createElectron(), PFPhotonTranslator.createPhotons(), PFRecoTauDiscriminationByNProngs.discriminate(), CSCOfflineMonitor.doEfficiencies(), HLTMuonCertSummary.dqmEndJob(), EcalDAQTowerStatusXMLTranslator.dumpXML(), EcalDCSTowerStatusXMLTranslator.dumpXML(), L1TStage2InputPatternWriter.endJob(), L1TS2PFJetInputPatternWriter.endJob(), GlobalHitsProdHistStripper.endRun(), L1TMuonBarrelKalmanAlgo.estimateChiSquare(), L1TMuonBarrelKalmanAlgo.estimateCompatibility(), egammaTools::EgammaDNNHelper.evaluate(), VariableNTupler.fill(), StringBasedNTupler.fill(), SiStripMonitorDigi.FillApvShotsMap(), PixelVertexCollectionTrimmer.fillDescriptions(), PuppiProducer.fillDescriptions(), CTPPSPixelLocalTrackProducer.fillDescriptions(), GsfElectronProducer.fillDescriptions(), L2TauNNProducer.fillDescriptions(), TriggerDQMBase.fillHistoLSPSetDescription(), TriggerDQMBase.fillHistoPSetDescription(), PhotonProducer.fillPhotonCollection(), GEDPhotonProducer.fillPhotonCollection(), PythiaFilterMultiAncestor.filter(), L1TkMuMantra.find_match(), L1Validator.FindBest(), L1TkMuCorrDynamicWindows.findBin(), L1TkMuMantra.findBin(), L1TMuonBarrelKalmanAlgo.getByCode(), EffectiveAreas.getEffectiveArea(), ZElectronsSelector.getEffectiveArea(), TrackerOfflineValidation.getHistStructFromMap(), PixelInactiveAreaFinder.getPhiSpanBarrel(), L1TTauOffline.getProbeTaus(), reco::GsfElectron.hcalToRun2EffDepth(), GsfElectronAlgo::HeavyObjectCache.HeavyObjectCache(), riemannFit.helixFit(), HLTJetTimingFilter< T >.hltFilter(), egammaTools::EgammaDNNHelper.initScalerFiles(), L1TowerCalibrator.L1TowerCalibrator(), riemannFit.lineFit(), PixelCPEGeneric.localError(), L1TMuonBarrelKalmanStubProcessor.makeStubs(), LowPtConversion.match(), L1TMuonBarrelKalmanAlgo.match(), SiStripTrackerMapCreator.paintTkMapFromAlarm(), EcalDAQTowerStatusXMLTranslator.plot(), EcalDCSTowerStatusXMLTranslator.plot(), TrackerOfflineValidation.prepareSummaryHists(), EffectiveAreas.printEffectiveAreas(), ZElectronsSelector.printEffectiveAreas(), riemannFit.printIt(), l1t::Stage2Layer2DemuxSumsAlgoFirmwareImp1.processEvent(), L1TMuonBarrelKalmanTrackProducer.produce(), L1TMuonBarrelKalmanStubProducer.produce(), PuppiProducer.produce(), HiEvtPlaneFlatProducer.produce(), PixelJetPuId.produce(), JetCoreMCtruthSeedGenerator.produce(), EvtPlaneProducer.produce(), L1TkMuonProducer.product_to_muvec(), L1TkMuonProducer.product_to_trkvec(), PuppiProducer.PuppiProducer(), L1TMuonBarrelKalmanAlgo.rank(), L1TCaloParamsOnlineProd.readCaloLayer2OnlineSettings(), CompleteNTupler.registerleaves(), VariableNTupler.registerleaves(), StringBasedNTupler.registerleaves(), MuonTestSummary.ResidualCheck(), PhotonOfflineClient.retrieveHisto(), RPixPlaneCombinatoryTracking.RPixPlaneCombinatoryTracking(), PhotonOfflineClient.runClient(), L1TkMuonProducer.runOnMTFCollection_v2(), riemannFit.scatter_cov_rad(), riemannFit.scatterCovLine(), JetCoreMCtruthSeedGenerator.seedParFilling(), HGCalConcentratorAutoEncoderImpl.select(), StringCutEventSelector< Object, any >.select(), StringCutsEventSelector< Object, existenceMatter >.select(), L1TMuonBarrelKalmanRegionModule.selfClean(), TrackingMonitor.setMaxMinBin(), TrackingMonitor.setNclus(), StringBasedNTupler.StringBasedNTupler(), StringBranchHelper< Object, Collection >.StringBranchHelper(), TauDiscriminantCutMultiplexerT< TauType, TauTypeRef, ParentClass >.TauDiscriminantCutMultiplexerT(), TkConvValidator.TkConvValidator(), trklet::FitTrack.trackFitChisq(), l1t::stage1.unpack_em(), l1t::stage1.unpack_region(), RctRawToDigi.unpackCTP7(), L1TMuonBarrelKalmanAlgo.updateLUT(), VariableNTupler.VariableNTupler(), L1TMuonBarrelKalmanAlgo.vertexConstraintLUT(), and L1TMuonBarrelKalmanSectorProcessor.wedgeSort().

50 
51 def uint(string):
52  """Unsigned int type"""
53  value = int(string)
54  if value < 0:
55  msg = '{0} is negative'.format(string)
56  raise argparse.ArgumentTypeError(msg)
57  return value
58 
59 

Variable Documentation

tuple parallelization.actual_int_jobs = len([string for string in os.listdir('Herwig-scratch/Build') if re.match(r'integrationJob[0-9]+', string)])

Integrate ##.

Definition at line 192 of file parallelization.py.

tuple parallelization.args = parser.parse_args()

Definition at line 132 of file parallelization.py.

string parallelization.build_name = template_name+'_build.py'

Definition at line 159 of file parallelization.py.

list parallelization.cleanupfiles = []

Definition at line 135 of file parallelization.py.

string parallelization.integration_name = template_name+'_integrate_'

Definition at line 211 of file parallelization.py.

list parallelization.parameters = ['runModeList = cms.untracked.string(\'build\')']

Execute the different run modes.

Build ##

Definition at line 154 of file parallelization.py.

tuple parallelization.parser = argparse.ArgumentParser()

Get command line arguments.

Definition at line 120 of file parallelization.py.

tuple parallelization.process = subprocess.Popen(['cmsRun', build_name], stdout=build_log, stderr=subprocess.STDOUT)

Definition at line 172 of file parallelization.py.

list parallelization.processes = []

Run mode ##.

This part uses the parallelization of the run step provided by Herwig. At the moment it is not usable. if args.run != 0: parameters = ['runModeList = cms.untracked.string(\'run\')'] parameters.append('jobs = cms.untracked.int32(' + str(args.run) + ')')

run_name = template_name + '_run.py' adjust_pset(args.cmsRunfile, run_name, parameters) cleanupfiles.append(run_name)

print 'Setting up {0} run jobs.'.format(str(args.run)) print 'Calling
\'cmsRun ' + run_name + '\' the Herwig run step.'.format(str(args.run)) process = subprocess.Popen(['cmsRun ' + run_name], shell=True) process.wait() print '------------——' print 'Run step finished.' print '------------——' This is the alternative for a paralellized run step. cmsRun is called as often as give with the option -r/–run. So the total number of generated events is a corresponding multiple of the number of events given in the cmsRun file.

Definition at line 205 of file parallelization.py.

Referenced by edm::RootFile.dropOnInputAndReorder(), GenLumiInfoProduct.mergeProduct(), FastTimerService::ResourcesPerJob.operator+=(), FastTimerService::ResourcesPerJob.reset(), edm::RootFile.RootFile(), edm::RootFile.setPresenceInProductRegistry(), GenLumiInfoProduct.setProcessInfo(), and TauDQMHistPlotter.TauDQMHistPlotter().

string parallelization.run_name = template_name+'_run_'

Definition at line 272 of file parallelization.py.

tuple parallelization.template_name = args.cmsRunfile.replace('.', '_')

Definition at line 138 of file parallelization.py.