Installation of the R package "torch"

Dear Baobab team,

I need to install the “torch” R package and take advantage of CUDA for GPU computing. I tried to load both modules: CUDA and R, but I was not successful. Indeed, using these commands:

ml GCC/9.3.0 OpenMPI/4.0.3 R/4.0.0
ml CUDA
it seems R is unloaded when CUDA is loaded.

In a second step, I would have to install the R package “torch”. The R commands to do this are expected to be:

R
install.packages(“torch”)
torch::install_torch()

However, up to now, I was unsuccessful because of several errors… I suspect being able to load both CUDA and R module at the same time would be a first step toward this package installation, but it’s unclear.

Would you be able to help me to install this R package “torch” and setup the configuration so I can use GPU ?

Thanks a lot,
Julien

Hi,

I was finally able to install this package via singularity.
If anyone interested, the procedure is:

singularity pull docker://rocker/ml:4.0.3-cuda11.1
srun --partition=shared-gpu --time=02:00:00 --gres=gpu:1 --pty -n1 -c2 --mem=24000 bash
ml GCCcore/8.2.0 Singularity/3.4.0-Go-1.12
singularity exec --nv ~/scratch/ml_4.0.3-cuda11.1.sif R
remotes::install_github(“mlverse/torch”)
library(torch)

Best regards,
Julien