DIPlib / diplib

Quantitative Image Analysis in C++, MATLAB and Python
https://diplib.org
Apache License 2.0
228 stars 50 forks source link

HPC library compilation problem #141

Closed AndreZeug closed 11 months ago

AndreZeug commented 11 months ago

Hi I tried to compile DIPimage on a HPC cluster which is configured as a SLURM & MODULE system.

I tried to follow the instructions on Building the DIPlib project on Linux and tried to translate it to the HPC system

INSTALLATION module use /project/usr/apps/modules/zen2/all # specific command to make more specific modules available to check for appropriate modules use module avail or module spider MATLAB or so. module load MATLAB CMake GCC git Python # load modules required

I used a specific location cd /project/cnp/

mkdir srcDIPlib
cd srcDIPlib/
git clone https://github.com/DIPlib/diplib.git

mkdir target
cd target

Building

mkdir /project/cnp/DIPlib
cmake .. -DCMAKE_INSTALL_PREFIX=/project/cnp/DIPlib |& tee -a DIPlip_cmake.log

DIPlip_cmake.log

Please note, in case I load the modules in different order module load CMake GCC git Python MATLAB I receive the following error (will be of importance later):

cmake .. -DCMAKE_INSTALL_PREFIX=/project/cnp/DIPlib |& tee -a DIPlip_cmake.log
/project/usr/apps/software/zen2/software/CMake/3.23.1-GCCcore-11.3.0/bin/cmake: /project/usr/apps/software/noarch/software/MATLAB/2022a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /project/usr/apps/software/zen2/software/CMake/3.23.1-GCCcore-11.3.0/bin/cmake)

make -j check |& tee -a DIPlip_make_check.log produces some errors which are hopefully marginal DIPlip_make_check.log

make -j install |& tee -a DIPlip_make_install.log runs smoothly DIPlip_make_install.log

THE PROBLEM running MATLAB and e.g. calling dipimage causes the following error

>> dipimage
Warning: Call to DIPMENUS failed:

Invalid MEX-file '/project/cnp/DIPlib/share/DIPimage/measure.mexa64': /project/usr/apps/software/noarch/software/MATLAB/2022a/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /project/cnp/DIPlib/share/DIPimage/measure.mexa64)

Invalid MEX-file '/project/cnp/DIPlib/share/DIPimage/private/numberofthreads.mexa64':
/project/usr/apps/software/noarch/software/MATLAB/2022a/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by
/project/cnp/DIPlib/share/DIPimage/private/../../../lib/libDIP.so)

Error in dippreferences (line 76)
      'NumberOfThreads',         struct('type','integer','value',numberofthreads),...

Error in dipgetpref (line 51)
      pref = dippreferences('get',name);

Error in dipinit (line 38)
dipinit_ws = [dipgetpref('DefaultFigureWidth'),dipgetpref('DefaultFigureHeight')];

Error in dipimage/do_start (line 111)
   evalin('base','dipinit');

Error in dipimage (line 48)
   do_start;

produces the same error as above. I will ask HPC IT specialists (next year 🥳) if they have a clever idea. But in case someone has experience...

Component DIPlib

System information:

ver
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.12.0.1956245 (R2022a) Update 2
MATLAB License Number: 40567690
Operating System: Linux 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
MATLAB                                                Version 9.12        (R2022a)
Simulink                                              Version 10.5        (R2022a)
5G Toolbox                                            Version 2.4         (R2022a)
AUTOSAR Blockset                                      Version 2.6         (R2022a)
Aerospace Blockset                                    Version 5.2         (R2022a)
Aerospace Toolbox                                     Version 4.2         (R2022a)
Antenna Toolbox                                       Version 5.2         (R2022a)
Audio Toolbox                                         Version 3.2         (R2022a)
Automated Driving Toolbox                             Version 3.5         (R2022a)
Bioinformatics Toolbox                                Version 4.16        (R2022a)
Bluetooth Toolbox                                     Version 1.0         (R2022a)
Communications Toolbox                                Version 7.7         (R2022a)
Computer Vision Toolbox                               Version 10.2        (R2022a)
Control System Toolbox                                Version 10.11.1     (R2022a)
Curve Fitting Toolbox                                 Version 3.7         (R2022a)
DDS Blockset                                          Version 1.2         (R2022a)
DIPimage toolbox for quantitative image analysis      Version 3.4.1               
...
crisluengo commented 11 months ago

This looks to be an incompatibility of GCC libraries. This issue is described here: https://diplib.org/diplib-docs/building_linux.html#linux_matlab_gcc

Fixing this on a cluster machine might be more difficult, you certainly will need the assistance of an admin. Unless they’ve already installed a version of GCC compatible with MATLAB, and all you need to do is configure the system to use it (module load GCC_10 or whatever). MATLAB R2022a is compatible with GCC 7 through 10. https://www.mathworks.com/content/dam/mathworks/mathworks-dot-com/support/sysreq/files/system-requirements-release-2022a-supported-compilers.pdf

AndreZeug commented 11 months ago

Finally succeed after some testing different modules and strategies grafik

Installing the right way clone the git and crate folders required

cd /project/cnp/
mkdir srcDIPlib
cd srcDIPlib/

module load git
git clone https://github.com/DIPlib/diplib.git
module purge

cd diplib
mkdir target
cd target

mkdir /project/cnp/DIPlib

checking for the right version of modules for compilation:

module avail
module spider CMake

In my case:

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  CMake:
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Description:
      CMake, the cross-platform, open-source build system. CMake is a family of tools designed to build, test and package software.

     Versions:
        CMake/3.11.4-GCCcore-7.3.0
        CMake/3.12.1-GCCcore-7.3.0
        CMake/3.15.3-GCCcore-8.3.0
        CMake/3.18.4-GCCcore-10.2.0
        CMake/3.21.1-GCCcore-11.2.0
        CMake/3.23.1-GCCcore-11.3.0

The version CMake/3.18.4-GCCcore-10.2.0 did not work in my case

module load CMake/3.15.3-GCCcore-8.3.0 MATLAB
cmake .. -DCMAKE_INSTALL_PREFIX=/project/cnp/DIPlib     |& tee -a DIPlip_cmake.log
make -j check                           |& tee -a DIPlip_make_check.log
make -j install                         |& tee -a DIPlip_make_install.log

finally I did put /project/cnp/DIPlib/share/DIPimage to the matlab path and could run matlab and use dipimage

crisluengo commented 11 months ago

I'm glad you got it to work!

Thank you for giving the details here, it'll be helpful to others.