MantisBT - CMake
View Issue Details
0013509CMakeCMakepublic2012-09-03 07:092016-06-10 14:31
Bogdan Cristea 
Kitware Robot 
highmajoralways
closedmoved 
PC x86_64 AthlonopenSUSE12.1
CMake 2.8.6 
 
0013509: FindBLAS.cmake cannot find acml5.1.0
ACML5.1.0 was installed in the default location (/opt). Using
cmake ..
does not find ACML library. When using
cmake .. -DBLA_VENDOR=ACML
the following error message is generated:

-- A library with BLAS API not found. Please specify library location.
                                                                                                                     │CMake Error at cmake/Modules/FindBLAS.cmake:295 (list):
                                                                                                                     │ list index: 0 out of range (-0, 18446744073709551615)
                                                                                                                     │Call Stack (most recent call first):
                                                                                                                     │ cmake/Modules/FindLAPACK.cmake:140 (find_package)
                                                                                                                     │ CMakeLists.txt:29 (find_package)
- Install cmake 2.8.6
- Install ACML5.1.0 for Linux
- Create a CMakeLists.txt file in order to detect blas library: find_package(BLAS)
- Create a folder build below the folder containing CMakeLists.txt
- Change folder to build and use 'cmake ..'
FindLAPACK is also affected by this bug.
No tags attached.
patch FindBLAS.cmake.patch (1,332) 2012-09-03 07:09
https://public.kitware.com/Bug/file/4448/FindBLAS.cmake.patch
? FindBLAS.cmake.newpatch (1,307) 2012-09-03 15:25
https://public.kitware.com/Bug/file/4452/FindBLAS.cmake.newpatch
patch FindBLAS.cmake.new2.patch (2,043) 2012-09-08 17:22
https://public.kitware.com/Bug/file/4467/FindBLAS.cmake.new2.patch
patch FindBLAS.cmake.new3.patch (1,355) 2012-09-09 15:29
https://public.kitware.com/Bug/file/4473/FindBLAS.cmake.new3.patch
log CMakeError.log (6,483) 2012-09-10 10:11
https://public.kitware.com/Bug/file/4475/CMakeError.log
log CMakeError_atlas.log (1,711) 2012-09-10 14:34
https://public.kitware.com/Bug/file/4476/CMakeError_atlas.log
Issue History
2012-09-03 07:09Bogdan CristeaNew Issue
2012-09-03 07:09Bogdan CristeaFile Added: FindBLAS.cmake.patch
2012-09-03 13:59Rolf Eike BeerNote Added: 0030823
2012-09-03 15:25Bogdan CristeaFile Added: FindBLAS.cmake.newpatch
2012-09-03 15:29Bogdan CristeaNote Added: 0030825
2012-09-03 16:52Rolf Eike BeerAssigned To => Alexey Ozeritsky
2012-09-03 16:52Rolf Eike BeerStatusnew => assigned
2012-09-04 03:24Alexey OzeritskyStatusassigned => acknowledged
2012-09-08 17:21Bogdan CristeaNote Added: 0030960
2012-09-08 17:22Bogdan CristeaFile Added: FindBLAS.cmake.new2.patch
2012-09-09 15:06Alexey OzeritskyNote Added: 0030970
2012-09-09 15:16Alexey OzeritskyFile Added: FindBLAS.cmake.new3.patch
2012-09-09 15:16Alexey OzeritskyNote Added: 0030971
2012-09-09 15:18Alexey OzeritskyFile Deleted: FindBLAS.cmake.new3.patch
2012-09-09 15:18Alexey OzeritskyFile Added: FindBLAS.cmake.new3.patch
2012-09-09 15:28Alexey OzeritskyFile Deleted: FindBLAS.cmake.new3.patch
2012-09-09 15:29Alexey OzeritskyFile Added: FindBLAS.cmake.new3.patch
2012-09-10 08:56Bogdan CristeaNote Added: 0030975
2012-09-10 08:58Bogdan CristeaNote Edited: 0030975bug_revision_view_page.php?bugnote_id=30975#r819
2012-09-10 09:30Alexey OzeritskyNote Added: 0030976
2012-09-10 09:45Bogdan CristeaNote Added: 0030977
2012-09-10 09:46Bogdan CristeaNote Edited: 0030977bug_revision_view_page.php?bugnote_id=30977#r821
2012-09-10 09:53Bogdan CristeaNote Edited: 0030977bug_revision_view_page.php?bugnote_id=30977#r822
2012-09-10 10:03Alexey OzeritskyNote Added: 0030978
2012-09-10 10:10Bogdan CristeaNote Added: 0030979
2012-09-10 10:11Bogdan CristeaFile Added: CMakeError.log
2012-09-10 10:17Bogdan CristeaNote Added: 0030980
2012-09-10 10:19Alexey OzeritskyNote Added: 0030981
2012-09-10 10:22Bogdan CristeaNote Added: 0030982
2012-09-10 10:54Alexey OzeritskyNote Added: 0030983
2012-09-10 10:54Alexey OzeritskyNote Edited: 0030983bug_revision_view_page.php?bugnote_id=30983#r824
2012-09-10 13:41Bogdan CristeaNote Added: 0030984
2012-09-10 14:05Alexey OzeritskyNote Added: 0030985
2012-09-10 14:34Bogdan CristeaFile Added: CMakeError_atlas.log
2012-09-10 14:38Bogdan CristeaNote Added: 0030986
2013-05-13 13:52Brad KingAssigned ToAlexey Ozeritsky =>
2013-05-13 13:52Brad KingStatusacknowledged => backlog
2013-05-13 13:52Brad KingNote Added: 0033030
2016-06-10 14:28Kitware RobotNote Added: 0042111
2016-06-10 14:28Kitware RobotStatusbacklog => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:28Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0030823)
Rolf Eike Beer   
2012-09-03 13:59   
Just 2 stylistic nitpicks:

