Closed seananderson closed 10 months ago
For future reference, these 2 commits fixed the valgrind and clang-ASAN/UBSAN errors: https://github.com/pbs-assess/sdmTMB/commit/a7026aba725f4f926af70c4e3eb35a0f94b48d37 https://github.com/pbs-assess/sdmTMB/commit/de1efa2c8848985e943064a9595ad92b98325e56
My Docker file:
FROM wch1/r-debug
RUN apt-get -y install cmake
RUN apt-get -y install libnlopt-dev
RUN apt-get -y install libudunits2-dev
RUN apt-get -y install libgdal-dev
RUN apt-get -y install libproj-dev
RUN RDvalgrind -e "install.packages('s2')"
RUN RDvalgrind -e "install.packages('sf')"
RUN RDvalgrind -e "install.packages('lme4')"
RUN RDvalgrind -e "install.packages('mgcv')"
RUN RDvalgrind -e "install.packages('TMB')"
RUN RDvalgrind -e "install.packages('fmesher')"
RUN RDvalgrind -e "install.packages('assertthat')"
RUN RDvalgrind -e "install.packages('rlang')"
RUN RDvalgrind -e "install.packages('ggeffects')"
RUN RDvalgrind -e "install.packages('dplyr')"
RUN RDvalgrind -e "install.packages('visreg')"
RUN RDvalgrind -e "install.packages('devtools')"
RUN RDvalgrind -e "install.packages('clisymbols')"
RUN RDvalgrind -e "install.packages('fishMod')"
RUN RDvalgrind -e "install.packages('mvtnorm')"
RUN RDvalgrind -e "install.packages('glmmTMB')"
RUN RDvalgrind -e "install.packages('future')"
RUN RDvalgrind -e "install.packages('future.apply')"
RUN RDvalgrind -e "install.packages('ggforce')"
RUN RDvalgrind -e "install.packages('estimability')"
RUN RDvalgrind -e "install.packages('effects')"
RUN RDvalgrind -e "install.packages('emmeans')"
RUN RDvalgrind -e "install.packages('splancs')"
With another using RDcsan instead of RDvalgrind.
Do this on an Intel machine. M1/M2 Macs will be very slow with Docker here.
Increase Docker's RAM to 8 GB!
The error:
g++: fatal error: Killed signal terminated program cc1plus
Means the system ran out of memory when building a package!
Build it:
docker build --tag "r-debugging" .
Run it:
docker run --rm -v ~/src/sdmTMB:/sdmTMB -ti --security-opt seccomp=unconfined r-debugging
Put a test script in scratch/test.R
within sdmTMB. Then:
cp -r sdmTMB testdir
cd testdir
RDvalgrind -e "devtools::install()"
RDvalgrind -d valgrind -e "source('scratch/test.R')"
Valgrind is slow. Keep examples short. All examples took ~11 hours!
Or run all examples:
RDvalgrind -e "devtools::install()"
RDvalgrind -d valgrind -e 'devtools::run_examples()'
Or alternatively:
RDvalgrind -e "rcmdcheck::rcmdcheck(check_dir = './check')"
# cd as needed to 'check'
RDvalgrind -d valgrind --vanilla < "sdmTMB.Rcheck/sdmTMB-Ex.R"
For, RDSan, I ran R CMD check:
From other Docker:
RDcsan -e "rcmdcheck::rcmdcheck()"
This only took ~25 minutes.
Run tests with better location reporting:
RDcsan -e 'devtools::test("testdir", reporter = testthat::LocationReporter)'
https://www.stats.ox.ac.uk/pub/bdr/memtests/clang-UBSAN/sdmTMB/sdmTMB-Ex.Rout
Error arises at:
Perhaps painful in the short run, but one option is to submit the pull request to ggeffects so that ggpredict works and drop visreg support.