-
Notifications
You must be signed in to change notification settings - Fork 2
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
Extensive Code Duplication #96
Comments
Some examples below from the report:Constants repeated in Segment.h cmssw/RecoTracker/LSTCore/src/alpaka/Segment.h Lines 205 to 213 in ff8446c
cmssw/RecoTracker/LSTCore/src/alpaka/Segment.h Lines 235 to 243 in ff8446c
|
Duplicate functions in Quintuplet.h and PixelQuintuplet.h cmssw/RecoTracker/LSTCore/src/alpaka/Quintuplet.h Lines 1015 to 1099 in ff8446c
cmssw/RecoTracker/LSTCore/src/alpaka/PixelQuintuplet.h Lines 430 to 514 in ff8446c
|
Triple duplication of chi-squared function. @YonsiG do you know if there is supposed to be any difference between these three, or can they be merged? cmssw/RecoTracker/LSTCore/src/alpaka/PixelQuintuplet.h Lines 385 to 428 in ff8446c
cmssw/RecoTracker/LSTCore/src/alpaka/Quintuplet.h Lines 1200 to 1243 in ff8446c
cmssw/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h Lines 325 to 368 in ff8446c
|
runDeltaBetaIterations duplication. cmssw/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h Lines 1074 to 1178 in ff8446c
cmssw/RecoTracker/LSTCore/src/alpaka/Quintuplet.h Lines 1245 to 1349 in ff8446c
|
See PR #97 cmssw/RecoTracker/LSTCore/src/alpaka/PixelQuintuplet.h Lines 852 to 878 in ff8446c
cmssw/RecoTracker/LSTCore/src/alpaka/Quintuplet.h Lines 532 to 565 in ff8446c
cmssw/RecoTracker/LSTCore/src/alpaka/PixelTriplet.h Lines 726 to 754 in ff8446c
|
PR #98 addresses some of the above, with a 60% speedup on GPU for MD creation. |
Hi Gavin, for these chi-square function, they are doing chi2 based on x-y plane and radius calculations. I think those can be merged, just the input number of MDs need to be changed. |
To simplify the code, we should remove the extensive use of code duplication (copy-paste).
Here is a gist showing some of the current duplication, automatically generated with PMD. Not all of these are meaningful duplications, but it catches many obvious repeats:
https://gist.github.com/GNiendorf/fd4fe952f38149b5bfd1269a7039370e
This was generated with the following:
1. Download PMD
wget https://github.com/pmd/pmd/releases/download/pmd_releases%2F7.5.0/pmd-dist-7.5.0-bin.zip
2. Extract the PMD archive
unzip pmd-dist-7.5.0-bin.zip -d pmd-dist
3. Navigate to the PMD bin directory
cd pmd-dist/pmd-bin-7.5.0/bin
4. Create a list of .cc and .h files in specific directories
find
CMSSW_14_1_0_pre3/src/RecoTracker/LSTCore/interface/alpaka
CMSSW_14_1_0_pre3/src/RecoTracker/LSTCore/interface
CMSSW_14_1_0_pre3/src/RecoTracker/LSTCore/src/alpaka
CMSSW_14_1_0_pre3/src/RecoTracker/LSTCore/src
CMSSW_14_1_0_pre3/src/RecoTracker/LSTCore/standalone/bin
CMSSW_14_1_0_pre3/src/RecoTracker/LSTCore/standalone/code/core
CMSSW_14_1_0_pre3/src/RecoTracker/LSTCore/standalone/efficiency/src
-type f ( -name ".cc" -o -name ".h" ) > file_list.txt
5. Run CPD to generate the duplication report
./pmd cpd --minimum-tokens 100 --file-list file_list.txt --language cpp --format text > duplication_report.txt
The text was updated successfully, but these errors were encountered: