hrue / r-inla

This is the public repository for the r-inla project
GNU General Public License v2.0
82 stars 24 forks source link

Providing PARDISO support while building R-INLA from source. #68

Closed terjekv closed 6 months ago

terjekv commented 1 year ago

As a continuation of this, I need to be able to build R-INLA with PARDISO support from source, as the binaries fail on RHEL8 due to its binary build targeting libraries not on the system:

If I try to use the binary version of INLA_22.05.07 (upgraded from 21.05.02) under R-4.0.4, I get:

> inla.pardiso.check()
/tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/inla.mkl: /tmp/terjekv/tmp-installs/R-INLA-21.05.02-
foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/libcrypto.so.1.1: version `OPENSSL_1_1_1b' not found (required by /lib64/libk5crypto.so.3)
/tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/inla.mkl: /tmp/terjekv/tmp-installs/R-INLA-21.05.02-
foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/libcrypto.so.1.1: version `OPENSSL_1_1_1b' not found (required by /lib64/libk5crypto.so.3)
character(0)
attr(,"status")
[1] 1
Warning message:
In system(paste(shQuote(inla.call.no.remote()), "-m pardiso"), intern = TRUE) :
  running command ''/tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/inla.mkl.run' -m pardiso' had status 1

If I try upgrade to the testing version INLA_22.12.12-2 I get:

> inla.pardiso.check()
/tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/inla.mkl: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/inla.mkl)
/tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/inla.mkl: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/first/libRmath.so.1)
/tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/inla.mkl: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/first/libR.so)
/tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/inla.mkl: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/libgsl.so.23)
/tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/inla.mkl: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/first/libpardiso.so)
/tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/inla.mkl: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/libgfortran.so.5)
/tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/inla.mkl: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/libicuuc.so.66)
/tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/inla.mkl: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/libicui18n.so.66)
/tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/inla.mkl: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/libmvec.so.1)
/tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/inla.mkl: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/inla.mkl)
/tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/inla.mkl: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/first/libRmath.so.1)
/tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/inla.mkl: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/first/libR.so)
/tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/inla.mkl: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/libgsl.so.23)
/tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/inla.mkl: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/first/libpardiso.so)
/tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/inla.mkl: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/libgfortran.so.5)
/tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/inla.mkl: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/libicuuc.so.66)
/tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/inla.mkl: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/libicui18n.so.66)
/tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/inla.mkl: /lib64/libm.so.6: version `GLIBC_2.29' not found (required by /tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/libmvec.so.1)
character(0)
attr(,"status")
[1] 1
Warning message:
In system(paste(shQuote(inla.call.no.remote()), "-m pardiso"), intern = TRUE) :
  running command ''/tmp/terjekv/tmp-installs/R-INLA-21.05.02-foss-2020b-R-4.0.4.eb/software/R-INLA/21.05.02-foss-2020b-R-4.0.4/INLA/bin/linux/64bit/inla.mkl.run' -m pardiso' had status 1

Would it be possible to provide instructions for adding PARDISO to the building of R-INLA from source?

hrue commented 1 year ago

Can you try with R-4.2 and the testing version of R-INLA? After doing the install, then the following and chose 'Alternative 3'.

Let me know if that does not work, like with

inla(y~1, data=data.frame(y=0))

library(INLA) inla.binary.install()

  • Looking for Version_22.12.12-2 and os='' Available alternatives: Alternative 1 is ./CentOS Linux-6 (Core)/Version_22.12.12-2/64bit.tgz Alternative 2 is ./CentOS Linux-7 (Core)/Version_22.12.12-2/64bit.tgz Alternative 3 is ./CentOS Stream-8/Version_22.12.12-2/64bit.tgz Alternative 4 is ./Fedora Linux-37 (Workstation Edition)/Version_22.12.12-2/64bit.tgz Alternative 5 is ./Ubuntu-18.04.6 LTS (Bionic Beaver)/Version_22.12.12-2/64bit.tgz Alternative 6 is ./Ubuntu-20.04.5 LTS (Focal Fossa)/Version_22.12.12-2/64bit.tgz Alternative 7 is ./Ubuntu-22.04.1 LTS (Jammy Jellyfish)/Version_22.12.12-2/64bit.tgz Chose alternative [1:7] 1:
terjekv commented 1 year ago

That works, but that leaves us hanging for RHEL9 as well as for older versions of R that we do support. Without the ability to build support in a consistent fashion for our users it is hard to guarantee anything when it comes to compatibility with other packages or our standard software distribution. :(

Would it be possible to provide some documentation on how to proceed to build PARDISO support consistently during our default R install (which is based on EasyBuild)?

hrue commented 1 year ago

Currently, we only provide packages for R-4.2, as its a mess to build packages for different versions of R.

I see we need to make some changes internally to install the R-part of the package with

remotes:install_github("hrue/r-inla/rinla")

We soft-link the documentation internally and the R installer does not like that.

Anyway, this is possible. The easy way out then to use the precompiled binaries provided by 'inla.binary.install()' for R-4.2 and use them in the R-4.0, R-4.1 package, with

library(INLA) inla.setOption(inla.call= "path...") inla.setOption(fmesher.call = "path...")

where "path...", is like

inla.getOption('inla.call') [1] "/home/hrue/R/x86_64-redhat-linux-gnu-library/4.2/INLA/bin/linux/64bit/inla.mkl.run"

if you rather want to compile those from the source yourself, then I can provide the build directory I have for CentOS8.

terjekv commented 1 year ago

For us, the advantage of building from source means that we are certain that library compatibility works out across the different versions of R, other R modules, and their dependencies. I'm up for putting in some effort in bundling as an option to the EasyConfig if they have licenses and such in order. :)

hrue commented 1 year ago

You'll find the CentOS8 build directory at

hrue.r-inla-download.org

and builds.tgz

I build it with

export INLA_TAG=Version_22.12.12-2 make update

we'll only use the 'inla.mkl' binary and the 'fmesher' binary in local/bin

you'll find precompiled libpardiso.so in local/lib as well.

terjekv commented 1 year ago

Thanks! I'll poke it a bit! The file has been fetched, so if you wish to remove it, feel free. :)

hrue commented 1 year ago

You can install directly from the R-source, if one replaces the soft-links, like just rsyncing the r-inla/rinla directory to somewhere else with with '-L' option, and then using remotes::install_local() to install it. The binaries can be placed elsewhere as discussed earlier.