Skip to content

Instantly share code, notes, and snippets.

@smdabdoub
Last active March 20, 2018 21:08
Show Gist options
  • Save smdabdoub/2d6402e1c49fe449b3b4020686bd6aa2 to your computer and use it in GitHub Desktop.
Save smdabdoub/2d6402e1c49fe449b3b4020686bd6aa2 to your computer and use it in GitHub Desktop.
Building JAGS and rjags with the Intel MKL LAPACK routines (LINUX)
# NOTE: This was done on RHEL 7.3 with JAGS v4.3.0 and rjags v4-6. It should be fairly portable, but YMMV.
# Step 1: create an MKL environment variable for use in the --with-blas option for the JAGS configure script
# the below was taken from Martyn Plummer's "Building a portable R binary with Intel tools"
# https://martynplummer.files.wordpress.com/2014/10/r-intel-fedora.pdf
# I set MKL_LIB_PATH by looking at MKL_LIBS
export MKL="-Wl,--start-group ${MKL_LIB_PATH}/libmkl_gf_lp64.a \
> ${MKL_LIB_PATH}/libmkl_gnu_thread.a \
> ${MKL_LIB_PATH}/libmkl_core.a \
> -Wl,--end-group -lgomp -lpthread -ldl -lm"
# Step 2: Build JAGS linked to the MKL
# use --prefix to install JAGS to a custom location
./configure --with-blas="$MKL"
make
make install
# Step 3: Install rjags using pkg-config
# (Optional. Only needed if JAGS is installed to a custom location)
export PKG_CONFIG_PATH=$JAGS_INSTALL_FOLDER/jags/4.3.0/lib/pkgconfig
# check that it works
# should print out version number
pkg-config --modversion jags
# taken from https://github.com/cran/rjags/blob/master/INSTALL#L86
install.packages("rjags", configure.args="--enable-rpath")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment