Open TiborGY opened 2 years ago
Hi. What is the content of OPENBLAS_LIB
? Could you please try the following:
$ export BLAS_LIB="$OPENBLAS_LIB -lpthread"
$ export LAPACK_LIB="$OPENBLAS_LIB -lpthread"
$ cmake . -D LAPACK_LIBRARIES=$LAPACK_LIB -D BLAS_LIBRARIES=$BLAS_LIB
As far as I understand, BLAS_LIBRARIES
and LAPACK_LIBRARIES
should contain all libraries needed for the optimized BLAS and LAPACK libraries to work.
Hi. What is the content of
OPENBLAS_LIB
?
~/nfs_zpool/scalapack$ echo $OPENBLAS_LIB
/mnt/nfsroot/libs/OpenBLAS_latest_zen/lib/libopenblas.a
Could you please try the following:
$ export BLAS_LIB="$OPENBLAS_LIB -lpthread" $ export LAPACK_LIB="$OPENBLAS_LIB -lpthread" $ cmake . -D LAPACK_LIBRARIES=$LAPACK_LIB -D BLAS_LIBRARIES=$BLAS_LIB
Does not work, cmake tries to interpret it instead of treating it as a string:
~/nfs_zpool/scalapack$ cmake . -D LAPACK_LIBRARIES=$LAPACK_LIB -D BLAS_LIBRARIES=$BLAS_LIB
CMake Error: Unknown argument -lpthread
CMake Error: Run 'cmake --help' for all supported options.
I'm sorry. We're missing the double quotes. So:
$ cmake . -D LAPACK_LIBRARIES="$LAPACK_LIB" -D BLAS_LIBRARIES="$BLAS_LIB"
If it still does not work, I would replace -lpthread by the complete path for the pthread library.
This is what I would do. If it does not work, I can install OpenBLAS to try to help you.
Defining the variables like this leads to other issues, CMake generates an invalid Makefile, where the name of the target includes the path to the BLAS lib.
[ 68%] Built target scalapack
Scanning dependencies of target xslu
[ 68%] Building Fortran object TESTING/LIN/CMakeFiles/xslu.dir/psludriver.f.o
[ 68%] Building Fortran object TESTING/LIN/CMakeFiles/xslu.dir/psluinfo.f.o
[ 69%] Building Fortran object TESTING/LIN/CMakeFiles/xslu.dir/psgetrrv.f.o
[ 69%] Building Fortran object TESTING/LIN/CMakeFiles/xslu.dir/psmatgen.f.o
[ 69%] Building Fortran object TESTING/LIN/CMakeFiles/xslu.dir/pmatgeninc.f.o
[ 69%] Building Fortran object TESTING/LIN/CMakeFiles/xslu.dir/pslaschk.f.o
[ 69%] Building Fortran object TESTING/LIN/CMakeFiles/xslu.dir/pslafchk.f.o
make[2]: *** No rule to make target '/mnt/nfsroot/libs/OpenBLAS_latest_zen/lib/libopenblas.a -lpthread', needed by 'TESTING/xslu'. Stop.
make[1]: *** [CMakeFiles/Makefile2:1260: TESTING/LIN/CMakeFiles/xslu.dir/all] Error 2
make: *** [Makefile:166: all] Error 2
Thanks for the attempts. I've come up with a simple solution:
cmake -D USE_OPTIMIZED_LAPACK_BLAS=ON -D BLA_VENDOR=OpenBLAS .. # configure step
cmake --build build # build step
Building Scalapack with OpenBLAS as the optimized BLAS/LAPACK library fails, because OpenBLAS builds demand that pthread is linked, unless OpenBLAS has been built without its default shared-memory threading enabled. See below for abridged build log.
This is probably something CMake could detect, based on the build information that OpenBLAS makes available about itself, or just detect OpenBLAS and always tack on -lpthread.