MRtrix3 / containers

Developer tools for generating minified containers for MRtrix3
0 stars 2 forks source link

Reduce ANTs compilation #8

Closed Lestropie closed 4 years ago

Lestropie commented 4 years ago

Currently, both ITK5 and ANTs are compiled fully from source, only for the standalone N4BiasFieldCorrection executable to be the only file remaining after pruning. It would be preferable, if possible, to only compile that one command, as this would greatly reduce container build time.

kaczmarj commented 4 years ago

This should be possible with the --target=N4BiasFieldCorrection option in cmake. On the other hand, this seems like a premature minimization. What if other ants functionality is added to mrtrix3 in the future? I think there are other options in the cmake build for ants that can reduce compilation time -- mostly disabling tests, particularly the long tests.

Here is an example cmake command for this.

git clone ants...
cd ants
mkdir build && cd build
cmake \
    -DBUILD_ALL_ANTS_APPS:BOOL=OFF \
    -DBUILD_SHARED_LIBS:BOOL=ON \
    -DBUILD_TESTING:BOOL=OFF \
    -DCMAKE_BUILD_TYPE:STRING=Release \
    -DCMAKE_INSTALL_PREFIX:PATH=/opt/ants \
    -DRUN_LONG_TESTS:BOOL=OFF \
    -DRUN_SHORT_TESTS:BOOL=OFF \
    --target=N4BiasFieldCorrection \
    ..
make

This will not build only N4BiasFieldCorrection, though, because this program depends on other parts of the ANTs library.

Lestropie commented 4 years ago

On the other hand, this seems like a premature minimization. What if other ants functionality is added to mrtrix3 in the future?

Not too concerned about this. If a script were added to MRtrix3 that utilised some other ANTs functionality, that would have to go in a minor MRtrix3 version number update, and then it would make perfect sense to push out a corresponding new base container. Though I'd prefer to be reducing the number of external software dependencies of MRtrix3 rather than increasing. Anything that's not a compulsory step in a common processing pipeline, and utilises non-MRtrix3 commands, would be better provided as a standalone MRtrix3 "module" / "project" rather than being integrated into MRtrix3 itself.

Lestropie commented 4 years ago

Closed through #11.

Note that with MRtrix3/mrtrix3#2197, the set of ANTs commands that may be utilised by MRtrix3 commands will expand. The current plan is to create a dev branch on this repo MRtrix3/containers, which checks out the dev branch of MRtrix3, incorporates additional command tests such that those new dependencies are detected, and can genereate minified dependency tarballs for upload to OSF; once MRtrix3 experiences a merge from dev to master and tag, this branch MRtrix3/containers will also experience a merge from dev to master, with MRtrix3_GIT_COMMITISH reverted back to master.