@@ -98,6 +98,158 @@ cd /Users/itpetersen/Documents/Projects/Test/
9898
9999< https://uiowa.atlassian.net/wiki/spaces/hpcdocs/pages/76513442/Singularity+Containers >
100100
101+ Steps:
102+
103+ 1 . Install Windows Subsystem for Linux (WSL)
104+ - In PowerShell (Admin):
105+ ``` bash
106+ wsl --install
107+ ```
108+ Restart the computer.
109+ It will install Ubuntu by default.
110+ 1. Update Ubuntu
111+ - Open Ubuntu
112+ - Inside the Ubuntu terminal, run:
113+ ` ` ` bash
114+ sudo apt update
115+ sudo apt upgrade -y
116+ ` ` `
117+ 1. Install Apptainer inside WSL
118+ - Inside the Ubuntu terminal, first install dependencies:
119+ ` ` ` bash
120+ sudo apt update
121+ sudo apt install -y \
122+ build-essential \
123+ libseccomp-dev \
124+ pkg-config \
125+ squashfs-tools \
126+ cryptsetup \
127+ curl \
128+ wget \
129+ git \
130+ uidmap \
131+ golang-go
132+ ` ` `
133+ - Now, install Apptainer:
134+ ` ` ` bash
135+ sudo apt install -y apptainer
136+ ` ` `
137+ - Verify installation:
138+ ` ` ` bash
139+ apptainer --version
140+ ` ` `
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)):
142+ ` ` ` bash
143+ export VERSION=1.4.5
144+ wget https://github.com/apptainer/apptainer/releases/download/v${VERSION} /apptainer-${VERSION} .tar.gz
145+ tar -xzf apptainer-${VERSION} .tar.gz
146+ cd apptainer-${VERSION}
147+ ` ` `
148+ If you installed from source, build Apptainer:
149+ ` ` ` bash
150+ ./mconfig
151+ make -C builddir
152+ sudo make -C builddir install
153+ ` ` `
154+ - Verify installation:
155+ ` ` ` bash
156+ apptainer --version
157+ ` ` `
158+ 1. Create your ` R` Container Definition File
159+ - Inside the Ubuntu terminal, run:
160+ ` ` ` bash
161+ nano r_argon.def
162+ ` ` `
163+ - Paste this:
164+ ` ` ` bash
165+ Bootstrap: docker
166+ From: rocker/r-ver:latest
167+
168+ %post
169+ apt-get update && apt-get install -y \
170+ libcurl4-openssl-dev \
171+ libssl-dev \
172+ libxml2-dev \
173+ libgit2-dev \
174+ libfontconfig1-dev \
175+ libfreetype6-dev \
176+ libharfbuzz-dev \
177+ libfribidi-dev \
178+ libpng-dev \
179+ libtiff5-dev \
180+ libjpeg-dev \
181+ libglpk-dev \
182+ libgmp3-dev \
183+ libmpfr-dev \
184+ make \
185+ g++ \
186+ cmake \
187+ git
188+
189+ # 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' \
200+ ), 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+ # Install CmdStan
206+ R -e " cmdstanr::install_cmdstan(cores = 2, dir='/opt/cmdstan')"
207+
208+ # Enable threading for within-chain parallelization
209+ mkdir -p /root/.R
210+ echo ' CXXFLAGS += -DSTAN_THREADS' >> /root/.R/Makevars
211+
212+ # Install latest version of petersenlab package
213+ R -e " remotes::install_github('DevPsyLab/petersenlab')"
214+
215+ %environment
216+ export R_LIBS_USER=/usr/local/lib/R/site-library
217+ export CMDSTAN=/opt/cmdstan/cmdstan-$( ls /opt/cmdstan)
218+
219+ %runscript
220+ exec R " $@ "
221+ ` ` `
222+ - Press ` Ctrl+O` to Save (i.e., " Write Out" )
223+ - Press Enter
224+ - Press ` Ctrl+X` to Exit
225+ 1. Build the Container
226+ - Inside the Ubuntu terminal, run:
227+ ` ` ` bash
228+ sudo apptainer build r_argon.sif r_argon.def
229+ ` ` `
230+ 1. Test the Container Locally
231+ - Inside the Ubuntu terminal, run:
232+ ` ` ` bash
233+ apptainer exec r_argon.sif R
234+ ` ` `
235+ - Check ` R` version:
236+ ` ` ` R
237+ version
238+ ` ` `
239+ - Check ` R` packages:
240+ ` ` ` R
241+ library(" brms" )
242+ library(" cmdstanr" )
243+ library(" petersenlab" )
244+ ` ` `
245+ - Exit ` R`
246+ ` ` ` R
247+ q ()
248+ ` ` `
249+ 1. Copy the Container to Argon
250+ 1. Test Container on Argon
251+ 1. Submit a Job Using the Container on Argon
252+
101253# Linux
102254
103255# # Initial run
0 commit comments