Mac OS Installation

New CADET user here. I am installing on Mac OSX (10.14.6), and have built each package from source in my local CADET directory.


Source library versions:
HDF5 - 1.10.0 (CMake)
SuiteSparse - 5.8.1
Sundials - 3.2.1
SuperLU - 5.2.1

Individual libraries seem to build nicely, the final CADET build seems to be unable to find the components, but I expect some fundamental mistake. I have used all export calls prior to the build:

export HDF5_ROOT=/Users/Andy/Desktop/CADET/Libs/hdf5
export SUNDIALS_ROOT=/Users/Andy/Desktop/CADET/Libs/sundials
export SUPERLU_ROOT=/Users/Andy/Desktop/CADET/Libs/superlu
export UMFPACK_ROOT=/Users/Andy/Desktop/CADET/Libs/suitesparse
export MATLAB_ROOT=/Applications/

Build call:
cmake -DCMAKE_INSTALL_PREFIX="/Users/Andy/Desktop/CADET/cadet" …/code/

I have attached the output for the cmake and make calls.

Thanks for any help!

Cmake.txt (8.4 KB)
make.txt (19.7 KB)

There are several problems:

  • CMake doesn’t find HDF5. This is a critical problem if you’re planning to use CADET via Python, which we recommend.
  • CMake doesn’t find UMFPACK / SuiteSparse. This one is not critical since it correctly finds SuperLU.
  • The OpenBLAS LAPACK implementation needs some additional libraries. This actually produces the errors when running the make command.

Instead of using OpenBLAS, you can try Apple’s LAPACK library by adding the flag -DBLA_VENDOR=Apple to the cmake call:

cmake -DBLA_VENDOR=Apple -DCMAKE_INSTALL_PREFIX="/Users/Andy/Desktop/CADET/cadet" ../code/

I’d also suggest to install Intel TBB for parallelization. Unfortunately, this is missing in the instructions file. You don’t need to compile it. Just get a release from it’s GitHub repository.

In order to further debug why CMake doesn’t find HDF5, please post the directory structure of /Users/Andy/Desktop/CADET/Libs/hdf5.
Similarly, if you want to use UMFPACK as well, please also post the structure of /Users/Andy/Desktop/CADET/Libs/suitesparse.

If you only want to use CADET via Matlab (not recommended), you can disable some parts of the software:

1 Like

Thanks Sam.

I have attached the directory structures for hdf5 and suitsparse. Hopefully there is something simple there. I’ve also now downloaded the TBB source and placed it in the Libs directory. Upon running cmake specifying LAPACK as you suggested TBB is not found. Updated cmake output also attached.

Thank you again!
Screen Shot 2020-07-20 at 3.35.36 PM Cmake.txt (7.0 KB)

This looks much better. The HDF5 directory structure is a little bit weird, but we can account for that.

I’ve downloaded TBB release 2020_U3 (file tbb-2020.3-mac.tgz) and, after extraction, get a folder tbb-2020.3-mac, which contains the subfolders tbb and pstl. I assume that you’ve copied tbb-2020.3-mac into CADET/Libs.

Hopefully, the following works:

export HDF5_ROOT=/Users/Andy/Desktop/CADET/Libs/hdf5/HDF_Group/HDF5/1.10.0
export SUNDIALS_ROOT=/Users/Andy/Desktop/CADET/Libs/sundials
export SUPERLU_ROOT=/Users/Andy/Desktop/CADET/Libs/superlu
export UMFPACK_ROOT=/Users/Andy/Desktop/CADET/Libs/suitesparse
export MATLAB_ROOT=/Applications/
export TBB_ROOT=/Users/Andy/Desktop/CADET/Libs/tbb-2020.3-mac/tbb

cmake -DBLA_VENDOR=Apple -DCMAKE_INSTALL_PREFIX="/Users/Andy/Desktop/CADET/cadet" ../code/
make install

You may need to clear CADET/build before running the commands. This will erase CMake caches.

Seems we’re getting there but not quite. All performed as above. New output attached.

Cmake.txt (9.2 KB)
make.txt (36.6 KB)

Indeed, we’re almost there. The problem is some HDF5 library (zlib for compression of datasets) that is not found by CMake.

CMake tries to detect if HDF5 needs additional libraries for compression (szip and zlib). It has found szip, but apparently has not detected zlib.

Please post the contents of the folder /Users/Andy/Desktop/CADET/Libs/hdf5/HDF_Group/HDF5/1.10.0/lib/.

CMake looks for a file named libzlib.a or zlib.a. If there’s a file libz.a in the folder mentioned above, please change the line (near line 324)

find_library(HDF5_ZLIB NAMES libzlib zlib PATHS ${HDF5_LIBRARY_DIRS})

in the top-level CMakeLists.txt to

find_library(HDF5_ZLIB NAMES libzlib zlib libz z PATHS ${HDF5_LIBRARY_DIRS})

Made this change (in the top-level Cmakelists.txt within CADET/code), but it did not allow cmake to find hdf5.

cmake output and structure for: /Users/Andy/Desktop/CADET/Libs/hdf5/HDF_Group/HDF5/1.10.0/lib/

Cmake.txt (9.1 KB) attached.

That’s weird. It should definitely not lose HDF5 since the changed CMake code is executed after HDF5 has been found. Please make sure that you’re following the procedure in this reply. Also, clear the build directory before executing the cmake command.

If you’re running CMake version 3.17 or greater, please run

cmake --debug-find -DBLA_VENDOR=Apple -DCMAKE_INSTALL_PREFIX="/Users/Andy/Desktop/CADET/cadet" ../code/

and, additionally, post the CMakeError.log and CMakeOutput.log files from the CADET/build/CMakeFiles directory.

I think the problem was actually that my default command line version of CMake had been 3.14. Ensuring 3.18 was evoked has permitted the build. Thanks!

This may be a question for a separate thread, but if I now try to run the breakthroughLangmuirSingle.m example, the MEX interface appears to fail as I get an empty simulator object i.e. without a create() method.

Interesting. So we should consider bumping up the required CMake version. Thanks for figuring this out!

Please run MexSimulator() in the Matlab command window. This should print some error messages.

Glad it worked. The call to MexSimulator() does throw some errors loading the binary:

Invalid MEX-file ‘/Users/Andy/Desktop/CADET/cadet/matlab/bin/CadetMex.mexmaci64’:
dlopen(/Users/Andy/Desktop/CADET/cadet/matlab/bin/CadetMex.mexmaci64, 6): Library not loaded: @rpath/libtbb_preview.dylib

Referenced from: /Users/Andy/Desktop/CADET/cadet/matlab/bin/CadetMex.mexmaci64
Reason: image not found

Error in MexSimulator (line 137)
obj.mexHandle = CadetMex(‘create’);

This means that libtbb_preview.dylib wasn’t found. You can try to fix this by running

install_name_tool -add_rpath @loader_path/. CadetMex.mexmaci64

on the CadetMex.mexmaci64 file in the bin folder of the Matlab interface.
Then, copy the libtbb_preview.dylib file from /Users/Andy/Desktop/CADET/Libs/tbb-2020.3-mac/tbb/lib to the bin folder where CadetMex.mexmaci64 is located.

I believe all has been sorted. Thank you again!