Skip to content
This repository has been archived by the owner on Jun 25, 2022. It is now read-only.

Commit

Permalink
don't set LD_PRELOAD globally, and can't set it Renviron
Browse files Browse the repository at this point in the history
  • Loading branch information
cboettig committed Mar 12, 2019
1 parent 13cc404 commit 87726cf
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions cuda/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ RUN echo "rsession-ld-library-path=$LD_LIBRARY_PATH" | \
echo "\n\
\nCUDA_HOME=$CUDA_HOME \
\nCUDA_PATH=$CUDA_PATH \
\nPATH=$PATH \
\nLD_PRELOAD=/usr/local/cuda/lib64/libnvblas.so.$CUDA_VERSION" \
\nPATH=$PATH" \
>> /usr/local/lib/R/etc/Renviron

## Allow R to use CUDA for BLAS, with fallback on openblas
Expand All @@ -84,4 +83,25 @@ RUN echo "NVBLAS_LOGFILE nvblas.log \

ENV NVBLAS_CONFIG_FILE=/etc/nvblas.conf

## We don't want to set LD_PRELOAD globally
ENV CUDA_BLAS=/usr/local/cuda/lib64/libnvblas.so.$CUDA_VERSION

RUN mv /usr/local/bin/R /usr/local/bin/R_ && \
mv /usr/local/bin/Rscript /usr/local/bin/Rscript_ && \
echo "#!/bin/sh
\nLD_PRELOAD=$CUDA_BLAS /usr/local/bin/R_ \"\$@\"" \
> /usr/local/bin/R && \
chmod +x /usr/local/bin/R && \
echo "#!/bin/sh
\nLD_PRELOAD=$CUDA_BLAS /usr/local/bin/Rscript_ \"\$@\"" \
> /usr/local/bin/Rscript && \
chmod +x /usr/local/bin/Rscript

RUN echo "#!/usr/bin/with-contenv bash \
\n## load /etc/environment vars first: \
\n for line in \$( cat /etc/environment ) ; do export \$line ; done \
\n export$LD_PRELOAD=$CUDA_BLAS \
\n exec /usr/lib/rstudio-server/bin/rserver --server-daemonize 0" \
> /etc/services.d/rstudio/run


0 comments on commit 87726cf

Please sign in to comment.