-
Notifications
You must be signed in to change notification settings - Fork 35
Fix leaks in asynchronous mode #358
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
base: master
Are you sure you want to change the base?
Fix leaks in asynchronous mode #358
Conversation
Can one of the admins verify this patch? |
This PR introduces a new feature for the async mode: `/adept/FinishLastNParticlesOnCPU`. It is not complete yet, as they are currently just killed and not pushed to the CPU, as this will require #358 to work and be merged. Still, killing the last N particles can currently be used to assess some performance bottlenecks with the magnetic field. Also, a timer is added to the printout of the async printouts. This allows for the plotting the numbers of flight vs time and not just only vs iterations, as this severely skews it towards the fast iterations at the tail: <img width="637" alt="Screenshot 2025-03-16 at 10 45 45" src="https://github.com/user-attachments/assets/b09065a3-567f-4e92-8528-95d60ff3b772" />
479f247
to
2e750f5
Compare
CMakeLists.txt
Outdated
@@ -42,6 +42,12 @@ set(CMAKE_CUDA_STANDARD_REQUIRED ${CMAKE_CXX_STANDARD_REQUIRED}) | |||
set(CMAKE_CUDA_EXTENSIONS OFF) | |||
set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON) | |||
|
|||
|
|||
# DEBUG | |||
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -g") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can I interest you in our builds with no-omit-framepointer enabled in the compiler (gcc14fp)?
e9b1bcc
to
b7cc64e
Compare
cb95f24
to
0c93dda
Compare
fd5cef9
to
e5b4da4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thank you for this big effort! See minor comments below
file(COPY "${PROJECT_SOURCE_DIR}/examples/data/testEm3.gdml" DESTINATION "${PROJECT_BINARY_DIR}") | ||
set(TESTING_GDML "${PROJECT_BINARY_DIR}/testEm3.gdml") | ||
# file(COPY "${PROJECT_SOURCE_DIR}/examples/data/testEm3.gdml" DESTINATION "${PROJECT_BINARY_DIR}") | ||
# file(COPY "${PROJECT_SOURCE_DIR}/examples/data/testEm3_regions.gdml" DESTINATION "${PROJECT_BINARY_DIR}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be a leftover and should be reverted. (the commented out code was fixed and the now removed code is actually correct)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are actually not using the copied files as we give the absolute path in the scripts. I can uncomment these lines and change the path in the scripts too, both things work for me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, if it is not used, then it can be fully deleted :) I just remember the commenting being a quick fix to get rid of the problem fixed in #379
std::cout << "Run time: " << time << "\n"; | ||
G4cout << "Run time: " << time << "\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this was changed because with G4cout it didn't print the time anymore. Can you confirm it actually prints the time although it is not using std::cout?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I didn't remember which one was correct, as both were printing the time. I changed it because I thought it hadn't been updated, will revert
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If both work, then no preference from my side
This fixes the extraction of leaked tracks in Async mode. The previous extraction of leaks didn't work in most cases for two main reasons:
With these changes:
The new
ExtractStates
are the following:Idle
toExtractionRequested
when an event has requested a flush, and theirEventState
isHitsFlushed
. The number of particles in flight for that event is guaranteed to be 0 at this pointTracksNeedTransfer
, otherwise the state moves toIdle