-for the first change, does "if (_libraries_work)" work? It should do the same as your construct

-directly below your second change is another "if (_ACML_ROOT)", please put your code for this in the existing if
(0030825)
Bogdan Cristea   
2012-09-03 15:29   
Corrected patch according to your observations. For some reason I am unable to delete the first patch (FindBLAS.cmake.patch)
(0030960)
Bogdan Cristea   
2012-09-08 17:21   
I have made tests using MKL library (11.0) installed on openSUSE 12.1 x86_64. I needed to change again the patch in order to comply with MKL. Also the environment variables were not handled correctly. Currently my mkl installation is detected with the following commands:

export LD_LIBRARY_PATH=/opt/intel/mkl/lib/intel64
cmake .. -DBLA_VENDOR=Intel10_64lp

ACML detection works too.
(0030970)
Alexey Ozeritsky   
2012-09-09 15:06   
That will not work
- set(_libdir ENV LD_LIBRARY_PATH)
+ set(_libdir $ENV{LD_LIBRARY_PATH})
Try to set LD_LIBRARY_PATH=/opt/intel/mkl/lib/intel64:/usr/local/lib and you will see why.

According to manual:
               find_library(
                           <VAR>
                           name | NAMES name1 [name2 ...]
                           [HINTS path1 [path2 ... ENV var]]
                           [PATHS path1 [path2 ... ENV var]]
So ENV is ok
(0030971)
Alexey Ozeritsky   
2012-09-09 15:16   
patch v3 attached
(0030975)
Bogdan Cristea   
2012-09-10 08:56   
(edited on: 2012-09-10 08:58)
Your approach is not correct, one needs to use

set(_libdir $ENV{LD_LIBRARY_PATH})

in order to get LD_LIBRARY_PATH variable content (see also http://www.cmake.org/Wiki/CMake_Useful_Variables#Environment_Variables [^])

When several paths separated by ':' are in LD_LIBRARY_PATH this approach does not work indeed.

(0030976)
Alexey Ozeritsky   
2012-09-10 09:30   
I don't want to get LD_LIBRARY_PATH variable content. I want to pass _libdir to find_library as is.
find_library will get and parse LD_LIBRARY_PATH variable content.
(0030977)
Bogdan Cristea   
2012-09-10 09:45   
(edited on: 2012-09-10 09:53)
I see your point, indeed MKL is detected with the following commands:
 export LD_LIBRARY_PATH=/opt/intel/mkl/lib/intel64/
 cmake .. -DBLA_VENDOR=Intel10_64lp

(0030978)
Alexey Ozeritsky   
2012-09-10 10:03   
Did you set LD_LIBRARY_PATH before making the changes ?
Can you attach CMakeFiles/CMakeError.log ?
(0030979)
Bogdan Cristea   
2012-09-10 10:10   
Sure, please note that the first pass does not detect MKL:

-- Found Threads: TRUE
-- Looking for sgemm_
-- Looking for sgemm_ - not found
-- Looking for sgemm_
-- Looking for sgemm_ - found
-- A library with BLAS API found.
-- A library with BLAS API found.
-- Looking for cheev_
-- Looking for cheev_ - found
-- A library with LAPACK API found.
-- Configuring done
(0030980)
Bogdan Cristea   
2012-09-10 10:17   
For ATLAS detection too, some corrections would be needed (library name has changed from atlas to satlas or tatlas)


diff --git a/cmake/Modules/FindBLAS.cmake b/cmake/Modules/FindBLAS.cmake
index c984193..9e69259 100644
--- a/cmake/Modules/FindBLAS.cmake
+++ b/cmake/Modules/FindBLAS.cmake
@@ -79,11 +79,11 @@ set(${LIBRARIES})
 set(_combined_name)
 if (NOT _libdir)
   if (WIN32)
- set(_libdir $ENV{LIB})
+ set(_libdir ENV LIB)
   elseif (APPLE)
- set(_libdir $ENV{DYLD_LIBRARY_PATH})
+ set(_libdir ENV DYLD_LIBRARY_PATH)
   else ()
- set(_libdir $ENV{LD_LIBRARY_PATH})
+ set(_libdir ENV LD_LIBRARY_PATH)
   endif ()
 endif ()
 
@@ -172,7 +172,7 @@ if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
   BLAS
   dgemm
   ""
- "f77blas;atlas"
+ "f77blas;satlas;tatlas;atlas;gfortran"
   ""
   )
  endif()
(0030981)
Alexey Ozeritsky   
2012-09-10 10:19   
That is cmake standard output. I need CMakeFiles/CMakeError.log your building directory.
(0030982)
Bogdan Cristea   
2012-09-10 10:22   
I have attached that file.
(0030983)
Alexey Ozeritsky   
2012-09-10 10:54   
I see the following
-L/opt/intel/mkl/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lpthread -lm

So, LD_LIBRARY_PATH works and the problem is somewhere else.

Did you try to use mklvars.sh script ?
  /opt/intel/path-to-mkl/bin/mklvars.sh
  cmake .. -DBLA_VENDOR=Intel10_64lp

(0030984)
Bogdan Cristea   
2012-09-10 13:41   
It seems that there is a misunderstanding:
- I have checked with the patch you propose and I am able to detect MKL libraries (by setting first LD_LIBRARY_PATH)
- I have not used any other script
- Please check also ATLAS library detection, it seems that the library name has changed.
(0030985)
Alexey Ozeritsky   
2012-09-10 14:05   
ATLAS library detection works for me.
Please provide
 - ATLAS version
 - rpm -ql your-atlas-package | grep .so
 - CMakeFiles/CMakeError.log
(0030986)
Bogdan Cristea   
2012-09-10 14:38   
ATLAS version: 3.10.0 (installed from openSUSE 12.1 repos)

/usr/lib64/atlas/libsatlas.so.3.0
/usr/lib64/atlas/libtatlas.so.3.0

see attached file CMakeError_atlas.log. Note that the detected library is the static version. This error file is obtained by setting first LD_LIBRARY_PATH to /usr/lib64/atlas
(0033030)
Brad King   
2013-05-13 13:52   
Moving to backlog awaiting a new volunteer module maintainer:

 http://www.cmake.org/Wiki/CMake:Module_Maintainers [^]
(0042111)
Kitware Robot   
2016-06-10 14:28   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.