celeritas-project / celeritas

Celeritas is a new Monte Carlo transport code designed to accelerate scientific discovery in high energy physics by improving detector simulation throughput and energy efficiency using GPUs.
https://celeritas-project.github.io/celeritas/
Other
64 stars 35 forks source link

Work around RDC-related link errors when +cuda+vecgeom~shared #1498

Closed esseivaju closed 1 week ago

esseivaju commented 1 week ago

Since #1489, a static build of Celeritas and VecGeom with CELERITAS_USE_PNG=OFF the linker probably figure out that geocel is not used by ImageWriter.test.cc, but it results in undefined symbols because we link to the VecGeom middle library. Move the inline dummy implementation if ImageWriter to its own TU to force the correct behavior.

github-actions[bot] commented 1 week ago

Test summary

 3 412 files   5 264 suites   3m 55s :stopwatch:  1 590 tests  1 562 :white_check_mark: 28 :zzz: 0 :x: 17 512 runs  17 445 :white_check_mark: 67 :zzz: 0 :x:

Results for commit 757a8738.

:recycle: This comment has been updated with latest results.

esseivaju commented 1 week ago

Sure, the problem is the linker, and this is just a way to force the linker's hand since AFAIK, Cmake doesn't have good support for passing --no-as-needed just for one library. And it'd be a different argument for static libs, --whole-archive? That's probably not worth adding some CMake complexity, so yeah, let's just disable that test in that specific scenario.

pcanal commented 1 week ago

a static build of Celeritas and VecGeom ... the linker probably figure out that geocel is not used... but it results in undefined symbols because we link to the VecGeom middle library.

This sounds odd. Presumably the link line has both geocel_final.a and the "VecGeom middle library" why would it ignore/drop one but not the other?

esseivaju commented 1 week ago

It is pretty odd indeed, I don't know why the linker is acting that way. Unfortunately, Perlmutter is down today so I can't check the link line but I'm pretty sure it was indeed linking against libvecgeomcuda_static.