OK, I’m really stumped. I’ve just tried to compile a version here with OpenMP support, and sure enough, libomp.so
shows up in the list:
$ ldd bin/mraverageheader
linux-vdso.so.1 (0x00007ffc459e5000)
libmrtrix.so => /home/donald/exp/mrtrix3/bin/../lib/libmrtrix.so (0x00007f3dbe200000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f3dbde00000)
libm.so.6 => /usr/lib/libm.so.6 (0x00007f3dbe118000)
libomp.so => /usr/lib/libomp.so (0x00007f3dbdcef000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f3dbe569000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007f3dbdb08000)
/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f3dbe661000)
libz.so.1 => /usr/lib/libz.so.1 (0x00007f3dbe54d000)
libtiff.so.5 => /usr/lib/libtiff.so.5 (0x00007f3dbe083000)
libpng16.so.16 => /usr/lib/libpng16.so.16 (0x00007f3dbe04a000)
libzstd.so.1 => /usr/lib/libzstd.so.1 (0x00007f3dbda5f000)
liblzma.so.5 => /usr/lib/liblzma.so.5 (0x00007f3dbda35000)
libjpeg.so.8 => /usr/lib/libjpeg.so.8 (0x00007f3dbd9b2000)
If I uninstall OpenMP and try to run that command, it immediately fails to run no matter what:
$ bin/mraverageheader
bin/mraverageheader: error while loading shared libraries: libomp.so: cannot open shared object file: No such file or directory
I’ve tried to run a version without OpenMP, and that seems to work fine no matter how many inputs I give it.
I can’t find any direct use of or reference to the omp_get_max_threads
function in our code. So the best bet is it might have come from a dependency, with Eigen
being the only realistic candidate here.
So I had a look through the code in Eigen
, and the only reference I can find to that particular function (omp_get_max_threads
) is in eigen/Eigen/src/Core/products/Parallelizer.h
, line 35:
31 #ifdef EIGEN_HAS_OPENMP
32 if(m_maxThreads>0)
33 *v = m_maxThreads;
34 else
35 *v = omp_get_max_threads();
36 #else
37 *v = 1;
38 #endif
which wouldn’t be included unless EIGEN_HAS_OPENMP
is defined, and that is only defined if OpenMP is present and EIGEN_DONT_PARALLELIZE
is not defined (eigen/Eigen/Core
, line 262):
261 #if (defined _OPENMP) && (!defined EIGEN_DONT_PARALLELIZE)
262 #define EIGEN_HAS_OPENMP
263 #endif
and EIGEN_DONT_PARALLELIZE
is always set if configure runs without -openmp
(configure
, line 969):
968 if not openmp:
969 eigen_cflags += [ '-DEIGEN_DONT_PARALLELIZE' ]
What’s also weird is that the message you get suggests that the omp_get_max_threads
is referenced in the MRtrix library (lib/libmrtrix.so
). There’s a (faint) chance the library was compiled with OpenMP, and the rest of the executables weren’t (it would be very weird though). In any case, you can double-check whether that function is indeed referenced in the library with this command:
nm /software/software/MRtrix/3.0.3-foss-2021a/lib/libmrtrix.so | grep omp_get_max_threads
If that shows anything, that might point to some strange mismatch in there. Maybe if you also run:
ldd /software/software/MRtrix/3.0.3-foss-2021a/lib/libmrtrix.so
and spot libomp.so
in the output, that might reinforce that conclusion.
If this was built from source, you might also still have the build config file available, it would be useful to inspect that. It it’s still there, I suspect this might dump its contents (long shot though):
cat /software/software/MRtrix/3.0.3-foss-2021a/config
If you do find traces of OpenMP in the library, I think my best advice would be to clean build the lot from scratch…