[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cmake
Subject:    Re: [CMake] CMake FindBLAS and FindLAPACK patches
From:       don la dieu <nega () icecube ! umd ! edu>
Date:       2011-08-27 17:21:28
Message-ID: 4E592798.4010009 () icecube ! umd ! edu
[Download RAW message or body]

Hi Alexey-

Sorry for the delay in getting back to you.

Attached are updates to the FindBLAS you sent me (well, actually trunk.)
FindLAPACK was fine. It tightens up the default directory detection (it
prefers the the most current version it can find) and fixes a couple of
typos. I didn't add the recently released ACML v5.0.0. AMD changed
things up with that release, and it will probably require an additional
BLA_VENDOR.

Also, I've attached 2 patches that improve "Generic" detection on Ubuntu
(and I assume Debian), and works with the libblas3gf and liblapack3gf
packages. It does this by saving/changing/restoring
CMAKE_FIND_LIBRARY_SUFFIXES. I added BLAS_STATIC to that logic too.
Note, these are are against 2.8.5. I can update them to trunk if you want.

I found 2 minor bugs which I haven't patched as I'm not sure how you
wanted to address it. BLA_VENDORs "Apple" (Accelerate Framework) and
"NAS" (vecLib Framework) fail as 'cblas_dgemm_' doesn't exist.
'clbas_dgemm' and I think 'dgemm_' do though.

CC'd the list as this note might be relevant to others.

Don

On 08/13/2011 09:09 AM, Alexey Ozeritsky wrote:
> Hi,
> 
> You can test attached modules.
> There are 3 ways to set acml library paths
> 1. install libraries to LD_LIBRARY_PATH or LIB (for windows)
> 2. set variable BLAS_ACML_LIB_DIRS or BLAS_ACML_MP_LIB_DIRS or
> BLAS_ACML_GPU_LIB_DIRS
> 3. install libraries to /opt/acml* or c:/amd/acml (for windows)
> 
> On Fri, Aug 12, 2011 at 12:28 AM, don la dieu <nega@icecube.umd.edu> wrote:
> > Hi Alexey-
> > 
> > It probably makes more sense to have ACML-GPU as a separate BLAS_VENDOR, \
> > especially since that's what you're already doing with ACML and ACML_MP. It would \
> > also make the code clearer. 
> > Don
> > 
> > On Aug 11, 2011, at 4:31 AM, Alexey Ozeritsky wrote:
> > 
> > > Hello,
> > > 
> > > Thanks for patches.
> > > I've just pushed GotoBLAS2 into upstream.
> > > 
> > > I think that ACML-GPU support should be done as separate BLAS_VENDOR.
> > > What do you think about it ?
> > > 
> > > 11.08.2011, 00:43, "don la dieu" <nega@icecube.umd.edu>:
> > > > Alexey-
> > > > 
> > > > Attached are two patches for adding detection support for GotoBLAS2 and
> > > > ACML-GPU. Both patches are against CMake 2.8.5.
> > > > 
> > > > Thanks,
> > > > Don
> > 
> > 


["FindBLAS.cmake_fixes.diff" (text/x-patch)]

--- Modules/FindBLAS.cmake.alexey	2011-08-27 12:32:45.000000000 -0400
+++ Modules/FindBLAS.cmake	2011-08-27 12:25:01.000000000 -0400
@@ -138,7 +138,7 @@
 
 if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
  if(NOT BLAS_LIBRARIES)
-  # BLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
+  # gotoblas (http://www.tacc.utexas.edu/tacc-projects/gotoblas2)
   check_fortran_libraries(
   BLAS_LIBRARIES
   BLAS
@@ -272,18 +272,26 @@
      ((BLA_VENDOR STREQUAL "ACML_GPU") AND (NOT BLAS_ACML_GPU_LIB_DIRS))
    )
    # try to find acml in "standard" paths
+ if(NOT BLA_VENDOR STREQUAL "ACML_GPU")
+   foreach(ver 4.4.0 4.3.0 4.2.0 4.1.0 4.0.1 4.0.0)
+     if( WIN32 )
+       file( GLOB _ACML_ROOT "C:/AMD/acml${ver}/ACML-EULA.txt" )
+     else()
+       file( GLOB _ACML_ROOT "/opt/acml${ver}/ACML-EULA.txt" )
+     endif()
+     if( _ACML_ROOT )
+       break()
+     endif()
+   endforeach()
+ else()
    if( WIN32 )
-    file( GLOB _ACML_ROOT "C:/AMD/acml*/ACML-EULA.txt" )
-   else()
-    file( GLOB _ACML_ROOT "/opt/acml*/ACML-EULA.txt" )
-   endif()
-   if( WIN32 )
-    file( GLOB _ACML_GPU_ROOT "C:/AMD/acml*/GPGPUexamples" )
+    file( GLOB _ACML_ROOT "C:/AMD/acmlgpu*/ACML-EULA.txt" )
    else()
-    file( GLOB _ACML_GPU_ROOT "/opt/acml*/GPGPUexamples" )
+    file( GLOB _ACML_ROOT "/opt/acmlgpu*/ACML-EULA.txt" )
    endif()
+ endif(NOT BLA_VENDOR STREQUAL "ACML_GPU")
+
    list(GET _ACML_ROOT 0 _ACML_ROOT)
-   list(GET _ACML_GPU_ROOT 0 _ACML_GPU_ROOT)
    if( _ACML_ROOT )
     get_filename_component( _ACML_ROOT ${_ACML_ROOT} PATH )
     if( SIZEOF_INTEGER EQUAL 8 )
@@ -321,6 +329,10 @@
     set(_ACML_MP_LIB_DIRS
      "${_ACML_ROOT}/${_ACML_COMPILER32}_mp${_ACML_PATH_SUFFIX}/lib"
      "${_ACML_ROOT}/${_ACML_COMPILER64}_mp${_ACML_PATH_SUFFIX}/lib" )
+   elseif(BLA_VENDOR STREQUAL "ACML_GPU" )
+    set(_ACML_GPU_LIB_DIRS
+     "${_ACML_ROOT}/${_ACML_COMPILER32}${_ACML_PATH_SUFFIX}/lib"
+     "${_ACML_ROOT}/${_ACML_COMPILER64}${_ACML_PATH_SUFFIX}/lib" )
    else() #if( _BLAS_VENDOR STREQUAL "ACML" )
     set(_ACML_LIB_DIRS
      "${_ACML_ROOT}/${_ACML_COMPILER32}${_ACML_PATH_SUFFIX}/lib"
@@ -349,7 +361,7 @@
      BLAS_LIBRARIES
      BLAS
      sgemm
-     "" "acml_mp;acml_mv;CALBLAS" "" ${BLAS_ACML_GPU_LIB_DIRS}
+     "" "acml;acml_mv;CALBLAS" "" ${BLAS_ACML_GPU_LIB_DIRS}
    )
    if( BLAS_LIBRARIES )
     break()
@@ -361,7 +373,7 @@
      BLAS_LIBRARIES
      BLAS
      sgemm
-     "" "acml_mp;acml_mv" "" ${BLAS_ACML_LIB_DIRS}
+     "" "acml;acml_mv" "" ${BLAS_ACML_LIB_DIRS}
    )
    if( BLAS_LIBRARIES )
     break()

