Apptainer.Rmd(This vignette is a copy of the vignette in the inlabru-package.)
High Performance Computing (HPC) is surging in popularity. Building INLA package on the HPC systems with the Anaconda environment sometimes can be tricky due to the Linux distributions and glibc versions. This article is to suggest a workaround with container images using Apptainer (formerly known as Singularity) because Docker requires root access and is usually not available on HPC. Apptainer can pull Docker images. Despite its convenience, the image size can be large.
./your_container.sif.# To pull the docker image
$ apptainer pull your_container.sif docker://rocker/geospatial:latest
# once the sif is downloaded, get into an interactive shell
$ apptainer shell your_container.sif
# Inside the interactive shell, one can install INLA on a personal library path
$ R --verbose
# Now, in a R environment
> options(repos = c(
INLA = 'https://inla.r-inla-download.org/R/testing',
CRAN = 'https://cloud.r-project.org'))
> install.packages("INLA")
# One may be asked to create a personal library path.
> install.packages("inlabru")
# quit R
> q()# To execute an R file with apptainer
$ apptainer exec ./your_container.sif Rscript --no-restore --no-save --verbose file_to_run.RNote: Use inla.setOption(num.threads = ncpu) to limit
the number of threads (ncpu) since INLA does not set it automatically.
The ncpu also directly links to RAM requirements.