Project

General

Profile

Bug #771

cmake overwrites BLAS_LIBRARIES and LAPACK_LIBRARIES

Added by Christoph Junghans almost 6 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Category:
build system
Target version:
Affected version - extra info:
Affected version:
Difficulty:
uncategorized
Close

Description

If the blas / lapack libraries have funny names, like lapack on AIX (lapack-essl_O3_qstrict), cmake will not find them.
Setting them by hand in the common way (LAPACK_LIBRARIES) does not work as LAPACK_LIBRARIES gets overwritten in FindLAPACK.cmake (line 132).

The same problem with FindBLAS.cmake

My first try for a workaround was something like -DBLA_VENDOR=Generic -DBLAS_blas_LIBRARIES="path/to/libsomeblas.so", which is a bit clumsy.


Related issues

Related to GROMACS - Bug #1186: install guide should mention how to configure blas and lapack Closed 03/11/2013

Associated revisions

Revision 99fd3d66 (diff)
Added by Mark Abraham almost 4 years ago

Update management of linear algebra libraries

Management of detection and/or linking to BLAS and LAPACK libraries is
re-organized. The code has migrated to its own module. This will
help future extension and maintenance. This version communicates
things that are newsworthy and stays out of the way when nothing
is changing.

We no longer over-write the values specified by the user for
GMX_EXTERNAL_(BLAS|LAPACK). Previously, this was used to signal
whether detection succeeded, but that does not really get the job
done. Instead, the user is notified that detection failed (repeatedly,
if they deliberately set such an option on).

Correct usage and expected behaviour in all cases is documented both
in the code and the install guide.

The user interface is pretty much unchanged. We still don't offer full
configurability (e.g. MKL for FFTs must use MKL for linear algebra
unless GMX_*_USER is used, and the only way to get MKL for linear
algebra is to use it for FFTs). The size of any performance difference
is probably very small, and if the user really needs mdrun with
certain FFT and tools with certain linear algebra library, they can do
two configurations. Note that mdrun never calls any linear algebra
routines (tested empirically)!

Expanded the solution of #771 by testing that the user supplied
libraries that actually work. If not, we emit a warning and try to use
them anyway.

We also now check that MKL really does provide linear algebra
routines, and fall back to the default treatment if it does not.

Refs #771,#1186

Change-Id: Ife5c59694e29a3ce73fc55975e26f6c083317d9b

History

#1 Updated by Rossen Apostolov almost 6 years ago

  • Assignee changed from Sander Pronk to Rossen Apostolov

The Find*.cmake modules in the latest cmake 2.8.5 still don't have support for AIX. I found something here: http://code.google.com/p/hpccodelets/source/browse/trunk/CMake/addNumerics.cmake?spec=svn1&r=1 . But this probably won't solve your problem.

A better solution would be to change CMakeLists.txt like

...
find_package(BLAS REQUIRED)
list(APPEND GMX_EXTRA_LIBRARIES ${BLAS_LIBRARIES})
endif(GMX_EXTERNAL_BLAS)

to
...
find_package(BLAS REQUIRED)
if(BLAS_FOUND)
list(APPEND GMX_EXTRA_LIBRARIES ${BLAS_LIBRARIES})
else(BLAS_FOUND)
list(APPEND GMX_EXTRA_LIBRARIES ${GMX_BLAS_USER})
endif(BLAS_FOUND)
endif(GMX_EXTERNAL_BLAS)

where GMX_BLAS_USER would be a new CMake variable

And same for LAPACK.

#2 Updated by Christoph Junghans almost 6 years ago

I would prefer

if (GMX_BLAS_USER)
  list(APPEND GMX_EXTRA_LIBRARIES ${GMX_BLAS_USER})
else(GMX_BLAS_USER)
  find_package(BLAS REQUIRED)
  list(APPEND GMX_EXTRA_LIBRARIES ${BLAS_LIBRARIES})
endif (GMX_BLAS_USER)

as it gives GMX_BLAS_USER priority over BLAS_LIBRARIES.

#3 Updated by Rossen Apostolov almost 6 years ago

Right, that's better. I'm gonna make a patch for that.

#4 Updated by Rossen Apostolov almost 6 years ago

I pushed a patch, gerrit ID I4ca1c4ca, but then I saw that Mark has applied a fix to FindLAPACK.cmake, ID I6fefed83 but those don't conflict.

Christoph, can you check whether my patch works on AIX?

#5 Updated by Rossen Apostolov almost 6 years ago

  • Status changed from New to In Progress

#6 Updated by Rossen Apostolov almost 6 years ago

  • Status changed from In Progress to Closed

Christoph confirmed for Change-Id: I4ca1c4ca365788fcafc4219934fdfe8758db84f1 that it works, so closing. Thanks!

Also available in: Atom PDF