["FindBLAS.cmake_guards.diff" (text/x-patch)]

--- Modules/FindBLAS.cmake.orig	2011-08-24 10:30:15.000000000 -0400
+++ Modules/FindBLAS.cmake	2011-08-24 10:35:46.000000000 -0400
@@ -42,6 +42,8 @@
 include(CheckFunctionExists)
 include(CheckFortranFunctionExists)
 
+set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
+
 # Check the language being used
 get_property( _LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES )
 if( _LANGUAGES_ MATCHES Fortran )
@@ -78,7 +80,7 @@
   if(_libraries_work)
    if ( WIN32 )
     if(BLA_STATIC)
-      set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib;.dll")
+      set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRRAY_SUFFIXES})
     endif(BLA_STATIC)
     find_library(${_prefix}_${_library}_LIBRARY
     NAMES ${_library}
@@ -88,7 +90,7 @@
 
    if ( APPLE )
     if(BLA_STATIC)
-     set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib;.dll")
+     set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRRAY_SUFFIXES})
     endif(BLA_STATIC)
     find_library(${_prefix}_${_library}_LIBRARY
     NAMES ${_library}
@@ -96,8 +98,9 @@
     )
 
    else ( APPLE )
+    set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRRAY_SUFFIXES} .so.3gf)
     if(BLA_STATIC)
-      set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so")
+      set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRRAY_SUFFIXES})
     endif(BLA_STATIC)
     find_library(${_prefix}_${_library}_LIBRARY
     NAMES ${_library}
@@ -559,3 +577,5 @@
     endif(BLAS_FOUND)
   endif(NOT BLAS_FIND_QUIETLY)
 endif(BLA_F95)
+
+set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})

["FindLAPACK.cmake_guards.diff" (text/x-patch)]

--- Modules/FindLAPACK.cmake.orig	2011-08-24 10:30:15.000000000 -0400
+++ Modules/FindLAPACK.cmake	2011-08-24 10:48:31.000000000 -0400
@@ -36,6 +36,8 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
+set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
+
 get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES)
 if (NOT _LANGUAGES_ MATCHES Fortran)
 include(CheckFunctionExists)
@@ -67,7 +69,7 @@
   if(_libraries_work)
   IF (WIN32)
     if(BLA_STATIC)
-      set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib;.dll")
+      set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRRAY_SUFFIXES})
     endif(BLA_STATIC)
     find_library(${_prefix}_${_library}_LIBRARY
     NAMES ${_library}
@@ -77,15 +79,16 @@
 
   if(APPLE)
     if(BLA_STATIC)
-      set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so;.dylib")
+      set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRRAY_SUFFIXES})
     endif(BLA_STATIC)
     find_library(${_prefix}_${_library}_LIBRARY
     NAMES ${_library}
     PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH
     )
     else(APPLE)
+    set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRRAY_SUFFIXES} .so.3gf)
     if(BLA_STATIC)
-     set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so")
+     set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRRAY_SUFFIXES})
     endif(BLA_STATIC)
     find_library(${_prefix}_${_library}_LIBRARY
     NAMES ${_library}
@@ -300,3 +319,5 @@
   endif(LAPACK_FOUND)
  endif(NOT LAPACK_FIND_QUIETLY)
 endif(BLA_F95)
+
+set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})


_______________________________________________
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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic