I recently installed a precompiled R binary (from RStudio) on an Ubuntu 22 system with Intel MKL, which was installed using
apt and set as the default BLAS via
update-alternatives as part of the installation process. As a result, R is using the Intel library for BLAS/LAPACK:
Matrix products: default BLAS/LAPACK: /usr/lib/x86_64-linux-gnu/libmkl_rt.so
After running a logistic regression and getting absurd results, I realized (to my horror) that R will only provide correct results if the following two environment variables are set:
export MKL_INTERFACE_LAYER=GNU,LP64 export MKL_THREADING_LAYER=GNU
Thus, it seems R might never provide correct output on my system when scripts are run with
--no-environ. So, I'm wondering:
- Is there a way to make R see these two environment variables no matter how it's launched?
- If I decide this setup is too risky, any advice for undoing this and getting back to an R with OpenBLAS or another library that doesn't require specifying environment variables?
- There's no warning about this. Installing
intel-mkland then using the precompiled binaries seems to result in a broken setup by default. If I continue using MKL, is there any way to make R stop automatically unless these environment variables are defined?