Skip to content

Commit 3c05c26

Browse files
20260218 - updates
1 parent fdd7446 commit 3c05c26

File tree

1 file changed

+43
-24
lines changed

1 file changed

+43
-24
lines changed

hpc.qmd

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,14 @@ Steps:
138138
```bash
139139
apptainer --version
140140
```
141-
If not available via apt (`E: Unable to locate package apptainer`), install from source (specify the version number for the latest release version available; see release versions [here](https://github.com/apptainer/apptainer/releases)):
141+
- If not available via apt (`E: Unable to locate package apptainer`), install from source (specify the version number for the latest release version available; see release versions [here](https://github.com/apptainer/apptainer/releases)):
142142
```bash
143143
export VERSION=1.4.5
144144
wget https://github.com/apptainer/apptainer/releases/download/v${VERSION}/apptainer-${VERSION}.tar.gz
145145
tar -xzf apptainer-${VERSION}.tar.gz
146146
cd apptainer-${VERSION}
147147
```
148-
If you installed from source, build Apptainer:
148+
- If you installed from source, build Apptainer:
149149
```bash
150150
./mconfig
151151
make -C builddir
@@ -166,6 +166,9 @@ Steps:
166166
From: rocker/r-ver:latest
167167
168168
%post
169+
# -------------------------------
170+
# Install system dependencies
171+
# -------------------------------
169172
apt-get update && apt-get install -y \
170173
libcurl4-openssl-dev \
171174
libssl-dev \
@@ -184,40 +187,56 @@ Steps:
184187
make \
185188
g++ \
186189
cmake \
187-
git
188-
190+
git \
191+
sudo
192+
193+
# -------------------------------
189194
# Install core CRAN packages
190-
R -e "install.packages(c( \
191-
'tidyverse', \
192-
'data.table', \
193-
'rstan', \
194-
'brms', \
195-
'mirt', \
196-
'lavaan', \
197-
'semTools', \
198-
'renv', \
199-
'remotes' \
195+
# -------------------------------
196+
R -e "install.packages(c(
197+
'tidyverse',
198+
'data.table',
199+
'rstan',
200+
'brms',
201+
'mirt',
202+
'lavaan',
203+
'semTools',
204+
'renv',
205+
'remotes'
200206
), repos='https://cloud.r-project.org')"
201-
202-
# Install cmdstanr from Stan R universe
203-
R -e "install.packages('cmdstanr', repos = c('https://stan-dev.r-universe.dev', 'https://cloud.r-project.org'))"
204-
205-
# Create directory for CmdStan
206-
mkdir -p /opt/cmdstan
207207
208-
# Install CmdStan into that directory
208+
# -------------------------------
209+
# Install cmdstanr
210+
# -------------------------------
211+
R -e "install.packages('cmdstanr', repos = c('https://stan-dev.r-universe.dev','https://cloud.r-project.org'))"
212+
213+
# -------------------------------
214+
# Install latest CmdStan into /opt/cmdstan
215+
# -------------------------------
216+
mkdir -p /opt/cmdstan
209217
R -e "cmdstanr::install_cmdstan(cores = 2, dir='/opt/cmdstan')"
210218
219+
# -------------------------------
220+
# Create a symlink 'latest' to the installed CmdStan version
221+
# -------------------------------
222+
cd /opt/cmdstan
223+
ln -s cmdstan-* latest
224+
225+
# -------------------------------
211226
# Enable threading for within-chain parallelization
227+
# -------------------------------
212228
mkdir -p /root/.R
213229
echo 'CXXFLAGS += -DSTAN_THREADS' >> /root/.R/Makevars
214-
215-
# Install latest version of petersenlab package
230+
231+
# -------------------------------
232+
# Install latest version of petersenlab package from GitHub
233+
# -------------------------------
216234
R -e "remotes::install_github('DevPsyLab/petersenlab')"
217235
236+
218237
%environment
219238
export R_LIBS_USER=/usr/local/lib/R/site-library
220-
export CMDSTAN=/opt/cmdstan/cmdstan-$(ls /opt/cmdstan)
239+
export CMDSTAN=/opt/cmdstan/latest
221240
222241
%runscript
223242
exec R "$@"

0 commit comments

Comments
 (0)