Integrate Toroidal surfaces into ORANGE contruction#2427
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #2427 +/- ##
===========================================
- Coverage 87.33% 87.31% -0.02%
===========================================
Files 1401 1401
Lines 44443 44507 +64
Branches 13495 13517 +22
===========================================
+ Hits 38813 38862 +49
- Misses 4408 4417 +9
- Partials 1222 1228 +6
🚀 New features to boost your workflow:
|
Test summary 5 353 files 8 741 suites 18m 26s ⏱️ Results for commit b50220b. ♻️ This comment has been updated with latest results. |
… specifically a Torus, to better fit G4 conversion.
sethrj
left a comment
There was a problem hiding this comment.
This is looking great! I know it's not "ready" yet but I have a couple of comments: mainly let's keep this PR from altering the runtime static-polymorphic surfaces.
| ORANGE_ST_VISIT_CASE(kx); | ||
| ORANGE_ST_VISIT_CASE(ky); | ||
| ORANGE_ST_VISIT_CASE(kz); | ||
| ORANGE_ST_VISIT_CASE(tor); |
There was a problem hiding this comment.
For now let's treat this like SurfaceType::inv and prevent runtime due to the unknown impact on GPU performance.
There was a problem hiding this comment.
Right, sounds like a plan! Is forwarding/not the surface type here what allows/prevents it from compiled to the GPU kernel and impacting performance?
There was a problem hiding this comment.
Exactly. That prevents the GPU code from being compiled, and invalid surfaces are caught during construction:
celeritas/src/orange/detail/SurfacesRecordBuilder.cc
Lines 42 to 48 in c5d2318
which you could turn into:
constexpr auto st = std::remove_reference_t<decltype(s)>::surface_type();
if constexpr (st == SurfaceType::inv || st == ...)|
@osanstrong if you make a branch with runtime support I can test it very easily |
Try |
elliottbiondo
left a comment
There was a problem hiding this comment.
Looks great! It would probably be good to ray trace a torus from a GDML file as a sanity check before merging.
|
@elliottbiondo I think it would be good to do a little more analysis on the impact of enabling at runtime before activating it. Options:
I don't think it's used in any of the DUNE models: just some of the other rare event searches and the LHC detectors? |
|
@sethrj my vote is add a cmake option and merge this ASAP. @osanstrong can you look into that? Basically without the the cmake flag, the old cylindrical torus approximation would be used and the torus woudln't appear in SurfaceTypeTraits. There would be no runtime impact. I will have to dig up whatever old DUNE model had a torus. Obviously it's not a key part of the DUNE geometry, but the point is we see torii in production models. When doing performance comparisons with other codes with such models enabling torii isn't a handicap --- it's necessary for a fair comparison. |
|
One thing is that for our immediate use, even if there is a torus in there, we don't truly need it if it's not in contact with an optical material. I'd rather implement the (possibly much more effective) optimization of moving a subset of the true geometry to the gpu, over always enabling torus. |
|
Certainly as long as we are principally focused on DUNE it makes sense as a compile-time switch, but as a general-purpose tool, the default should be on. Since DUNE is so simple, I wouldn't be surprised if commenting out other surface types would bring speedup. The switch statement on surface type is a hotspot in thread divergence, and I could imagine there being a reduction in register usage as well. |
|
Toroids should now only be enabled with the preprocessor flag Speaking of which, is there a more preferred way of passing preprocessor flags than this? It had seemed like setting a boolean a la |

This PR integrates the elliptical toroid surface from #2158 into ORANGE construction features to allow loading toroids (specifically toruses) from input files such as Geant4 gdml.
It, however, does not forward the surface type or enable it at runtime, as its performance impact has not yet been analyzed.