[CMake] [EXTERNAL] A required library with BLAS API not found.

Maxime Boissonneault maxime.boissonneault at clumeq.ca
Wed Apr 4 16:48:39 EDT 2012


The point of CMake is to not have to specify all of these directories 
(blas dir, lapack dir, name of the library, etc.).

After messing around quite a bit, I found out that if I add "pthread" at 
the end of line 533 of FindBLAS.cmake, it solves the problem and cmake 
finds all it needs (blas and lapack).
It seems that cmake finds the library, but its trycompile test fails 
because it does not link with all the required libraries (it's missing 
pthread).

This works for my mkl/10.2.2.025, but it does not work for mkl/10.3.4.

I think this should be fixed in FindBLAS.cmake!


Best,

Maxime Boissonneault


Le 12-04-04 16:43, Mitchell, John A a écrit :
>   I'm not totally sure what the issue is you are having.  Make sure that you have your 'intel' environment set up.  See my .bashrc snippet below.
>
> It may be as simple as not having an include directory defined in your CMakeLists.txt file(s).
>
> Getting MKL hooked up can be something of a pain.    For what its worth, here is how I have recently made this work.
>
>
> In my .bashrc file:
>
> export MKLROOT=/opt/intel/mkl
> export MKLPATH=$MKLROOT/lib/intel64
> export MKLINCLUDE=$MKLROOT/include
> source ${MKLROOT}/bin/mklvars.sh intel64
>
> In my shell script that launches cmake:
>
> # Blas/Lapack
>
> LAPACK_LIB_DIRS=$MKLPATH
> BLAS_LIB_DIRS=$MKLPATH
>
>
> In the actual cmake command:
>
> cmake ...(whatever other command you have) \
>           -D BLAS_LIBRARY_DIRS:PATH=$BLAS_LIB_DIRS \
>           -D LAPACK_LIBRARY_DIRS:PATH=$LAPACK_LIB_DIRS \
> ....
>
> In my CMakeLists.txt file:
>
>      # Blas and Lapack Libraries
>      find_library(Blas_LIBRARY
>        NAMES mkl_blas95_lp64
>        PATHS ${BLAS_LIBRARY_DIRS}
>      )
>      find_library(Lapack_LIBRARY
>        NAMES mkl_lapack95_lp64
>        PATHS ${LAPACK_LIBRARY_DIRS}
>      )
>      set(BlasLapack_Libraries mkl_blas95_lp64 mkl_lapack95_lp64)
>
>
>
>
>
>
>
> ________________________________________
> From: cmake-bounces at cmake.org [cmake-bounces at cmake.org] on behalf of Maxime Boissonneault [maxime.boissonneault at clumeq.ca]
> Sent: Wednesday, April 04, 2012 2:28 PM
> To: cmake at cmake.org
> Subject: [EXTERNAL] [CMake] A required library with BLAS API not found.
>
> Hi,
> I am trying to compile a code with cmake on a cluster. However, whatever
> I do, cmake can not seem to find BLAS, even though BLAS is definitely
> installed (MKL version) and in my LD_LIBRARY_PATH.
>
> Please help!
>
> Below is the output of a few commands, with the cmake output.
>
> Thanks,
>
> Maxime Boissonneault
>
>
> [mboisson at colosse1 squack-code]$ echo $LD_LIBRARY_PATH
> /software/intel/mkl/10.2.2.025/lib/em64t:/software/intel/Compiler/11.1.059/lib/intel64:/software/misc-libs/gsl/1.15_gcc/lib
> [mboisson at colosse1 squack-code]$ ls /software/intel/mkl/10.2.2.025/lib/em64t
> libguide.a                      libmkl_blacs_intelmpi_lp64.so
> libmkl_core.a         libmkl_intel_ilp64.a
> libmkl_lapack95_lp64.a     libmkl_scalapack_lp64.a
> libmkl_vml_def.so
> libguide.so                     libmkl_blacs_lp64.a
> libmkl_core.so        libmkl_intel_ilp64.so
> libmkl_lapack.so           libmkl_scalapack_lp64.so
> libmkl_vml_mc2.so
> libiomp5.a                      libmkl_blacs_openmpi_ilp64.a
> libmkl_def.so         libmkl_intel_lp64.a
> libmkl_mc3.so              libmkl_sequential.a
> libmkl_vml_mc3.so
> libiomp5.so                     libmkl_blacs_openmpi_lp64.a
> libmkl_gf_ilp64.a     libmkl_intel_lp64.so
> libmkl_mc.so               libmkl_sequential.so
> libmkl_vml_mc.so
> libmkl_avx.so                   libmkl_blacs_sgimpt_ilp64.a
> libmkl_gf_ilp64.so    libmkl_intel_sp2dp.a
> libmkl_p4n.so              libmkl_solver_ilp64.a
> libmkl_vml_p4n.so
> libmkl_blacs_ilp64.a            libmkl_blacs_sgimpt_lp64.a
> libmkl_gf_lp64.a      libmkl_intel_sp2dp.so
> libmkl_pgi_thread.a        libmkl_solver_ilp64_sequential.a  locale
> libmkl_blacs_intelmpi_ilp64.a   libmkl_blas95_ilp64.a
> libmkl_gf_lp64.so     libmkl_intel_thread.a
> libmkl_pgi_thread.so       libmkl_solver_lp64.a
> libmkl_blacs_intelmpi_ilp64.so  libmkl_blas95_lp64.a
> libmkl_gnu_thread.a   libmkl_intel_thread.so
> libmkl_scalapack_ilp64.a   libmkl_solver_lp64_sequential.a
> libmkl_blacs_intelmpi_lp64.a    libmkl_cdft_core.a
> libmkl_gnu_thread.so  libmkl_lapack95_ilp64.a
> libmkl_scalapack_ilp64.so  libmkl_vml_avx.so
>
> [mboisson at colosse1 squack-code]$ cmake .
> -- CMAKE_INSTALL_PREFIX = /usr/local
> -- Looking for sgemm_
> -- Looking for sgemm_ - not found
> CMake Error at
> /software/tools/cmake/2.8.7/share/cmake-2.8/Modules/FindBLAS.cmake:612
> (message):
>     A required library with BLAS API not found.  Please specify library
>     location.
> Call Stack (most recent call first):
>     CMakeLists.txt:24 (FIND_PACKAGE)
>
>
> -- Configuring incomplete, errors occurred!
> [mboisson at colosse1 squack-code]$
>
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
>


-- 
---------------------------------
Maxime Boissonneault
Professionnel de recherche - CLUMEQ
Ph. D. en physique



More information about the CMake mailing list