[R-pkg-devel] Linking with OpenBLAS complains lapacke not found
Sameh M. Abdulah
@@meh@@bdu|@h @end|ng |rom k@u@t@edu@@@
Sun Sep 8 14:22:09 CEST 2019
Brian,
This is the code I am using to linking with BLAS using MKL or OpenBLAS
#MKL
if [ -n "$MKLROOT" ] && [ -d "$MKLROOT" ]; then
echo "mkl_dir directory exists!"
echo "Great... continue set-up"
source ${MKLROOT}/bin/mklvars.sh intel64
DEFINE_BLAS_LIBS_CMAKE="-DBLAS_LIBRARIES='-L${MKLROOT}/lib -Wl,-rpath,${MKLROOT}/lib -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread -lm -ldl'"
#DEFINE_BLAS_LIBS_CMAKE="-DBLAS_LIBRARIES='-L${MKLROOT}/lib\ -Wl,-rpath,${MKLROOT}/lib\ -lmkl_intel_lp64\ -lmkl_sequential\ -lmkl_core\ -lpthread\ -lm\ -ldl'"
XFLAG="-DBLA_VENDOR=Intel"
else
echo "MKL not found, trying to compile and use OpenBLAS"
XFLAG="-DBLA_VENDOR=Open"
USE_OPENBLAS='true'
fi
# openblas
if [ "true" == "$USE_OPENBLAS" ]
then
if pkg-config --exists openblas
then
_LOCATION=`pkg-config --variable=libdir openblas`
echo "OpenBLAS FOUND in [$_LOCATION]"
else
if [ "$BUILD_DEPENDENCIES" == "true" ]
then
echo "Building OpenBLAS..."
cd $TMPDIR
wget https://github.com/xianyi/OpenBLAS/archive/v0.3.3.tar.gz -O - | tar -zx
cd OpenBLAS-0.3.3
$MAKE -j >/dev/null|| $MAKE || { echo 'OpenBLAS installation failed' ; exit 1; }
$MAKE install PREFIX=$PREFIX
export CPATH=$CPATH:$PREFIX/include
else
echo "####################"
echo "OpenBLAS NOT FOUND"
echo "Please download it from: https://github.com/xianyi/OpenBLAS/releases"
echo "After installing it, set the proper PKG_CONFIG_PATH variable"
echo ""
err=1
fi
fi
fi
It works great but when OpenBLAS is using, my application cannot find lapacke library.
On 9/8/19, 2:28 PM, "Brian G. Peterson" <brian using braverock.com> wrote:
On Sun, 2019-09-08 at 10:04 +0000, Sameh M. Abdulah wrote:
> I am linking my package against openblas but it complains that
> lapacke is not found which I need for the installation.
>
> I have another alternative to linking against MKL but I cannot find
> it using MKLROOT variable on CRAN servers.
It isn't entirely clear what your question is, but shouldn't you just
be linking to the BLAS and leave the choice of BLAS to the individual
installation? In most cases you should probably not be statically
linking to the BLAS.
Here is an old paper by Dirk with more information that might help you
sort it out.
https://cran.r-project.org/web/packages/gcbd/vignettes/gcbd.pdf
Regards,
Brian
--
Brian G. Peterson
ph: +1.773.459.4973
im: bgpbraverock
More information about the R-package-devel
mailing list