-
Notifications
You must be signed in to change notification settings - Fork 128
Description
Describe the outcome that is desired.
Mantid currently uses multiple mechanisms to load in data. This is outlined in the following issue mantidproject/roadmap#21
These mechanisms primarily involve using the Nexus API library to load data, however this library is now unsupported. We therefore no longer want to use it, and it would be preferable to use the HDF5 API directly. This would provide us with several other benefits which were not previously available when using Nexus API, and could result in a performance improvement when loading data.
To do this switch, the following plan was discussed with @peterfpeterson and @martyngigg .
Describe any solutions you are considering
- 1. Move H5Util into the nexus subpackage Move
H5Util
file to Mantid::Nexus library #38406 - 2. Pull the Nexus c-API and cpp-API binding into the
Framework/Nexus
location in Mantid. This will not include anything other than these two languages Pull nexus library into mantid #38455- The developer package and conda recipe will need to be modified to replace nexus as a requirement with hdf4, hdf5, and whatever else is needed to make the moved version work
#import
statements in files will need to be updated- cmake will need changes
- Rather than template
napi.h.in
to allow for cmake to fill in the version, create a variantnapi.h
which has the version number that mantid bases its changes from
- 3. Remove XML, Fortran, etc. sections of this code (both files and
#ifdef
sections) and re-evaluate if any conda dependencies can be removed - 4. Move the two Muon HDF4 algorithms (
LoadMuonNexus1
andLoadMuonNexus2
) to theFramework/Muon
library to isolate them Move Muon HDF4 loaders to muon library #38477 - 5. Use HDF4 directly in the two Muon HDF4 algorithms rather than using the Nexus API. (Link HDF4 to the Muon library, and add HDF4 to the conda environment). Copy the
NexusClasses
code into theFramework/Muon
library so the version inFramework/Nexus/
can be refactored to useH5Cpp
. This also requires duplicatingNexusDescriptor
to have an hdf4-based version - 6. Use HDF4 directly in LoadLLB algorithm. This is similar to the muon algorithms Remove LoadLLB #38794
- 7. Modify code that uses
hdf5.h
directly (other thannapi5.h
) to useH5Cpp
andH5Util
Modify code that uses hdf5.h directly (other than napi5.h) to use H5Cpp and H5Util #38626 - 8.
Remove HDF4 files and#ifdef
sections of the Nexus API code within theFramework/NexusCpp
location - 9. Modify
NeXusFile
to useH5Cpp
andH5Util
directly.- Rather than having a pointer to the napi filehandle, change to a
H5Cpp
handle. Make sure to follow the rule of 5 | Scrapnapi
#39213 - Decide whether to pull in
NexusIOHelper
to be static functions
- Rather than having a pointer to the napi filehandle, change to a
- 10. Move the code that uses
napi.h
to useNeXusFile
Remove napi from NexusClasses #38791
PR Remove napi from NexusClasses #38791 had to be reverted, then was gradually reintroduced in these PRs, along with attempts to fix:- Simplify NeXus logging #38840
- Remove unused classes from NexusClasses #38843
- Hide napi.h in NexusFile.cpp #38844
- Close the file after parsing it #38846
- Revert napi lookup of HDF types from NX types #38856
- Set H5F_CLOSE_STRONG because that is how nexus does it #38866
- Change
NexusClasses
integer types #38874 - Remove napi functions from
NexusClasses
#38884
- 12. Combine
NexusDescriptor
andNexusH5Descriptor
- 13. Review the old wrappers such as
NexusFileIO
andNexusIOHelper
to understand how they are used, and where they are used (where is answered in comment on 2025-01-15 below).NexusFileIO
can likely be removed/refactored as it is only used by theSaveNexusProcessed
algorithm. - 14. (?still do?) Refactor these wrappers to simplify and make them "lightweight". Ideally, we want to use one common mechanism to load/save HDF5 data across the Mantid codebase, and this mechanism might be a very lightweight wrapper around the HDF5 library
After this work is done we are in a position to investigate what functionality we want to expose/add to improve the performance of reading/writing hdf5-based nexus files.
Things still to be decided:
- Where do the various
FileDescripttor
,NexusFileDescriptor
, andNexusHDF5FileDescriptor
go and should they have a hierarchy? - Do we still want to have objects know how to serialize/deserialize themselves to nexus? If so, should we keep the nexus subpackage unaware of mantid objects (e.g. Kernel, API)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status