Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DQM]L1TOccupancyClient: Bug fix and fixes static analyzer warning #46442

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

smuzaffar
Copy link
Contributor

This PR proposes following changes

  • code clean: Call getAvrg only when needed
  • Bug fix: Fill maxAvgs using the correct correct index nActualStrips
  • Call TMath::MinElement only if nActualStrips>0 otherwise we have a uninitialize maxAvgs. This fixes clang analyzer warning [a]

[a] https://cmssdt.cern.ch/SDT/jenkins-artifacts/ib-static-analysis/CMSSW_14_2_X_2024-10-16-1100/el8_amd64_gcc12/llvm-analysis/report-4ed65d.html#EndPath

In file included from src/DQM/L1TMonitorClient/src/L1TOccupancyClient.cc:1:
In file included from src/DQM/L1TMonitorClient/interface/L1TOccupancyClient.h:9:
In file included from src/DQMServices/Core/interface/DQMStore.h:4:
In file included from src/DQMServices/Core/interface/MonitorElement.h:15:
In file included from root/6.30.09-c59d6b036f1cbd6988c172ba319259f1/include/TF1.h:36:
  root/6.30.09-c59d6b036f1cbd6988c172ba319259f1/include/TMath.h:961:4: warning: Undefined or garbage value returned to caller [core.uninitialized.UndefReturn]
   961 |    return *std::min_element(a,a+n);

@cmsbuild
Copy link
Contributor

cmsbuild commented Oct 18, 2024

cms-bot internal usage

@@ -459,7 +457,8 @@ double L1TOccupancyClient::xySymmetry(const ParameterSet& ps,
cout << "statsup= " << statsup << ", statslow= " << statslow << endl;
}

enoughStats = TMath::MinElement(nActualStrips, maxAvgs.get()) > TMath::Max(statsup, statslow);
if (nActualStrips > 0)
enoughStats = TMath::MinElement(nActualStrips, maxAvgs.get()) > TMath::Max(statsup, statslow);
if (verbose_) {
cout << "stats: " << TMath::MinElement(nActualStrips, maxAvgs.get())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cms-sw/dqm-l2 , any idea what should be printed in case of nActualStrips=0 ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My guess would be something alog these lines

if (nActualStrips == 0) {
    cout << "No valid strips found, insufficient statistics." << endl;
  } else {

but perhaps the @cms-sw/l1-l2 can confirm

@@ -543,7 +541,8 @@ double L1TOccupancyClient::xySymmetry(const ParameterSet& ps,
if (verbose_) {
cout << "statsup= " << statsup << ", statslow= " << statslow << endl;
}
enoughStats = TMath::MinElement(nActualStrips, maxAvgs.get()) > TMath::Max(statsup, statslow);
if (nActualStrips > 0)
enoughStats = TMath::MinElement(nActualStrips, maxAvgs.get()) > TMath::Max(statsup, statslow);
if (verbose_) {
cout << "stats: " << TMath::MinElement(nActualStrips, maxAvgs.get())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, call to TMath::MinElement should be avoid for nActualStrips==0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-46442/42303

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @smuzaffar for master.

It involves the following packages:

  • DQM/L1TMonitorClient (dqm)

@antoniovagnerini, @cmsbuild, @nothingface0, @rvenditti, @syuvivida, @tjavaid can you please review it and eventually sign? Thanks.
@missirol, @mmusich this is something you requested to watch as well.
@antoniovilela, @mandrenguyen, @rappoccio, @sextonkennedy you are the release manager for this.

cms-bot commands are listed here

@smuzaffar
Copy link
Contributor Author

please test

@smuzaffar smuzaffar changed the title L1TOccupancyClient: Bug fix and fixes static analyzer warning [DQM]L1TOccupancyClient: Bug fix and fixes static analyzer warning Oct 18, 2024
@cmsbuild
Copy link
Contributor

-1

Failed Tests: ClangBuild
Size: This PR adds an extra 24KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-e8e177/42299/summary.html
COMMIT: 00fed32
CMSSW: CMSSW_14_2_X_2024-10-17-2300/el8_amd64_gcc12
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/46442/42299/install.sh to create a dev area with all the needed externals and cmssw changes.

Clang Build

I found compilation warning while trying to compile with clang. Command used:

USER_CUDA_FLAGS='--expt-relaxed-constexpr' USER_CXXFLAGS='-Wno-register -fsyntax-only' scram build -k -j 32 COMPILER='llvm compile'

See details on the summary page.

@smuzaffar
Copy link
Contributor Author

please test

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-46442/42358

@cmsbuild
Copy link
Contributor

Pull request #46442 was updated. @antoniovagnerini, @nothingface0, @rvenditti, @syuvivida, @tjavaid can you please check and sign again.

@cmsbuild
Copy link
Contributor

-1

Failed Tests: Build ClangBuild
Size: This PR adds an extra 24KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-e8e177/42377/summary.html
COMMIT: e564d80
CMSSW: CMSSW_14_2_X_2024-10-24-1100/el8_amd64_gcc12
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/46442/42377/install.sh to create a dev area with all the needed externals and cmssw changes.

Build

I found compilation error when building:

>> Compiling edm plugin src/DQM/L1TMonitorClient/src/L1TdeStage2ShowerRegionalClient.cc
/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02860/el8_amd64_gcc12/external/gcc/12.3.1-40d504be6370b5a30e3947a6e575ca28/bin/c++ -c -DGNU_GCC -D_GNU_SOURCE -DTBB_USE_GLIBCXX_VERSION=120301 -DTBB_SUPPRESS_DEPRECATED_MESSAGES -DTBB_PREVIEW_RESUMABLE_TASKS=1 -DTBB_PREVIEW_TASK_GROUP_EXTENSIONS=1 -DBOOST_SPIRIT_THREADSAFE -DPHOENIX_THREADSAFE -DBOOST_MATH_DISABLE_STD_FPCLASSIFY -DBOOST_UUID_RANDOM_PROVIDER_FORCE_POSIX -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -DCMSSW_GIT_HASH='CMSSW_14_2_X_2024-10-24-1100' -DPROJECT_NAME='CMSSW' -DPROJECT_VERSION='CMSSW_14_2_X_2024-10-24-1100' -Isrc -Ipoison -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02860/el8_amd64_gcc12/cms/cmssw-patch/CMSSW_14_2_X_2024-10-24-1100/src -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02860/el8_amd64_gcc12/external/classlib/3.1.3-c6b100380ee001a2bc06975bb0682ffc/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02860/el8_amd64_gcc12/external/pcre/8.43-e34796d17981e9b6d174328c69446455/include -isystem/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02860/el8_amd64_gcc12/external/boost/1.80.0-477823d53efabc5118f199265eb7ab49/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02860/el8_amd64_gcc12/external/bz2lib/1.0.6-d065ccd79984efc6d4660f410e4c81de/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02860/el8_amd64_gcc12/external/libuuid/2.34-27ce4c3579b5b1de2808ea9c4cd8ed29/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02860/el8_amd64_gcc12/external/protobuf/3.21.9-cceae2b21362e2ebbf12522a68c60cb1/include -isystem/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02860/el8_amd64_gcc12/lcg/root/6.30.09-750fd45700afc5d74863b522cf3e6e56/include -isystem/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02860/el8_amd64_gcc12/external/tbb/v2021.9.0-e785b749a0b6cb9c66dc1d78066210e0/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02860/el8_amd64_gcc12/external/xz/5.2.5-6f3f49b07db84e10c9be594a1176c114/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02860/el8_amd64_gcc12/external/zlib/1.2.11-1a082fc322b0051b504cc023f21df178/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02860/el8_amd64_gcc12/external/fmt/10.2.1-deba157dd76fed17ac8b42adc60ff53f/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02860/el8_amd64_gcc12/external/md5/1.0.0-5b594b264e04ae51e893b1d69a797ec6/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02860/el8_amd64_gcc12/external/tinyxml2/6.2.0-68d511689c5dbd9a0d296bbb795fa052/include -O3 -pthread -pipe -Werror=main -Werror=pointer-arith -Werror=overlength-strings -Wno-vla -Werror=overflow -std=c++20 -ftree-vectorize -Werror=array-bounds -Werror=format-contains-nul -Werror=type-limits -fvisibility-inlines-hidden -fno-math-errno --param vect-max-version-for-alias-checks=50 -Xassembler --compress-debug-sections -Wno-error=array-bounds -Warray-bounds -fuse-ld=bfd -march=x86-64-v2 -felide-constructors -fmessage-length=0 -Wall -Wno-non-template-friend -Wno-long-long -Wreturn-type -Wextra -Wpessimizing-move -Wclass-memaccess -Wno-cast-function-type -Wno-unused-but-set-parameter -Wno-ignored-qualifiers -Wno-unused-parameter -Wunused -Wparentheses -Werror=return-type -Werror=missing-braces -Werror=unused-value -Werror=unused-label -Werror=address -Werror=format -Werror=sign-compare -Werror=write-strings -Werror=delete-non-virtual-dtor -Werror=strict-aliasing -Werror=narrowing -Werror=unused-but-set-variable -Werror=reorder -Werror=unused-variable -Werror=conversion-null -Werror=return-local-addr -Wnon-virtual-dtor -Werror=switch -fdiagnostics-show-option -Wno-unused-local-typedefs -Wno-attributes -Wno-psabi -Wno-error=unused-variable -DBOOST_DISABLE_ASSERTS -flto=auto -fipa-icf -flto-odr-type-merging -fno-fat-lto-objects -Wodr -fPIC -MMD -MF tmp/el8_amd64_gcc12/src/DQM/L1TMonitorClient/src/DQML1TMonitorClient/L1TdeStage2ShowerRegionalClient.cc.d src/DQM/L1TMonitorClient/src/L1TdeStage2ShowerRegionalClient.cc -o tmp/el8_amd64_gcc12/src/DQM/L1TMonitorClient/src/DQML1TMonitorClient/L1TdeStage2ShowerRegionalClient.cc.o
>> Compiling edm plugin src/DQM/L1TMonitorClient/src/SealModule.cc
/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02860/el8_amd64_gcc12/external/gcc/12.3.1-40d504be6370b5a30e3947a6e575ca28/bin/c++ -c -DGNU_GCC -D_GNU_SOURCE -DTBB_USE_GLIBCXX_VERSION=120301 -DTBB_SUPPRESS_DEPRECATED_MESSAGES -DTBB_PREVIEW_RESUMABLE_TASKS=1 -DTBB_PREVIEW_TASK_GROUP_EXTENSIONS=1 -DBOOST_SPIRIT_THREADSAFE -DPHOENIX_THREADSAFE -DBOOST_MATH_DISABLE_STD_FPCLASSIFY -DBOOST_UUID_RANDOM_PROVIDER_FORCE_POSIX -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -DCMSSW_GIT_HASH='CMSSW_14_2_X_2024-10-24-1100' -DPROJECT_NAME='CMSSW' -DPROJECT_VERSION='CMSSW_14_2_X_2024-10-24-1100' -Isrc -Ipoison -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02860/el8_amd64_gcc12/cms/cmssw-patch/CMSSW_14_2_X_2024-10-24-1100/src -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02860/el8_amd64_gcc12/external/classlib/3.1.3-c6b100380ee001a2bc06975bb0682ffc/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02860/el8_amd64_gcc12/external/pcre/8.43-e34796d17981e9b6d174328c69446455/include -isystem/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02860/el8_amd64_gcc12/external/boost/1.80.0-477823d53efabc5118f199265eb7ab49/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02860/el8_amd64_gcc12/external/bz2lib/1.0.6-d065ccd79984efc6d4660f410e4c81de/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02860/el8_amd64_gcc12/external/libuuid/2.34-27ce4c3579b5b1de2808ea9c4cd8ed29/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02860/el8_amd64_gcc12/external/protobuf/3.21.9-cceae2b21362e2ebbf12522a68c60cb1/include -isystem/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02860/el8_amd64_gcc12/lcg/root/6.30.09-750fd45700afc5d74863b522cf3e6e56/include -isystem/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02860/el8_amd64_gcc12/external/tbb/v2021.9.0-e785b749a0b6cb9c66dc1d78066210e0/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02860/el8_amd64_gcc12/external/xz/5.2.5-6f3f49b07db84e10c9be594a1176c114/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02860/el8_amd64_gcc12/external/zlib/1.2.11-1a082fc322b0051b504cc023f21df178/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02860/el8_amd64_gcc12/external/fmt/10.2.1-deba157dd76fed17ac8b42adc60ff53f/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02860/el8_amd64_gcc12/external/md5/1.0.0-5b594b264e04ae51e893b1d69a797ec6/include -I/cvmfs/cms-ib.cern.ch/sw/x86_64/nweek-02860/el8_amd64_gcc12/external/tinyxml2/6.2.0-68d511689c5dbd9a0d296bbb795fa052/include -O3 -pthread -pipe -Werror=main -Werror=pointer-arith -Werror=overlength-strings -Wno-vla -Werror=overflow -std=c++20 -ftree-vectorize -Werror=array-bounds -Werror=format-contains-nul -Werror=type-limits -fvisibility-inlines-hidden -fno-math-errno --param vect-max-version-for-alias-checks=50 -Xassembler --compress-debug-sections -Wno-error=array-bounds -Warray-bounds -fuse-ld=bfd -march=x86-64-v2 -felide-constructors -fmessage-length=0 -Wall -Wno-non-template-friend -Wno-long-long -Wreturn-type -Wextra -Wpessimizing-move -Wclass-memaccess -Wno-cast-function-type -Wno-unused-but-set-parameter -Wno-ignored-qualifiers -Wno-unused-parameter -Wunused -Wparentheses -Werror=return-type -Werror=missing-braces -Werror=unused-value -Werror=unused-label -Werror=address -Werror=format -Werror=sign-compare -Werror=write-strings -Werror=delete-non-virtual-dtor -Werror=strict-aliasing -Werror=narrowing -Werror=unused-but-set-variable -Werror=reorder -Werror=unused-variable -Werror=conversion-null -Werror=return-local-addr -Wnon-virtual-dtor -Werror=switch -fdiagnostics-show-option -Wno-unused-local-typedefs -Wno-attributes -Wno-psabi -Wno-error=unused-variable -DBOOST_DISABLE_ASSERTS -flto=auto -fipa-icf -flto-odr-type-merging -fno-fat-lto-objects -Wodr -fPIC -MMD -MF tmp/el8_amd64_gcc12/src/DQM/L1TMonitorClient/src/DQML1TMonitorClient/SealModule.cc.d src/DQM/L1TMonitorClient/src/SealModule.cc -o tmp/el8_amd64_gcc12/src/DQM/L1TMonitorClient/src/DQML1TMonitorClient/SealModule.cc.o
src/DQM/L1TMonitorClient/src/L1TOccupancyClient.cc: In member function 'double L1TOccupancyClient::xySymmetry(const edm::ParameterSet&, std::string, std::vector >&, std::vector >&, bool&)':
src/DQM/L1TMonitorClient/src/L1TOccupancyClient.cc:421:65: error: 'i' was not declared in this scope
  421 |     for (int j = upBinStrip, k = lowBinStrip; j <= maxBinStrip; i++, j++, k--) {
      |                                                                 ^
src/DQM/L1TMonitorClient/src/L1TOccupancyClient.cc:509:65: error: 'i' was not declared in this scope
  509 |     for (int j = upBinStrip, k = lowBinStrip; j <= maxBinStrip; i++, j++, k--) {
      |                                                                 ^


Clang Build

I found compilation error while trying to compile with clang. Command used:

USER_CUDA_FLAGS='--expt-relaxed-constexpr' USER_CXXFLAGS='-Wno-register -fsyntax-only' scram build -k -j 32 COMPILER='llvm compile'

>> Local Products Rules ..... started
>> Local Products Rules ..... done
>> Creating project symlinks
>> Entering Package DQM/L1TMonitorClient
>> Compile sequence completed for CMSSW CMSSW_14_2_X_2024-10-24-1100
gmake: *** [There are compilation/build errors. Please see the detail log above.] Error 1
+ eval scram build outputlog '&&' '(python3' /data/cmsbld/jenkins/workspace/ib-run-pr-tests/cms-bot/buildLogAnalyzer.py --logDir /data/cmsbld/jenkins/workspace/ib-run-pr-tests/CMSSW_14_2_X_2024-10-24-1100/tmp/el8_amd64_gcc12/cache/log/src '||' 'true)'
++ scram build outputlog
>> Entering Package DQM/L1TMonitorClient
Entering library rule at DQM/L1TMonitorClient
>> Compiling edm plugin src/DQM/L1TMonitorClient/src/L1EmulatorErrorFlagClient.cc


@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-46442/42359

@cmsbuild
Copy link
Contributor

Pull request #46442 was updated. @antoniovagnerini, @cmsbuild, @nothingface0, @rvenditti, @syuvivida, @tjavaid can you please check and sign again.

@smuzaffar
Copy link
Contributor Author

please test

@cmsbuild
Copy link
Contributor

+1

Size: This PR adds an extra 24KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-e8e177/42378/summary.html
COMMIT: bd61fee
CMSSW: CMSSW_14_2_X_2024-10-24-1100/el8_amd64_gcc12
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/46442/42378/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • You potentially added 2 lines to the logs
  • Reco comparison results: 15 differences found in the comparisons
  • DQMHistoTests: Total files compared: 46
  • DQMHistoTests: Total histograms compared: 3566343
  • DQMHistoTests: Total failures: 428
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3565895
  • DQMHistoTests: Total skipped: 20
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 45 files compared)
  • Checked 201 log files, 171 edm output root files, 46 DQM output files
  • TriggerResults: no differences found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants