Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Dockerfile to R 4.4 and fixed Makevars and .stan files to run on arm64 #6

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 32 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,36 +1,43 @@
# This runs an R script belonging to a local library and saves its plotly graphs as image files

FROM rocker/r-ver:4.0.3
FROM rocker/r-ver:4.4

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
apt-utils \
ed \
libnlopt-dev \
&& apt-get install -y --no-install-recommends \
apt-utils \
ed \
libnlopt-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/

RUN apt-get update && apt-get install -y --no-install-recommends \
software-properties-common \
dirmngr \
git-core \
libcurl4-openssl-dev \
libgit2-dev \
libssh2-1-dev \
libicu-dev \
libpng-dev \
libudunits2-dev \
zlib1g-dev \
libgdal-dev \
libproj-dev \
xml2 \
openssl \
python3
# `python` needed for `save_image()`
software-properties-common \
dirmngr \
git-core \
libcurl4-openssl-dev \
libgit2-dev \
libssh2-1-dev \
libicu-dev \
libpng-dev \
libudunits2-dev \
zlib1g-dev \
libgdal-dev \
libproj-dev \
xml2 \
openssl \
python3 # needed for `save_image()`

RUN add-apt-repository --enable-source --yes "ppa:marutter/rrutter4.0"
RUN add-apt-repository --enable-source --yes "ppa:c2d4u.team/c2d4u4.0+"
RUN apt install -y r-cran-rcpparmadillo
# needed to install devtools
RUN apt-get update && apt-get install -y --no-install-recommends \
libssl-dev \
libfontconfig1-dev \
libxml2-dev \
libharfbuzz-dev \
libfribidi-dev \
libfreetype6-dev \
libpng-dev \
libtiff5-dev \
libjpeg-dev

RUN mkdir /epiline/

Expand All @@ -56,7 +63,7 @@ RUN Rscript -e "install.packages('moments', repos='http://cran.rstudio.com/')"
# needed for `save_image()`
RUN Rscript -e "install.packages('reticulate', repos='http://cran.rstudio.com/')"

# needed to use local library
# # needed to use local library
RUN Rscript -e "install.packages('devtools', repos='http://cran.rstudio.com/')"
RUN Rscript -e "devtools::load_all()"
RUN Rscript -e "devtools::install()"
Expand Down
4 changes: 2 additions & 2 deletions src/Makevars
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
STANHEADERS_SRC = `"$(R_HOME)/bin$(R_ARCH_BIN)/Rscript" --vanilla -e "cat(system.file('include', 'src', package = 'StanHeaders'))"`
PKG_CPPFLAGS = -I"../inst/include" -I"$(STANHEADERS_SRC)" -DBOOST_RESULT_OF_USE_TR1 -DBOOST_NO_DECLTYPE -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DBOOST_MATH_OVERFLOW_ERROR_POLICY=ignore_error -std=c++14
PKG_LIBS = '/usr/local/lib/R/site-library/rstan/lib//libStanServices.a' -L'/usr/local/lib/R/site-library/StanHeaders/lib/' -lStanHeaders -L'/usr/local/lib/R/site-library/RcppParallel/lib/' -ltbb
PKG_CPPFLAGS = -I"/usr/local/lib/R/site-library/Rcpp/include/" -I"/usr/local/lib/R/site-library/RcppEigen/include/" -I"/usr/local/lib/R/site-library/RcppEigen/include/unsupported" -I"/usr/local/lib/R/site-library/BH/include" -I"/usr/local/lib/R/site-library/StanHeaders/include/src/" -I"/usr/local/lib/R/site-library/StanHeaders/include/" -I"/usr/local/lib/R/site-library/RcppParallel/include/" -I"/usr/local/lib/R/site-library/rstan/include" -DEIGEN_NO_DEBUG -DBOOST_DISABLE_ASSERTS -DBOOST_PENDING_INTEGER_LOG2_HPP -DSTAN_THREADS -DUSE_STANC3 -DSTRICT_R_HEADERS -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION -D_HAS_AUTO_PTR_ETC=0 -include '/usr/local/lib/R/site-library/StanHeaders/include/stan/math/prim/fun/Eigen.hpp' -D_REENTRANT -DRCPP_PARALLEL_USE_TBB=1
SOURCES = stan_files/symptom_report_model.stan stan_files/symptom_report_model_gamma.stan
OBJECTS = $(SOURCES:.stan=.o) init.o

Expand Down
7 changes: 4 additions & 3 deletions src/stan_files/symptom_report_model.stan
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ transformed data {
line_list = rep_matrix( 0, t_rep_symptoms, t_max );
for( idx in 1:n_ll ) {
tau = ll_report[ idx ] - ll_symptoms[ idx];
ddxx = tau + t_symptom_post + 1;
ddxx = max( min( ddxx, t_rep_symptoms ), 1 );
sdxx = max( min( ll_symptoms[idx] + t_symptom_pre, t_max ), 1 );
int ddxx_left = min( ddxx, t_rep_symptoms );
ddxx = max( ddxx_left, 1 );
int sdxx_left = min( ll_symptoms[idx] + t_symptom_pre, t_max );
sdxx = max( sdxx_left, 1 );
line_list[ ddxx, sdxx ] = ll_N[ idx ];
}

Expand Down
7 changes: 4 additions & 3 deletions src/stan_files/symptom_report_model_gamma.stan
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,10 @@ transformed data {
line_list = rep_matrix( 0, t_rep_symptoms, t_max );
for( idx in 1:n_ll ) {
tau = ll_report[ idx ] - ll_symptoms[ idx];
ddxx = tau + 1;
ddxx = max( min( ddxx, t_rep_symptoms ), 1 );
sdxx = max( min( ll_symptoms[idx] + t_symptom_pre, t_max ), 1 );
int ddxx_left = min( ddxx, t_rep_symptoms );
ddxx = max( ddxx_left, 1 );
int sdxx_left = min( ll_symptoms[idx] + t_symptom_pre, t_max );
sdxx = max( sdxx_left, 1 );
line_list[ ddxx, sdxx ] = ll_N[ idx ];
}

Expand Down