Datarmor Install - osmose-model/osmose GitHub Wiki

Datarmor install

This section describes the easiest way to install Osmose on the Datarmor HPC. When running a job on Datarmor, you do not have access to the Internet. Therefore, the Java executables cannot be downloaded as discussed here. As a consequence, both the Java core and the R package must be compiled manually following Install from sources.

In the following, we describe the steps to achieve this install on Datarmor.

Loading the modules

From the Terminal, first load the necessary modules:

module load R/3.6.3-intel-cc-17.0.2.174
module load java/openjdk-16.0.2
module load nco

[!WARNING] To use parallel R features, this specific R module is required

[!NOTE] The nco module is needed to have access to the NetCDF library

Set-up environment variables

Edit the ~/.Renviron file and define the R_LIBS_USER environment variables as follows:

R_LIBS_USER=/home1/datawork/nbarrier/libs/R/lib

It specifies the location where the R libraries will be insalled.

[!WARNING] The R_LIBS_USER location should be one of your folder in order to be able to install packages in it.

[!NOTE] The definition of the OSMOSE_DIR variable is not required since the Java executables will be generated by the compilation process.

Setting up conda

To have access to Git and Maven, the first step is to enable the use of Conda, through which these tools are available.

First, create a ~/.condarc file, which contains the following lines:

envs_dirs:
  - ${DATAWORK}/anaconda3-envs
  - /home1/datahome/nbarrier/softwares/anaconda3-envs
  - /appli/conda-env
  - /appli/conda-env/2.7
  - /appli/conda-env/3.6
channels:
  - conda-forge

When this is done, if using CSH, type:

source /appli/anaconda/latest/etc/profile.d/conda.csh

If using BASH, type:

. /appli/anaconda/latest/etc/profile.d/conda.sh

[!TIP] To make Conda permanently available, you can add the line above commands to your ~/.cshrc or ~/.bashrc files. file

Cloning the code

Once Conda is set up, activate the Git environment by typing:

conda activate git

This will give you access to a git executable configured with the LFS support.

Finally, type the following:

git clone https://github.com/osmose-model/osmose.git
conda deactivate  # leave the conda environment

Installing external libraries

Some external libraries are no longer available from CRAN and must be manually installed. Download them by typing, from the terminal:

wget https://cran.r-project.org/src/contrib/Archive/optimr/optimr_2019-12.16.tar.gz
wget https://cran.r-project.org/src/contrib/Archive/Rcgmin/Rcgmin_2022-4.30.tar.gz
wget https://cran.r-project.org/src/contrib/Archive/Rvmmin/Rvmmin_2018-4.17.tar.gz
wget https://cran.r-project.org/src/contrib/Archive/XML/XML_3.98-1.20.tar.gz
wget https://cran.r-project.org/src/contrib/Archive/lbfgsb3c/lbfgsb3c_2020-3.3.tar.gz

Open an R console and type:

install.packages(c("optextras", "setRNG"))

Quit R and type:

R CMD INSTALL Rvmmin_2018-4.17.tar.gz
R CMD INSTALL Rcgmin_2022-4.30.tar.gz
R CMD INSTALL optimr_2019-12.16.tar.gz
R CMD INSTALL XML_3.98-1.20.tar.gz
R CMD INSTALL lbfgsb3c_2020-3.3.tar.gz

Open an R console and type:

install.packages(c("BB", "cmaes", "DEoptim", "dfoptim", "GenSA", "optimx", "pso", "rgenoud", "soma", "rlist", "rmarkdown"))

Installing calibrar

Leave the R console and download and install calibrar as follows:

wget https://github.com/roliveros-ramos/calibrar/archive/refs/heads/master.zip -O calibrar.zip
unzip calibrar.zip
R CMD INSTALL calibrar-master/

Compiling the code

To compile the Osmose Java code on Datarmor, you will need to use the maven conda environment. To activate it:

conda activate maven

Then, go in the osmose folder and type:

mvn package

The Java executable file is created in the inst/java/ folder of the osmose directory.

Installing the package

Once the Java code is compiled and the external R libraries installed, you can install the Osmose R package.

Go to the cloned osmose folder and type:

R CMD INSTALL .

Creating Jupyter kernel

If you plan using the Datarmor JupyterHub, first activate the jupyterhub environment:

conda activate jupyterhub

open an R console and type:

install.packages("IRkernel")

When done, type:

IRkernel::installspec(name="osmose-R", displayname="Osmose R")

Open the $HOME/.local/share/jupyter/kernels/osmose-r/kernel.json file and edit the file as follows:

{
  "argv": ["/appli/R/3.6.3-intel-cc-17.0.2.174/lib64/R/bin/R", "--slave", "-e", "IRkernel::main()", "--args", "{connection_file}"],
  "display_name": "R/3.6.3-intel-cc-17.0.2.174",
  "language": "R",
  "env": {"LD_LIBRARY_PATH": "/appli/intel/parallel_studio/parallel_studio_xe_2017_update2/compilers_and_libraries_2017.2.174/linux/mkl/lib/intel64_lin:/appli/intel/parallel_studio/parallel_studio_xe_2017_update2/compilers_and_libraries_2017.2.174/linux/mkl/lib/intel64:/appli/intel/parallel_studio/parallel_studio_xe_2017_update2/impi/2017.2.174/intel64/lib:/usr/X11R6/lib64:/appli/java//jdk1.8.0_66/lib:/appli/intel/parallel_studio/parallel_studio_xe_2017_update2/compilers_and_libraries_2017.2.174/linux/compiler/lib/intel64:/opt/intel/mic/coi/host-linux-release/lib:/opt/intel/mic/myo/lib:/appli/R/3.6.3-intel-cc-17.0.2.174/notR/lib:/appli/R/3.6.3-intel-cc-17.0.2.174/lib:/appli/conda-env/2.7/nco//lib"}
}

Now the Osmose R kernel should be visible on the Jupyter Hub.