Refactoring the new Async backend modifications #318
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The goal of this PR is to adapt the new Asynchronous AdePT components to the way the library is structured. This involves keeping a clear separation between AdePT and the integration layer.
Main changes:
Remove
AdePTConfiguration
from the integration layer.This is an utility class which holds the AdePT configuration for a run, it is part of AdePT and independent from the integration layer. However the new
AdePTConfiguration::CreateAdePTInstance
is compiled as part ofAdePTG4Integration
. In practice, this isn't a change from the previous implementation, where the integration layer has the responsability of initializingAdePTConfiguration
, and also of passing the values inAdePTConfiguration
toAdePTTransport
.This will be changed in this PR, by introducing a new
AdePTTransport
constructor which takes anAdePTConfiguration
instance as an argument. Now the integration layer is only responsible of initializingAdePTConfiguration
.AdePTConfiguration
will now also store the number of threads, which is used to compute the number of tracks and step slots allocated to each thread in synchronous mode. By doing this, we will also remove the need to store the number of slots per thread asstatic inline
variables inAdePTTransport
. This was done because in Geant4 we can only get the correct number of threads from the master, as the workers will report 1, thus we can only compute the space per thread from the master. However this is a G4-specific requirement that is not related to AdePT, so now, instead of doing that, we store the number of threads as astatic inline
variable inAdePTTrackingManager
, on the integration side, which each thread then passes on toAdePTConfiguration
.Remove the
AdePTTransportFactory
method in favour of using theAdePTTransport
constructor.This method is currently implemented as a free function that is part of the integration layer. It is called from
AdePTConfiguration::CreateAdePTInstance
.In principle, it wouldn't be an issue to keep one factory per transport backed, per integration layer, however at least for the synchronous backend there seems to be little reason to use a factory method instead the
AdePTTransport
constructor.In order to
Implement a constructor in
AdePTTransport
which takes anAdePTConfiguration
instance as an argument.In the current implementation, the integration layer is supposed to initialize
AdePTConfiguration
and also to pass those values on toAdePTTransport
. With this change, the integration layer only needs to initialize the configuration.Move the instantiation of
ShowerGPU
back to toAdePTTrackingManager.cu
.We need to instantiate
ShowerGPU
in a.cu
file so that this function is compiled bynvcc
. This is a necessary evil, and needs to be done in the integration layer since AdePT is a header-only library. This function has currently been moved toAdePTTransport.cu
, which lives on the integration layer. As with theAdePTConfiguration
change, in practice the integration layer is still responsible of doing this instantiation, it just lives on a different file. SinceAdePTTransport.cu
is not actually related toAdePTTransport
, and it isAdePTTrackingManager
that calls this function, I believe it is less misleading to keep this inAdePTTrackingManager.cu
.