Search code examples
cmakecaffeatlaslinuxbrew

linuxbrew installed cmake on a cluster cannot find lib in /usr/lib64


I'm trying to build caffe on a GGPU cluster. I've installed a lot of dependencies in a subfolder of my home using linuxbrew. One of those dependencies is an updated version of cmake(needed).

When i launch the command

cmake ..

i get this output

-- Boost version: 1.59.0
-- Found the following Boost libraries:
--   system
--   thread
--   filesystem
-- Found gflags  (include: /home/cgvg/.linuxbrew/include, library: /home/cgvg/.linuxbrew/lib/libgflags.so)
-- Found glog    (include: /home/cgvg/.linuxbrew/include, library: /home/cgvg/.linuxbrew/lib/libglog.so)
-- Found PROTOBUF Compiler: /home/cgvg/.linuxbrew/bin/protoc
-- Found lmdb    (include: /home/cgvg/.linuxbrew/include, library: /home/cgvg/.linuxbrew/lib/liblmdb.a)
-- Found LevelDB (include: /home/cgvg/.linuxbrew/include, library: /home/cgvg/.linuxbrew/lib/libleveldb.so)
-- Found Snappy  (include: /home/cgvg/.linuxbrew/include, library: /home/cgvg/.linuxbrew/lib/libsnappy.so)
-- CUDA detected: 7.5
-- Automatic GPU detection failed. Building for all known architectures.
-- Added CUDA NVCC flags for: sm_20 sm_21 sm_30 sm_35 sm_50
-- OpenCV found (/home/cgvg/sottile/opencv/share/OpenCV)
CMake Error at /home/cgvg/.linuxbrew/Cellar/cmake/3.4.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
  Could NOT find Atlas (missing: Atlas_LAPACK_LIBRARY)
Call Stack (most recent call first):
  /home/cgvg/.linuxbrew/Cellar/cmake/3.4.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
  cmake/Modules/FindAtlas.cmake:42 (find_package_handle_standard_args)
  cmake/Dependencies.cmake:88 (find_package)
  CMakeLists.txt:38 (include)


-- Configuring incomplete, errors occurred!
See also "/home/cgvg/sottile/caffe/build/CMakeFiles/CMakeOutput.log".
See also "/home/cgvg/sottile/caffe/build/CMakeFiles/CMakeError.log".

and it seems there is nothing i can do to link the ATLAS libs correctly. The missing libs are under

/usr/lib64/atlas-sse3

Is it possible that there exists a limitation such that my linuxbrewed cmake cannot link to upper folders?

In the error message it says that:

cmake/Modules/FindAtlas.cmake:42

I tried to modify that file adding the correct paths:

set(Atlas_INCLUDE_SEARCH_PATHS
  /usr/include
  $ENV{Atlas_ROOT_DIR}
  $ENV{Atlas_ROOT_DIR}/include
)

set(Atlas_LIB_SEARCH_PATHS
  /usr/lib64/atlas
  /usr/lib64/atlas-sse3 
  $ENV{Atlas_ROOT_DIR}
  $ENV{Atlas_ROOT_DIR}/lib
)

and nothing happened.

i tried to change the PATH and LD_LIBRARY_PATH:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib64/atlas-sse3
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/include/atlas-x86_64-base-sse3/

and nothing happened.

I'm not a linux veteran so i apologize if i missed some important information. Any suggestion is appreciated.

EDIT: this is the content of /usr/lib64/atlas3-sse3:

libatlas.a       libcblas.so.3.0    libf77blas.so.3.0  libptcblas.so.3
libatlas.so      libclapack.so      liblapack.a        libptcblas.so.3.0
libatlas.so.3    libclapack.so.3    liblapack.so       libptf77blas.a
libatlas.so.3.0  libclapack.so.3.0  liblapack.so.3     libptf77blas.so
libcblas.a       libf77blas.a       liblapack.so.3.0   libptf77blas.so.3
libcblas.so      libf77blas.so      libptcblas.a       libptf77blas.so.3.0
libcblas.so.3    libf77blas.so.3    libptcblas.so
libatlas.a       libcblas.so.3.0    libf77blas.so.3.0  libptcblas.so.3
libatlas.so      libclapack.so      liblapack.a        libptcblas.so.3.0
libatlas.so.3    libclapack.so.3    liblapack.so       libptf77blas.a
libatlas.so.3.0  libclapack.so.3.0  liblapack.so.3     libptf77blas.so
libcblas.a       libf77blas.a       liblapack.so.3.0   libptf77blas.so.3
libcblas.so      libf77blas.so      libptcblas.a       libptf77blas.so.3.0
libcblas.so.3    libf77blas.so.3    libptcblas.so

Solution

  • It seems that lapack is bundled in atlas, for this reason FindAtlas.cmake is not able to find alapack_r, alapck or lapack_atlas.

    It is enough to edit caffe_folder/cmake/Module/FindAtlas.cmake, look for Atlas_LAPACK_LIBRARY NAMES and add clapack to the list of libs.

    It completely solve the problem.