Open AdrianoDee opened 2 months ago
assign reconstruction
assign upgrade
New categories assigned: reconstruction,upgrade
@jfernan2,@mandrenguyen,@srimanob,@subirsarkar you have been requested to review this Pull request/Issue and eventually sign? Thanks
cms-bot internal usage
A new Issue was created by @AdrianoDee.
@Dr15Jones, @antoniovilela, @makortel, @mandrenguyen, @rappoccio, @sextonkennedy, @smuzaffar can you please review it and eventually sign/assign? Thanks.
cms-bot commands are listed here
@AdrianoDee What would be the way to reproduce these jobs in pre4 and pre5 (onwards)?
@makortel if you check this (or under /eos/user/a/adiflori/www/phase2_pre5_memory_issue/
)
I've copied all the job reports for TTbar PU=200 here
you will find all the config used by each job (so with the relative lumisections) as a PSet.py
(loading a pickle
file). E.g. in /eos/user/a/adiflori/www/phase2_pre5_memory_issue/14_1_0_pre5/0/job/WMTaskSpace/cmsRun1
there's everything needed to run it
[adiflori@lxplus957 cmsRun1]$ ls -tlrh
total 67M
-rw-r--r--. 1 adiflori zh 419K Sep 2 01:15 FrameworkJobReport.xml
-rw-r--r--. 1 adiflori zh 128 Sep 2 01:15 PSet.py
-rw-r--r--. 1 adiflori zh 38M Sep 2 01:15 PSet.pkl
-rw-r--r--. 1 adiflori zh 70K Sep 2 01:15 cmsRun1-stdout.log
-rw-r--r--. 1 adiflori zh 54K Sep 2 01:15 Report.pkl
-rw-r--r--. 1 adiflori zh 227 Sep 2 01:15 cmsRun1-stderr.log
drwxr-xr-x. 2 adiflori zh 4.0K Sep 3 16:30 __pycache__
-rw-r--r--. 1 adiflori zh 29M Sep 3 16:30 dump.py
where (dump.py
) was just me checking the edmConfigDump
output made sense (and it does).
(Made clearer in the description the link includes the job configs too)
From RECO side we have been looking at this increase in RSS memory profile since the beginning[1] (indeed there is a drop of RSS to normal levels at the end of the tasks) though igprof profile does not see any difference in mem live consumption[2][3]
We have looked at the allocated memory from individual Reco Modules in pre4[4] and pre5[5] and just a general light increase in across all modules can be seen, but not a single real culprit.
Our suspect from the beginning was the change to AL9 of the test machines, since pre4>pre5 was at almost the same time as the transition of the operative system, but we did not know if this theory made sense since we ignored how RSS mem is managed. I have discarded this hypotesis now by running pre4 again in AL9.
[1] https://cms-reco-profiling.web.cern.ch/cms-reco-profiling/results/summary_plot_html/CMSSW_14_1_step3_12634.21.html [2] https://cms-reco-profiling.web.cern.ch/cms-reco-profiling/results/comp_igprof/html/CMSSW_14_1_0_pre5/12634.21/step3/mem_live.1.html [3] https://cms-reco-profiling.web.cern.ch/cms-reco-profiling/results/comp_igprof/html/CMSSW_14_1_0_pre5/12634.21/step3/mem_live.399.html
Our suspect from the beginning was the change to AL9 of the test machines, since pre4>pre5 was at almost the same time as the transition of the operative system, but we did not know if this theory made sense since we ignored how RSS mem is managed.
We have seen before reports or suspicion on the EL8/EL9 host OS leading to more memory being used compared to SLC7 https://github.com/cms-sw/cmssw/issues/42929 https://github.com/cms-sw/cmssw/issues/45028
I have discarded this hypotesis now by running pre4 again in AL9.
@jfernan2 Just to confirm I understood correctly, do you mean that you don't see a significant difference in memory usage between pre4 and pre5 when running on the same node or OS (AL9 I guess)?
@AdrianoDee Is there significant difference in sites or host OS versions where the jobs were run between pre4, pre5, pre6, and pre7?
I've copied all the job reports for TTbar PU=200 here
Using the setup from above, I processed the same 10 events of the pre4 input on an EL8 node using pre4 and pre5
14133.7 Mbytes
and VSIZE 29524.8 Mbytes
14329.5 Mbytes
(+1.4 %) and VSIZE 30748.9 Mbytes
(+4.1 %)The number of processed events was small, and real statistical conclusions would require more runs, but at least the numbers are not outrageously different.
@jfernan2 Just to confirm I understood correctly, do you mean that you don't see a significant difference in memory usage between pre4 and pre5 when running on the same node or OS (AL9 I guess)?
My initial conclusion yesterday was that I was seeing NO difference between AL9 and older OS, based on this plot for wf11834.21:
where both pre4, pre5 (and pre6) run on AL9, and, except for the very fist few events, RSS was lower for pre4 than pre5 (and pre6)
However, this night ended my test on another crosscheck wf12634 in pre4 using AL9, and things have changed:
pre4 is now at the RSS levels of pre5 (pre6 and pre7) for more than the half of the first events.
So, it looks like there is some dependence on AL9 and the way it handles the RSS....
I am running some extra tests on pre3 using AL9 (all releases except pre4, pre5, pre6 and pre7 in those plots were made before AL9 entered into the game) and with a Phase2 wf25034.21 using pre4 AL9 in order to confirm.
I also noticed that the trend in RSS over the job is very different in MC (high at the beginning and then dropping) wfs w.r.t. those in data (increasing over time), see e.g. https://cms-reco-profiling.web.cern.ch/cms-reco-profiling/results/summary_plot_html/CMSSW_14_1_step3_136.889.html https://cms-reco-profiling.web.cern.ch/cms-reco-profiling/results/summary_plot_html/CMSSW_14_1_step3_140.047.html
although the number of events in the task for data wfs is an order of magnitude higher than for mc wfs. I am also testing those again in pre4 using AL9 to have another independent view
On our side we submit all the RelVals with SCRAM_ARCH=el8_amd64_gcc12
so I suppose they all run in el8
.
That's the case too in our profiling tests but the machine says at the beginning of the log: Building remotely on vocms011 (el9 GenuineIntel reco-profiling no_label cpu-32 amd64)
Ah so there's some possible loop-hole, let me check more carefully.
After my last profiling tests in pre3 and pre4 with other MC and data workflows, I confirm that running in AL9 increases the peak RSS by a 20-30% in the same job w.r.t. previous OS versions. The RSS gets increased at the beginning of the task/job and then drops for the last events. I will update the plots above with the latest tests later, you can have all the results in text mode at the following folder (dates from Aug and Sep mean AL9):
ls -ld /eos/cms/store/user/cmsbuild/profiling/data/CMSSW_14_1_0_pre?/el8_amd64_gcc12/*/step3_TimeMemoryInfo.log | grep Sep
On our side we submit all the RelVals with
SCRAM_ARCH=el8_amd64_gcc12
so I suppose they all run inel8
.
Well, yes and no. The jobs will use the el8
binaries, and thus require either el8
host OS or an el8
container, but in the container case, the host OS can be (nearly) anything (as far as scram
and CMSSW are concerned).
Hi, Is the https://github.com/cms-sw/cmssw/issues/45854#issuecomment-2333615751 answered the increasing of Memory? One thing if you don't spot anything on RECO is DQM. DQM runs on the same step with RECO, so I don't think we can separate memory used for DQM or RECO step in relvals. I see several DQM-related PR added to in 14_1_0_pre5. Just a guess if we don't spot the issue from RECO.
Hi @srimanob The RECO profiling tests show that running in AL9 produces an increase of the RSS memory of 20-30% in the first part of the job, DQM part is excluded in these jobs.
Right @jfernan2 I mean if this 20% increase answers the issue, then we focus on it. If not, we need to look on something beyond RECO, and DQM may be the next target as it is not part of profiling.
Do we know if job crash in very beginning, sometimes later.
No, there is no job crash, just RSS memory is increased at the beginning of the job, see e.g. https://cms-reco-profiling.web.cern.ch/cms-reco-profiling/results/summary_plot_html/CMSSW_14_1_step3_11834.21.html
No, there is no job crash, just RSS memory is increased at the beginning of the job, see e.g. https://cms-reco-profiling.web.cern.ch/cms-reco-profiling/results/summary_plot_html/CMSSW_14_1_step3_11834.21.html
I wonder how reproducible is this RSS behavior wrt. the job progress (in terms of event number)? I.e. how the RSS vs "time" plot would look like if you'd run the same job (e.g. pre5) several times on the same node?
I can'y give you an exact answer, but based on the graphs I sent you for several pre-releases, I would expect fluctuations around the mean value as those given in first left plot of https://cms-reco-profiling.web.cern.ch/cms-reco-profiling/results/summary_plot_html/CMSSW_14_1_step3_140.047.html
of the order of 400MB around a mean central value. What is probably more significant is the RSS peak value at the left column of table in the link above
Hi @AdrianoDee
Looking on absolute memory we use in pre5 on Alma9, I try to run as RelVals, 100 jobs, 100 events/job, and what I observe is the RSS is quite stable, a little bit lower than 15 GB. RSS is typically larger when compared to PSS, so I don't understand why we have very large PSS. That means RSS is even larger or equal.
For current action, 1 stream should allow you to survive in 16 GB PSS. I also measure it.
8 Threads, 2 Streams
8 Threads, 1 Stream
My last test repeating on AL9 the pre3 shows high RSS for the whole job/task, from event 1 to 400: https://cms-reco-profiling.web.cern.ch/cms-reco-profiling/results/summary_plot_html/CMSSW_14_1_step3_11834.21.html
Same for data wfs on pre4 (on AL9): https://cms-reco-profiling.web.cern.ch/cms-reco-profiling/results/summary_plot_html/CMSSW_14_1_step3_136.889.html https://cms-reco-profiling.web.cern.ch/cms-reco-profiling/results/summary_plot_html/CMSSW_14_1_step3_140.047.html
Would someone be able to compare (again) the behavior of cmsRun
(jemalloc), cmsRunTC
(TCMalloc), and cmsRunGlibC
(glibc malloc)?
@srimanob @jfernan2 Do you run your tests on an otherwise free machine, or is other activity possible? In https://github.com/cms-sw/cmssw/issues/42387 it was reported that in cases where the memory ends up being fragmented (because of being heavily used by many processes) termination of an unrelated process can result in a huge spike in RSS (with jemalloc).
In my case I use the dedicated machine for RECO profiling vocms011 which has two profiling tasks at most running in parallel
In our test cmsRunGlibC is running for the igprof part: e.g. igprof -d -mp -z -o step3_igprofMEM.gz -t cmsRunGlibC cmsRunGlibC step3_igprof.py
but gives no difference in results for pre5 w.r.t. pre4: https://cms-reco-profiling.web.cern.ch/cms-reco-profiling/results/comp_igprof/html/CMSSW_14_1_0_pre5/11834.21/step3/mem_live.1.html https://cms-reco-profiling.web.cern.ch/cms-reco-profiling/results/comp_igprof/html/CMSSW_14_1_0_pre5/11834.21/step3/mem_live.399.html
Full details are here: https://cms-reco-profiling.web.cern.ch/cms-reco-profiling/
In our test cmsRunGlibC is running for the igprof part: e.g. igprof -d -mp -z -o step3_igprofMEM.gz -t cmsRunGlibC cmsRunGlibC step3_igprof.py
but gives no difference in results for pre5 w.r.t. pre4:
I think this is expected behavior. IgProf (and any memory profiler that hooks into the memory allocation functions) reports the memory the application requests, and this correlates with the VSIZE (that includes also "overheads" such as the OS reserving memory in terms of pages of e.g. 4 kB or 64 kB). RSS, on the other hand, depends on the amount of memory that is actually being touched by the application.
For example,
std::vector<int> vec;
vec.reserve(1024*1024);
would (in the leading order) result in 4 MB increase in VSIZE, while RSS would not be impacted. Only code like vec[0] = 0;
would result in RSS to increase. And a memory profiler would only see the memory allocation from vec.reserve()
.
With https://github.com/cms-sw/cmssw/issues/45854#issuecomment-2340904341 I really meant keeping all other things equal, and just using cmsRunTC
/ cmsRunGlibC
instead of cmsRun
to run the configuration.
Hi @makortel
I run jobs in CERN Batch. So, the machine I run may have other activities, but may not be CMSSW. I am submitting jobs with cmsRunTC / cmsRunGlibC.
From your comment, https://github.com/cms-sw/cmssw/issues/45854#issuecomment-2340916395, it is highly possible if we will run the same relvals job in the same machine. I assume. I don't know much detail on machine we dedicate for relvals, but I assume it is not a random in the pool.
Hi @makortel
cmsRunGlibC: <Metric Name="LargestRssEvent-f-RSS" Value="36023.4"/>
cmsRunTC: <Metric Name="LargestRssEvent-f-RSS" Value="14986.6"/>
cmsRun: <Metric Name="LargestRssEvent-f-RSS" Value="14858.2"/>
Thanks @srimanob. Interesting that jemalloc shows the smallest RSS, IIRC in the past at lest one of TCMalloc or GlibC has resulted smaller RSS but then been significantly slower in a multithreaded program.
Hi @makortel To be sure, do you want me to do in 1 threads or normal 8 threads? I usually measure with 8 threads to use the number for production.
For the peak RSS I have also this plot prior to the inclusion of AL9, I do not know if the fall in 13_3_X was due to AL8, I don't recall the dates of the previous Linux version https://gitlab.cern.ch/cms-reconstruction/cms-reco-profiling/-/blob/main/results/release_mem_run3_8thread.png?ref_type=heads
Another piece of information that seems interesting to me. When running exactly the same wf, with exactly the same settings, with SCRAM_ARCH=el9_amd64_gcc12
the situation improves. I've run in 14_1_0_pre7
a TTbar Phase2 PU200 wf with the arch set to:
el8_amd64_gcc12
and we see 30% of failures for exceeded maxPSS. el9_amd64_gcc12
and everything is fine.So it seems something related to the OS (and the fact that we presumably run in containers).
For the moment the only stable and successful setup I found is 8 threads 1 stream and 20GB.
- the default
el8_amd64_gcc12
and we see 30% of failures for exceeded maxPSS.el9_amd64_gcc12
and everything is fine.
Were the jobs run on the same nodes (or the same underlying OS)?
Plotting the RSS and VSIZE from these results
I think we'd need a serious analysis of where the memory is being used. The 70 GB VSIZE is scary (especially given what we've learned of the OS-dependent behavior of RSS elsewhere, e.g. in https://github.com/cms-sw/cmssw/issues/46040 or https://github.com/cms-sw/cmssw/issues/42387).
One sort-of obvious memory hog is the (playback of) classical mixing.
Playback has some serious inefficiencies if the upstream PU producer is multi-threaded/multi-streamed, but I wouldn't expect that to cause memory explosion issues. It might be interesting to run the whole chain with one stream for each step (I believe there should only be one pileup input per stream, so the number of threads shouldn't matter).
Playback could be made much more time and IO efficient with some caching in the embedded file input module, but wouldn't expect a large memory impact.
Were the jobs run on the same nodes (or the same underlying OS)?
Should be el9 for both. I say should because I can't find any evidence in the logs of which is the underlying OS. I need to properly check.
For the playback, note that we see similar failures even when the jobs is (wrongfully) submitted with no PU replay at RECO step (as in this case for example with 20GB 2 streams and 8 cores).
I've resubmitted a couple of wfs excluding the VALIDATION
step, since in the past there have been issues there and the prod-like wfs used for the reco-timings don't run it and don't show such a jump.
One further piece. The wf with no VALIDATION
or DQM
sent with 16GB and 2 streams was successful. As a comparison:
-s RAW2DIGI,RECO,RECOSIM,PAT,VALIDATION:@phase2Validation+@miniAODValidation,DQM:@phase2+@miniAODDQM
) with 20GB and 2 streams that failed here-s RAW2DIGI,RECO,RECOSIM,PAT
) with 16GB and 2 streams hereFrom the logs I see the VSIZE and RSS much more under control (the no-validation job ran on twice of the events given no failures).
P.S. let me thank @fabiocos for suggesting the source could be there ( :
assign dqm
New categories assigned: dqm
@antoniovagnerini,@nothingface0,@rvenditti,@syuvivida,@tjavaid you have been requested to review this Pull request/Issue and eventually sign? Thanks
Hi @AdrianoDee It seems I should have bet more last month :)
Thanks for checking. In validation, you include the PU replay as default of validation + DQM, right? Note also on https://github.com/cms-sw/cmssw/issues/38828 if we run something unnecessary twice.
Yes, the replay is included
Ah but note that we have the same memory “explosion" even when not-included.
Il giorno 17 ott 2024, alle ore 07:02, Adriano Di Florio @.***> ha scritto:
Yes, the replay is included
— Reply to this email directly, view it on GitHub https://github.com/cms-sw/cmssw/issues/45854#issuecomment-2418504651, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEA6IGV3J7XHZYSZDWRH7ADZ35AG7AVCNFSM6AAAAABNPTBKXCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMJYGUYDINRVGE. You are receiving this because you are subscribed to this thread.
I profiled the example job, I think it was this one
, with IgProf, and below is the MEM_LIVE after first event (full profile is here).
TFile::Open()
(link)
TFile::ReadStreamerInfo()
(link)TClass::GetClass()
TopSingleLeptonDQM_miniAOD
(link)TopSingleLeptonDQM
(link)SingleObjectSelectorBase<edm::View<reco::GsfElectron>, StringCutObjectSelector<reco::GsfElectron, false>, edm::stream::EDFilter<>, ...>
(link)SingleObjectSelectorBase<edm::View<reco::Muon>, StringCutObjectSelector<reco::Muon, false>, edm::stream::EDFilter<>, ...>
(link)RecoTauPiZeroProducer
(link)SingleObjectSelectorBase<std::vector<reco::GenJet>, StringCutObjectSelector<reco::GenJet, false>, edm::stream::EDFilter<>, ...>
(link)BoostedJetONNXJetTagsProducer
UnifiedParticleTransformerAK4ONNXJetTagsProducer
pat::MuonMvaIDEstimator
, used by pat::PATMuonProducer
DeepFlavourONNXJetTagsProducer
DeepTauId
TfGraphDefProducer
GBRForest
(link)
LowPtGsfElectronSeedProducer
MVAValueMapProducer<reco::GsfElectron>
LowPtGsfElectronIDProducer
DeepTauId
(link)MuonDTDigis
(link)
ConvertedPhotonProducer
(link)MuonIdProducer
(link)edm::EventProcessor::runToCompletion()
, link)
MixingModule
(link
CrossingFrame<T>
data productsCrossingFrame<PCaloHit>
(link 1, (link 2)CrossingFrame<PSimHit>
(link 1, link 2)CrossingFrame<edm::HepMCProduct>
(link 1, link 2)CrossingFrame<SimTrack>
(link 1, link 2) CrossingFrame<SimVertex>
(link 1, link 2)PoolOutputModule
(link)PFRecHitProducer::produce()
(link) https://github.com/cms-sw/cmssw/issues/46511
HGCalGeometry::getGeometry()
(link)tensorflow::run()
(link)
TrackstersProducer
TrackstersMergeProducer
TrackstersMergeProducer::energyRegressionAndID()
that actually calls tensorflow::run()
, and ticl::PatternRecognitionbyCLUE3D<T>::energyRegressionAndID()
which is declared but not definedDeepTauId
after subtracting the contribution of DeepTauId
constructorRecoTauProducer::produce()
(link)
vector<PFTau>
produced by the moduleTSToSimTSHitLCAssociatorEDProducer::produce()
(link)PFClusterProducer::produce()
(link)TrackListMerger::produce()
(link)SiPixelClusterProducer::produce()
(link)HGCalRawToDigiFake::produce()
(link)SeedCreatorFromRegionHitsEDProducerT<SeedFromConsecutiveHitsCreator>::produce()
(link)HGCalUncalibRecHitProducer::produce()
(link)PuppiProducer::produce()
(link)edm::FwdPtrCollectionFilter<reco::PFCandidate, reco::PdgIdSelectorHandler, reco::PFCandidateWithSrcPtrFactory>::filter()
(link)ClusterTPAssociationProducer::produce()
(link)edm::DelayedReaderInputProductResolver::prefetchAsync_()
(link)SerialTaskQueue
HGCalGeometryESProducer::produce()
(link)magneticfield::VolumeBasedMagneticFieldESProducerFromDB::produce()
(link)SiPixelTemplateStoreESProducer::produce()
(link)GBRForestD
via CondDB (link)EcalCondObjectContainer<EcalPulseCovariance>
via CondDB (link)edm::stream
(link)Phase2TrackerMonitorDigi
(link)Phase2OTMonitorCluster
(link)Phase2ITMonitorCluster
(link)PrimaryVertexAnalyzer4PUSlimmed
(link)edm::global
(link)MultiTrackValidator
(link)HGCalValidator
(link)edm::one
(link)
In one of the latest round of RelVal productions we have observed an increased usage of memory for the RECO step for Phase2 (D110) PU workflows. We spotted this since many jobs started to fail due to an excessive memory usage. This happened because we usually set the memory limit per job to 16GB (for 8 threads 2 streams jobs) and we went quite frequently above that threshold. See e.g. the error report for a TTbar workflow showing the error report (find below the memory reported by condor to have exceeded the
maxPSS
). For the equivalent inpre4
we just had a few failures.See also the
PeakValueRss
reported in theFrameworkJobReport.xml
output for each job. I'm not sure how to interpret the low value tail for pre5.Bottom line: something happened between pre4 and pre5 that caused the memory usage at RECO step to jump quite a bit.
Reports
I've copied all the job reports and configs for TTbar PU=200 here or you can check in
/eos/cms/store/logs/prod/2024/06/WMAgent/pdmvserv_RVCMSSW_14_1_0_pre4TTbar_14TeV__STD_2026D110_PU_240604_235438_8449/
/eos/cms/store/logs/prod/2024/08/WMAgent/pdmvserv_RVCMSSW_14_1_0_pre5TTbar_14TeV__STD_2026D110_PU_240801_183220_4814/
We have "solved" this on our side by rising the memory used to 20GB. And the situation is unchanged in
14_1_0pre6
(and14_1_0_pre7
) since we are still seing failures if the memory max is set to 16GB.