-
Notifications
You must be signed in to change notification settings - Fork 32
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
Improve ROOT compatibility and ability to build without TPLs #104
Conversation
Alternatively (especially since we already build against ROOT) we could use PyROOT (or the root prompt if you prefer a C++ prompt :)) and yes, there is also Jupyter support. |
Is this with regard to the SWIG interfaces (#105) or the new macro? I went with SWIG because I'm familiar with all its foibles and can get an interface up and running quite quickly. I have little experience with ROOT; and when @stognini last tried to get PyROOT up and running he couldn't. So if you're up for taking some time to show us how to get started with pyroot/jupyter for interfacing to celeritas classes and data, I'd be delighted to learn :) |
@pcanal Speaking of ROOT, though: on this branch ROOT fails on the docker image but not on my mac. (I haven't tested on any other systems, but it fails on a pretty minimal build on the ubuntu image.) Digging into this now, the failure is in the geant-exporter-cat:
but looking further the first issue is in the
So first of all, the "Error"s being printed to cout are truly errors but they don't cause the test to fail. Is there a way to get errors to raise an exception, or a flag we can check somewhere in the code to make sure ROOT worked? Second, I figured out by process of elimination that linking the |
@pcanal Follow-up: I tested on RHEL8 and ROOT works both ways there. I even added the |
This indicates that the dictionary for ImportParticle was not loaded. Usually it loaded as part of shared library. (The as-needed flag can be a problem there as nothing used the symbol, they just get register via a global static initialization). The error should be detectable at run-time by checking the return value of the call to TTree::Branch. |
Yes :)
Yes, it is possible that some unusual flag as negative effects ... Which one are you thinking about. |
SetBranchAddress should also have returned an error code. |
What was the problem? |
9f1fb03
to
df107f8
Compare
This is a good point -- it might be that when the EDIT: I checked the failing case and the
Thanks! I added some checks and it appears to catch the error. Could you please take a look at my changes to make sure I'm doing it correctly or if I missed any spots? |
This makes it clearer when running tests what functionality is disabled: it shows "not run" rather than fewer tests. It also allows inclusion of the header files even when the features are disabled. The non-ROOT-specific IO routines have been moved into the main celeritas library, and the library name changed to match.
df107f8
to
46cc3b4
Compare
Root does not work well with anaconda. Simply installing python + root does work. |
There is a build of ROOT in anaconda though ... isn't that one working? |
Looks like you update all that kind of error. In addition, testing the result of TFile creation (TFile::Open) should be a kin to:
Another to check the return value of is:
|
In addition to check the return value, we can turn |
ROOT is capable of autoloading the library that contains the dictionary. In the current version this is based on the content of files with prefix The one produced by celeritas needed some improvement to work properly. Namely I see:
But I can not find any library named |
I just did not want to depend on (another) root managed by conda, and tried to make it work with an external root (either standalone build or from another package manager, such as spack). The main issue is most likely due to me trying to build root in the anaconda run-time environment, which ended up lacking information to be linked correctly. |
Changing the library name from |
It should work with dylib also.
It has to be on "a" LIBRARY_PATH since the purpose is to "discover" libraries that have not been linked to the executable. In practice LD_LIBRARY_PATH is the usually the most convenient but in fact it "just" need to be on one of the directories listed by gSystem->GetDynamicPath() and there is several way to add path there (.rootrc configuration file, LD_LIBRARY_PATH or explicit C++ calls) |
Thanks for the review @pcanal ! |
…as-project#104) * Add `CELER_NOT_CONFIGURED` macro * Remove extra link requirement for event reader test * Disable but still compile HepMC3 and ROOT tests when unconfigured * Fix public/private and implementation include * Add dockerfile script to launch local testing for an MR * Add error checking code to ROOT calls * Add necessary linker flags to force shared library link in Ubuntu This makes it clearer when running tests what functionality is disabled: it shows "not run" rather than fewer tests. It also allows inclusion of the header files even when the features are disabled. The non-ROOT-specific IO routines have been moved into the main celeritas library, and the library name changed to match.
I'm adding SWIG wrappers to celeritas (primarily for my own personal debugging/data exploration, could be useful elsewhere though), and it's better to not have to conditionally wrap files and objects based on what's configured. With this change, all the classes are defined and their headers can be included (aside from vecgeom, which we can't forward declare due to inline namespaces and macros). Tests that rely on disabled configuration issues now build but are "disabled" when running through cmake, and invoking them manually explains why they're disabled: