-
Notifications
You must be signed in to change notification settings - Fork 5
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
Move code from Celeritas into G4VG #12
Conversation
Hi, because |
@sethrj This currently cuts the dependency but does not replace the CELER_XXX macros, so the compilation fails. Are you proposing we take it from here and do the rest of the changes, using a library-local copy of these macros? Just to make sure we don't start doing the same thing on the two sides of the pond. What about the testing macros, should we protect them using some #ifdef guard? We should keep @drbenmorgan in the loop since he also has some branch doing similar stuff in his fork. |
Just for reference, my hacked "standalone" version is on this branch: https://github.com/drbenmorgan/g4vg/commits/standalone/ There are some differences in approach - I went for providing internal workarounds/translations of some of the Celeritas functionality, see https://github.com/drbenmorgan/g4vg/blob/e4b2870b833ac3a9f3d1cb39f579fc6796c5aca4/src/detail/TranslationTypes.hh I'll have a look at the changes here in more detail. |
Having had a quick look, I suspect that all the remaining build failures are down to the which I guess is similar to the header in this PR: That could therefore be expanded to cover the remaining macros/types, or do you have a different plan/ideas here @sethrj? |
I think that's about right, glad I didn't do any more since I had forgotten about your patch. I paused because I wasn't sure if we wanted to delete, copy, and/or refactor the various features... looks like you got most of it though! A few things:
|
Sounds good @sethrj - agreed that the assertions are good to have! |
@sethrj why do we need RDC in this PR since the library does not link with any cuda code? |
That's a question for @pcanal : I think it's necessary to correctly link downstream libraries against vecgeom cuda? If he confirms it's not necessary, I can remove it. |
TLDR: please use the For better or worse, keeping the CudaRdc fragment is likely the easiest solution. It might not be needed but using it might be easier/clearer. Without it, there will be only one Technically we could also 'chance' it and link Side note: the file should be updated to follow the latest update in the Celeritas repository see celeritas-project/celeritas#1487 and celeritas-project/celeritas#1489 or https://github.com/pcanal/CudaRDCExercise |
This sounds like a total overkill, given that g4vg itself does/should NOT require any linking against anything in the vecgeom::cuda namespace. g4vg should only link against libvecgeom.a ! So this library is not affected by nvlink at all, it is a pure host library ! |
Indeed, if this does not need to link against any |
My understanding is that, if nothing else, the main "vecgeom" library (when cuda is enabled) has missing symbols that can only be filled by libvecgeomcuda. Is that the only limitation? |
AFAIK this should not be the case, if it is, we are in trouble and we should fix it with the highest priority ! It is only |
@sethrj can you try in this PR to link only against |
Will do. Yes there's a standalone "smoke test" that I should be able to try... but I can't get to it today unfortunately. |
Taken as is from Celeritas implementation, renamespaced for G4VG.
@sethrj, trying this out locally before this afternoon I found a couple of compile errors from the use of VecGeom Logger. These were simple to fix, so changes are here in two commits: https://github.com/drbenmorgan/g4vg/tree/remove-celeritas-logger Important one is the second, which restricts use to VecGeom 1.2.8 or newer, as that's the version where Logger.h became available. |
Thanks @drbenmorgan . I'll pull those in (or you can push to my fork) and will try to get the CI online before our meeting today. |
//! TODO: allow client to use a different unit system (default: mm = 1) | ||
static constexpr double scale = 1; | ||
//! Value of 1mm in native unit system (0.1 for cm) | ||
double scale = 1; |
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.
Vecgeom "kind of" has a scale flag, but it's only used by VGDML. I think we should either move that flag into the vgdml loader or use it here.
P.S. @agheata @SeverinDiederichs the scale should probably be used in the "absolute" (non-relative) bump distances inside vecgeom, since otherwise loading and running the same problem at different length scales gives you different results.
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.
All good to go, so LGTM!
This improves the usability of g4vg at the cost of removing functionality and duplicating some code from celeritas. Happy to have some help from @agheata and @SeverinDiederichs .