<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.anunna.wur.nl/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Honfi001</id>
	<title>HPCwiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.anunna.wur.nl/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Honfi001"/>
	<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/Special:Contributions/Honfi001"/>
	<updated>2026-07-09T11:11:46Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=File:Pi-tutorial-speedup-vs-cores.png&amp;diff=2957</id>
		<title>File:Pi-tutorial-speedup-vs-cores.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=File:Pi-tutorial-speedup-vs-cores.png&amp;diff=2957"/>
		<updated>2026-06-24T09:15:54Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: Speedup against the serial baseline. The dashed line is perfect (linear) speedup; real runs sit just below it.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary ==&lt;br /&gt;
Speedup against the serial baseline. The dashed line is perfect (linear) speedup; real runs sit just below it.&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=File:Pi-tutorial-walltime-vs-cores.png&amp;diff=2956</id>
		<title>File:Pi-tutorial-walltime-vs-cores.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=File:Pi-tutorial-walltime-vs-cores.png&amp;diff=2956"/>
		<updated>2026-06-24T09:14:55Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: Wall time falls as cores are added. Note both axes are logarithmic; a straight line here means near-ideal scaling.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary ==&lt;br /&gt;
Wall time falls as cores are added. Note both axes are logarithmic; a straight line here means near-ideal scaling.&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Tutorials&amp;diff=2955</id>
		<title>Tutorials</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Tutorials&amp;diff=2955"/>
		<updated>2026-06-24T09:01:06Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: /* Parallelism */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Hands-on tutorials for working on Anunna. For instructor-led courses see [[Workshops]], and for course slides and self-study material see [[Training Materials]].&lt;br /&gt;
&lt;br /&gt;
== Apptainer (containers) ==&lt;br /&gt;
&lt;br /&gt;
* [[Tutorials/Apptainer-Introduction|Introduction]]&lt;br /&gt;
* [[Tutorials/Apptainer-PullingImages|Pulling images]]&lt;br /&gt;
* [[Tutorials/Apptainer-FakerootAndOverlays|Fakeroot and overlays]]&lt;br /&gt;
* [[Tutorials/Apptainer-FakerootAndSandbox|Fakeroot and sandbox]]&lt;br /&gt;
* [[Tutorials/Apptainer-DefinitionFiles|Definition files]]&lt;br /&gt;
* [[Tutorials/Apptainer-GPUs|GPUs]]&lt;br /&gt;
&lt;br /&gt;
== Linux ==&lt;br /&gt;
&lt;br /&gt;
* [[Linux Basic/Linux Self Assessment]] — check whether your command-line skills are ready for the HPC and container courses.&lt;br /&gt;
&lt;br /&gt;
== Parallelism ==&lt;br /&gt;
&lt;br /&gt;
* [[Tutorials/Parallelism-Estimating-Pi|Estimating Pi]]&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Workshops]]&lt;br /&gt;
* [[Training Materials]]&lt;br /&gt;
* [[Apptainer]]&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=File:Pi-tutorial-best-per-approach.png&amp;diff=2954</id>
		<title>File:Pi-tutorial-best-per-approach.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=File:Pi-tutorial-best-per-approach.png&amp;diff=2954"/>
		<updated>2026-06-24T08:59:50Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: Plot of comparing the performance of different parallelization strategies for the MonteCarlo Pi Tutorial&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary ==&lt;br /&gt;
Plot of comparing the performance of different parallelization strategies for the MonteCarlo Pi Tutorial&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Tutorials/Parallelism-Estimating-Pi&amp;diff=2953</id>
		<title>Tutorials/Parallelism-Estimating-Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Tutorials/Parallelism-Estimating-Pi&amp;diff=2953"/>
		<updated>2026-06-24T08:40:03Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: Created page with &amp;quot;This tutorial is a gentle, hands-on introduction to &amp;#039;&amp;#039;&amp;#039;parallel computing on Anunna&amp;#039;&amp;#039;&amp;#039;. Instead of a heavy scientific code, it uses one friendly problem — estimating the number π by throwing random darts — and runs the &amp;#039;&amp;#039;same&amp;#039;&amp;#039; calculation across every kind of parallelism the cluster offers: a single core, many threads, many processes, multiple nodes, and a GPU. Because the problem stays the same, you can see exactly what each step up the ladder buys you.  You do no...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial is a gentle, hands-on introduction to &#039;&#039;&#039;parallel computing on Anunna&#039;&#039;&#039;. Instead of a heavy scientific code, it uses one friendly problem — estimating the number π by throwing random darts — and runs the &#039;&#039;same&#039;&#039; calculation across every kind of parallelism the cluster offers: a single core, many threads, many processes, multiple nodes, and a GPU. Because the problem stays the same, you can see exactly what each step up the ladder buys you.&lt;br /&gt;
&lt;br /&gt;
You do not need to write any C code. The whole exercise comes down to filling in &#039;&#039;&#039;two&#039;&#039;&#039; blanks in two job scripts, launching a batch of jobs, and reading three plots.&lt;br /&gt;
&lt;br /&gt;
== What you will learn ==&lt;br /&gt;
&lt;br /&gt;
* How a single program can be run serially, with threads (OpenMP), with processes (MPI), across several nodes, and on a GPU.&lt;br /&gt;
* How Slurm &#039;&#039;allocates&#039;&#039; resources and why your program still has to be &#039;&#039;told&#039;&#039; how many to use.&lt;br /&gt;
* The difference between &#039;&#039;&#039;strong scaling&#039;&#039;&#039; (same work, more workers, less time) and &#039;&#039;&#039;weak scaling&#039;&#039;&#039; (more workers, more work, same time).&lt;br /&gt;
* Why more workers make a calculation &#039;&#039;&#039;faster, not more accurate&#039;&#039;&#039;.&lt;br /&gt;
* How to read scaling and speedup plots — and where their limits are.&lt;br /&gt;
&lt;br /&gt;
== Before you begin ==&lt;br /&gt;
&lt;br /&gt;
You should already be comfortable logging into Anunna and submitting a basic Slurm job. If you are not sure, work through the [[Linux Basic/Linux Self Assessment|Linux Self Assessment]] first.&lt;br /&gt;
&lt;br /&gt;
You also need the &#039;&#039;&#039;course environment loaded&#039;&#039;&#039;, because it sets the &amp;lt;code&amp;gt;$myScratch&amp;lt;/code&amp;gt; variable that the tutorial relies on. If your instructor has not told you otherwise, it is loaded for you when you log in. You can check with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
echo &amp;quot;$myScratch&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If that prints a path under &amp;lt;code&amp;gt;/lustre/scratch/...&amp;lt;/code&amp;gt;, you are ready. If it prints nothing, load the course environment before continuing.&lt;br /&gt;
&lt;br /&gt;
Everything you run lives in two places:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;The shared tutorial&#039;&#039;&#039; at &amp;lt;code&amp;gt;/lustre/shared/hpcCourses/pi-tutorial&amp;lt;/code&amp;gt; — read-only, the same for everyone.&lt;br /&gt;
* &#039;&#039;&#039;Your personal copy&#039;&#039;&#039; at &amp;lt;code&amp;gt;$myScratch/hpcCourse/pi-tutorial&amp;lt;/code&amp;gt; — created the first time you launch, and where you make your edits.&lt;br /&gt;
&lt;br /&gt;
== The big idea: estimating π with random darts ==&lt;br /&gt;
&lt;br /&gt;
Imagine a square dartboard with a quarter-circle drawn inside it. If you throw darts at random and they land anywhere in the square with equal chance, the fraction that land &#039;&#039;inside&#039;&#039; the quarter-circle is exactly the ratio of the two areas — which works out to π/4. So if you throw &#039;&#039;&#039;N&#039;&#039;&#039; darts and &#039;&#039;&#039;H&#039;&#039;&#039; of them land inside:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
π ≈ 4 × H / N&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Throw more darts, and the estimate gets better. This is a &#039;&#039;&#039;Monte Carlo&#039;&#039;&#039; method: a calculation built out of huge numbers of independent random trials. It has one property that makes it perfect for teaching parallelism — every dart is independent, so the work splits cleanly across as many workers as you like, with almost no coordination between them.&lt;br /&gt;
&lt;br /&gt;
The tutorial implements this &#039;&#039;same&#039;&#039; dart-throwing kernel six ways:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Rung !! Program !! What it uses&lt;br /&gt;
|-&lt;br /&gt;
| serial || &amp;lt;code&amp;gt;pi_serial&amp;lt;/code&amp;gt; || one core (the reference)&lt;br /&gt;
|-&lt;br /&gt;
| OpenMP || &amp;lt;code&amp;gt;pi_omp&amp;lt;/code&amp;gt; || many threads on one node&lt;br /&gt;
|-&lt;br /&gt;
| MPI || &amp;lt;code&amp;gt;pi_mpi&amp;lt;/code&amp;gt; || many processes on one node&lt;br /&gt;
|-&lt;br /&gt;
| multi-node || &amp;lt;code&amp;gt;pi_mpi&amp;lt;/code&amp;gt; || processes spread across several nodes (same program)&lt;br /&gt;
|-&lt;br /&gt;
| GPU || &amp;lt;code&amp;gt;pi_gpu&amp;lt;/code&amp;gt; || thousands of device threads on one GPU&lt;br /&gt;
|-&lt;br /&gt;
| hybrid || &amp;lt;code&amp;gt;pi_hybrid&amp;lt;/code&amp;gt; || MPI processes, each running OpenMP threads&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Because the random-number generator is identical everywhere and each worker draws its own independent stream, the &#039;&#039;answer&#039;&#039; for a given number of darts and seed is the same no matter how the work is divided. Only the &#039;&#039;time&#039;&#039; changes. That is the whole point.&lt;br /&gt;
&lt;br /&gt;
== Step 1: Make the tutorial modules available ==&lt;br /&gt;
&lt;br /&gt;
The tutorial ships as a set of environment modules. Point Lmod at them once per session:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
module use /lustre/shared/hpcCourses/pi-tutorial/modules&lt;br /&gt;
module avail pi-tutorial&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will see three modules. They are mutually exclusive — loading one unloads the others:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;pi-tutorial&amp;lt;/code&amp;gt; — the CPU rungs (serial, OpenMP, MPI, hybrid).&lt;br /&gt;
* &amp;lt;code&amp;gt;pi-tutorial-cuda&amp;lt;/code&amp;gt; — the NVIDIA GPU rung.&lt;br /&gt;
* &amp;lt;code&amp;gt;pi-tutorial-rocm&amp;lt;/code&amp;gt; — the AMD GPU rung.&lt;br /&gt;
&lt;br /&gt;
You do not need to load these by hand for the exercise — each job script loads the right one for you. The &amp;lt;code&amp;gt;module use&amp;lt;/code&amp;gt; line above is enough.&lt;br /&gt;
&lt;br /&gt;
== Step 2: Get your personal copy of the scripts ==&lt;br /&gt;
&lt;br /&gt;
Run the launcher once:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
bash /lustre/shared/hpcCourses/pi-tutorial/exercise/launch.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On this first run it does three things: it copies the job scripts into your personal space at &amp;lt;code&amp;gt;$myScratch/hpcCourse/pi-tutorial/slurm&amp;lt;/code&amp;gt;, clears any old results, and submits the whole batch of jobs. Watch them with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
squeue --me&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Most of the jobs (serial, GPU, multi-node, hybrid) are complete and will run correctly. &#039;&#039;&#039;Two of them — the OpenMP and the MPI jobs — contain a deliberate blank&#039;&#039;&#039; and will not give a useful result yet. Fixing those blanks is your job, and it is the next step.&lt;br /&gt;
&lt;br /&gt;
== Step 3: Fill in the two blanks ==&lt;br /&gt;
&lt;br /&gt;
When you ask Slurm for resources, Slurm sets aside the cores or tasks you requested — but it does not automatically tell your &#039;&#039;program&#039;&#039; about them. You have to pass the number along. Slurm makes that easy by exporting the counts as environment variables. Your task is to connect the two.&lt;br /&gt;
&lt;br /&gt;
Open the OpenMP script in your personal copy (use &amp;lt;code&amp;gt;nano&amp;lt;/code&amp;gt; if you are not comfortable with &amp;lt;code&amp;gt;vi&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
nano $myScratch/hpcCourse/pi-tutorial/slurm/run_multithread.slurm&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will find this line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
export OMP_NUM_THREADS=FIXME&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The script asked Slurm for cores with &amp;lt;code&amp;gt;--cpus-per-task&amp;lt;/code&amp;gt;, and Slurm exported that count as &amp;lt;code&amp;gt;SLURM_CPUS_PER_TASK&amp;lt;/code&amp;gt;. Tell OpenMP to use exactly that many threads:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the MPI script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
nano $myScratch/hpcCourse/pi-tutorial/slurm/run_multiprocess.slurm&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here the blank is the number of processes to launch:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mpirun -np FIXME pi_mpi --total 1e10 --seed 12345&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This script asked Slurm for tasks with &amp;lt;code&amp;gt;--ntasks&amp;lt;/code&amp;gt;, and Slurm exported that as &amp;lt;code&amp;gt;SLURM_NTASKS&amp;lt;/code&amp;gt;. Launch one process per task:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mpirun -np ${SLURM_NTASKS} pi_mpi --total 1e10 --seed 12345&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That is the entire editable surface — two lines. Save both files.&lt;br /&gt;
&lt;br /&gt;
== Step 4: Launch the full sweep ==&lt;br /&gt;
&lt;br /&gt;
Run the launcher again:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
bash /lustre/shared/hpcCourses/pi-tutorial/exercise/launch.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This time it &#039;&#039;&#039;keeps your edited scripts&#039;&#039;&#039; (it never overwrites your copy), clears the old results, and resubmits everything. The launcher sweeps a range of sizes for you automatically — OpenMP from 1 up to 128 threads, MPI from 1 up to 128 processes — plus the GPU, multi-node, and hybrid runs.&lt;br /&gt;
&lt;br /&gt;
Keep an eye on the queue:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
squeue --me&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each finished job writes one result line into &amp;lt;code&amp;gt;$myScratch/hpcCourse/pi-tutorial/results&amp;lt;/code&amp;gt;. Wait until the queue is empty before moving on.&lt;br /&gt;
&lt;br /&gt;
== Step 5: Analyze your results ==&lt;br /&gt;
&lt;br /&gt;
The analysis script reads every result file, prints a summary table, and writes three plots. It needs matplotlib, which lives in the SciPy bundle:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
module load 2024 SciPy-bundle/2024a&lt;br /&gt;
python /lustre/shared/hpcCourses/pi-tutorial/analyze.py $myScratch/hpcCourse/pi-tutorial/results&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When it finishes you will have three PNG files in your results directory:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;walltime_vs_cores.png&amp;lt;/code&amp;gt; — how long each run took, against the number of cores.&lt;br /&gt;
* &amp;lt;code&amp;gt;speedup_vs_cores.png&amp;lt;/code&amp;gt; — how much faster than the serial run, against the ideal straight line.&lt;br /&gt;
* &amp;lt;code&amp;gt;best_per_approach.png&amp;lt;/code&amp;gt; — the single fastest run of each approach, side by side.&lt;br /&gt;
&lt;br /&gt;
Copy them to your laptop (for example with &amp;lt;code&amp;gt;scp&amp;lt;/code&amp;gt;) to view them, or open them through the OnDemand file browser.&lt;br /&gt;
&lt;br /&gt;
== Results ==&lt;br /&gt;
&lt;br /&gt;
[[File:Pi-tutorial-walltime-vs-cores.png|thumb|right|360px|Wall time falls as cores are added. Note both axes are logarithmic; a straight line here means near-ideal scaling.]]&lt;br /&gt;
[[File:Pi-tutorial-speedup-vs-cores.png|thumb|right|360px|Speedup against the serial baseline. The dashed line is perfect (linear) speedup; real runs sit just below it.]]&lt;br /&gt;
[[File:Pi-tutorial-best-per-approach.png|thumb|right|360px|The fastest run of each approach. The GPU finishes the same 10-billion-dart job in a fraction of the time the CPU rungs need.]]&lt;br /&gt;
&lt;br /&gt;
A correct run produces a table like the one below (trimmed; your exact times will vary by a few percent). Every run threw the same &#039;&#039;&#039;10 billion&#039;&#039;&#039; darts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
variant   nodes cores              device       wall_s            pi   pct_err&lt;br /&gt;
serial        1     1                 cpu       26.008     3.1416052   0.00040&lt;br /&gt;
omp           1     1                 cpu       26.499     3.1416052   0.00040&lt;br /&gt;
omp           1    16                 cpu        1.663     3.1415960   0.00011&lt;br /&gt;
omp           1   128                 cpu        0.235     3.1416075   0.00047&lt;br /&gt;
mpi           1     1                 cpu       69.676     3.1416052   0.00040&lt;br /&gt;
mpi           1   128                 cpu        0.555     3.1416075   0.00047&lt;br /&gt;
mpi           4    64                 cpu        1.090     3.1416039   0.00036&lt;br /&gt;
hybrid        4   128                 cpu        0.217     3.1416075   0.00047&lt;br /&gt;
gpu           1     1  AMD_Instinct_MI210        0.080     3.1415897   0.00009&lt;br /&gt;
gpu           1     1  NVIDIA_A100_80GB_PCIe     0.045     3.1415897   0.00009&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Two things are worth noticing straight away:&lt;br /&gt;
&lt;br /&gt;
* The serial run took about &#039;&#039;&#039;26 seconds&#039;&#039;&#039;; the 128-thread OpenMP run took about &#039;&#039;&#039;0.24 seconds&#039;&#039;&#039;; the A100 GPU finished in about &#039;&#039;&#039;0.045 seconds&#039;&#039;&#039;. The work was identical — only the time changed.&lt;br /&gt;
* Look at the &amp;lt;code&amp;gt;pi&amp;lt;/code&amp;gt; column. For any given total work and seed, the estimate is &#039;&#039;&#039;identical&#039;&#039;&#039; across serial, OpenMP, MPI, multi-node, and hybrid — for example every 128-core CPU run lands on 3.1416075. Splitting the darts across more workers did not change the answer, because each worker draws its own independent random stream. (The GPU differs in the last few digits because it uses far more streams; it still lands well within the expected error.)&lt;br /&gt;
&lt;br /&gt;
== Discussion ==&lt;br /&gt;
&lt;br /&gt;
The plots tell a tidy story: add workers, get proportionally faster, almost along the ideal line. That is real — but it is important to understand &#039;&#039;why&#039;&#039; it looks so clean, and where the limits are.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;This problem is unusually friendly.&#039;&#039;&#039; Throwing darts is &amp;quot;embarrassingly parallel&amp;quot;: the workers never need to talk to each other until the very end, when their hit-counts are summed. Most real scientific codes are not like this. A fluid-dynamics solver, a molecular-dynamics simulation, or a genome assembler has data dependencies and communication between workers, and that communication eventually caps how much faster you can go (this ceiling is known as &#039;&#039;&#039;Amdahl&#039;s law&#039;&#039;&#039;). Do not expect your own code to scale as cleanly as π does — this tutorial shows you the &#039;&#039;best&#039;&#039; case, not the typical one.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;More workers buy speed, not accuracy.&#039;&#039;&#039; The error of a Monte Carlo estimate shrinks with the number of darts as roughly 1/√N — so to halve the error you must throw &#039;&#039;&#039;four times&#039;&#039;&#039; as many darts. Adding cores lets you throw a fixed number of darts &#039;&#039;sooner&#039;&#039;, or throw &#039;&#039;more&#039;&#039; darts in the same time, but it never makes a fixed number of darts more accurate. Speed and accuracy are separate knobs.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Compare equal core counts.&#039;&#039;&#039; In the table, the 4-node MPI run (1.09 s) looks &#039;&#039;slower&#039;&#039; than the 1-node MPI run (0.56 s). It is not a penalty for crossing nodes — the 4-node run used &#039;&#039;&#039;64&#039;&#039;&#039; cores while the 1-node run used &#039;&#039;&#039;128&#039;&#039;&#039;. When you compare like with like (64 cores on 1 node ≈ 1.11 s versus 64 cores across 4 nodes ≈ 1.09 s) the times are essentially equal: for this workload the network between nodes is not a bottleneck. Always check the core count before reading a comparison as good or bad news.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The measurements are deliberately rough.&#039;&#039;&#039; Each point is a single run with a single seed, and the fastest runs finish in well under a second — far too short to time precisely on a shared machine. That noise is why a step in the curve can occasionally look &#039;&#039;better&#039;&#039; than perfect (&amp;quot;super-linear&amp;quot;); it is timing jitter, not magic. A proper benchmark repeats each run several times and reports the median. This tutorial trades that rigour for clarity and a short queue.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A real-world wrinkle.&#039;&#039;&#039; You may notice the single-process MPI run (about 70 s) is markedly slower than the single-thread OpenMP run (about 26 s) for the same work — and that gap persists across the sweep. That is a property of how this particular MPI program starts up and is being investigated; it is not a general rule that MPI is slower than OpenMP. It is a good reminder that &#039;&#039;how&#039;&#039; you measure matters as much as &#039;&#039;what&#039;&#039; you measure.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
You ran one calculation on a single core and on hundreds, on CPUs and on GPUs, on one node and across four — and the answer never changed, only the time. That is the core lesson of parallel computing on a cluster: &#039;&#039;&#039;you choose a parallel model to match the structure of your problem&#039;&#039;&#039;, and the reward is speed, not correctness.&lt;br /&gt;
&lt;br /&gt;
A few takeaways to carry forward:&lt;br /&gt;
&lt;br /&gt;
* If your work is made of independent pieces (parameter sweeps, many input files, Monte Carlo trials), it will parallelise well — threads, processes, or a GPU all help.&lt;br /&gt;
* If your work has steps that depend on each other, expect communication to limit your speedup, and measure before assuming more cores will help.&lt;br /&gt;
* More cores make things faster; only more samples (or a better method) make a Monte Carlo result more accurate.&lt;br /&gt;
&lt;br /&gt;
To go further, try editing a script to use &amp;lt;code&amp;gt;--per-worker&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;--total&amp;lt;/code&amp;gt; and watch the difference between weak and strong scaling, or move on to packaging your own software with the [[Tutorials/Apptainer-Introduction|Apptainer tutorials]].&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;&amp;lt;code&amp;gt;myScratch is not set&amp;lt;/code&amp;gt;&#039;&#039;&#039; — the course environment is not loaded. Load it and try again.&lt;br /&gt;
* &#039;&#039;&#039;A GPU job sits in the queue (pending)&#039;&#039;&#039; — the NVIDIA cards may be busy; the job will start when one frees up. The AMD GPU run uses a reservation and is the reliable one for the course.&lt;br /&gt;
* &#039;&#039;&#039;You edited a script badly and want a clean copy&#039;&#039;&#039; — delete your script folder and re-run the launcher to get fresh copies:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
rm -rf &amp;quot;$myScratch/hpcCourse/pi-tutorial/slurm&amp;quot;&lt;br /&gt;
bash /lustre/shared/hpcCourses/pi-tutorial/exercise/launch.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Linux Basic/Linux Self Assessment|Linux Self Assessment]] — check your command-line readiness.&lt;br /&gt;
* [[Tutorials/Apptainer-Introduction|Apptainer: Introduction]] — packaging software for reproducible runs.&lt;br /&gt;
* [[Tutorials|All tutorials]] · [[Workshops]] · [[Training Materials]]&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Tutorials&amp;diff=2952</id>
		<title>Tutorials</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Tutorials&amp;diff=2952"/>
		<updated>2026-06-24T08:38:43Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Hands-on tutorials for working on Anunna. For instructor-led courses see [[Workshops]], and for course slides and self-study material see [[Training Materials]].&lt;br /&gt;
&lt;br /&gt;
== Apptainer (containers) ==&lt;br /&gt;
&lt;br /&gt;
* [[Tutorials/Apptainer-Introduction|Introduction]]&lt;br /&gt;
* [[Tutorials/Apptainer-PullingImages|Pulling images]]&lt;br /&gt;
* [[Tutorials/Apptainer-FakerootAndOverlays|Fakeroot and overlays]]&lt;br /&gt;
* [[Tutorials/Apptainer-FakerootAndSandbox|Fakeroot and sandbox]]&lt;br /&gt;
* [[Tutorials/Apptainer-DefinitionFiles|Definition files]]&lt;br /&gt;
* [[Tutorials/Apptainer-GPUs|GPUs]]&lt;br /&gt;
&lt;br /&gt;
== Linux ==&lt;br /&gt;
&lt;br /&gt;
* [[Linux Basic/Linux Self Assessment]] — check whether your command-line skills are ready for the HPC and container courses.&lt;br /&gt;
&lt;br /&gt;
== Parallelism ==&lt;br /&gt;
&lt;br /&gt;
* Estimating Pi&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Workshops]]&lt;br /&gt;
* [[Training Materials]]&lt;br /&gt;
* [[Apptainer]]&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=HPC_Advanced&amp;diff=2788</id>
		<title>HPC Advanced</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=HPC_Advanced&amp;diff=2788"/>
		<updated>2026-06-17T12:14:06Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In this course, more experienced Anunna users will explore advanced topics such as job optimization, efficient resource usage, and installing applications and modules themselves. You are encouraged to bring your own use cases, which we will discuss and address in a plenary session where possible.&lt;br /&gt;
&lt;br /&gt;
Join this free 5-hour course covering advanced HPC topics.&lt;br /&gt;
&lt;br /&gt;
The course is organized by the Anunna team and SRF, with contributions from WUR scientists experienced in working on Anunna.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
See [[2026 Course dates]] for scheduling and registration details.&lt;br /&gt;
&lt;br /&gt;
==== Preparation ====&lt;br /&gt;
The course assumes that the student has attended the HPC basics course, if that is not the case, the student is able to &amp;quot;catch up&amp;quot; by completing the exercises in this page: [[HPC Advanced/Preparation Exercise|HPC Advanced Preparation Exercise]]&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=HPC_Advanced/Preparation_Exercise&amp;diff=2787</id>
		<title>HPC Advanced/Preparation Exercise</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=HPC_Advanced/Preparation_Exercise&amp;diff=2787"/>
		<updated>2026-06-17T06:24:53Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: /* Part 3 — The Launcher Script weather.sh */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= HPC Basics Refresher — Weather Data Analyser =&lt;br /&gt;
&lt;br /&gt;
{{Note|&#039;&#039;&#039;Who is this for?&#039;&#039;&#039; This is a self-paced preparation exercise for people who are attending the &#039;&#039;&#039;HPC Advanced&#039;&#039;&#039; course but did &#039;&#039;&#039;not&#039;&#039;&#039; attend &#039;&#039;&#039;HPC Basics&#039;&#039;&#039;. Working through it end to end means you arrive at the advanced course already comfortable with environment variables, virtual environments, launcher scripts, interactive jobs, and SLURM batch submission on &#039;&#039;&#039;Anunna&#039;&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The application:&#039;&#039;&#039; a small Python script that loads weather data from a Dutch weather station and draws some figures.&lt;br /&gt;
&lt;br /&gt;
Source: &amp;lt;code&amp;gt;/lustre/shared/hpcCourses/Basics/weer_vanaf_2000.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By the end you will have:&lt;br /&gt;
&lt;br /&gt;
* Set up handy Lustre path variables (&amp;lt;code&amp;gt;$myScratch&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;$myBkp&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;$myNoBkp&amp;lt;/code&amp;gt;) and aliases&lt;br /&gt;
* Created a Python virtual environment on Lustre scratch&lt;br /&gt;
* Written an executable launcher script (&amp;lt;code&amp;gt;weather.sh&amp;lt;/code&amp;gt;)&lt;br /&gt;
* Measured the job&#039;s memory requirement interactively&lt;br /&gt;
* Written and submitted a SLURM batch script (&amp;lt;code&amp;gt;weather.slurm&amp;lt;/code&amp;gt;) and collected the figures&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Conventions in this document:&#039;&#039; lines starting with &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; are commands you type at the shell (do not type the &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;). &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;placeholder&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; means &#039;&#039;substitute your own value&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Part 1 — Environment Variables &amp;amp; Aliases ==&lt;br /&gt;
&lt;br /&gt;
The Anunna &amp;lt;code&amp;gt;getLustreDir&amp;lt;/code&amp;gt; helper writes your personal Lustre directories (&amp;lt;code&amp;gt;$myScratch&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;$myBkp&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;$myNoBkp&amp;lt;/code&amp;gt;) into your environment so you never have to type long paths again.&lt;br /&gt;
&lt;br /&gt;
=== 1.1 — Set up the variables ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Provided it does not exist&lt;br /&gt;
# Create an empty ~/.bash_aliases if you do not already have one&lt;br /&gt;
$ touch ~/.bash_aliases&lt;br /&gt;
&lt;br /&gt;
# Load the anunna module &lt;br /&gt;
$ module load anunna&lt;br /&gt;
&lt;br /&gt;
# Inspect what getLustreDir does&lt;br /&gt;
$ getLustreDir -h&lt;br /&gt;
&lt;br /&gt;
# Append the export lines to your ~/.bash_aliases&lt;br /&gt;
$ getLustreDir -e &amp;gt;&amp;gt; ~/.bash_aliases&lt;br /&gt;
&lt;br /&gt;
# Check the result (cat, less, more or nano all work)&lt;br /&gt;
$ cat ~/.bash_aliases&lt;br /&gt;
&lt;br /&gt;
# Reload your environment so the new variables take effect&lt;br /&gt;
$ source ~/.bashrc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 1.2 — Test the variables ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Test 1 — does this print your scratch folder location?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ echo $myScratch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Test 2 — does this take you to your scratch folder?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ cd $myScratch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If both work, your variables are live.&lt;br /&gt;
&lt;br /&gt;
=== 1.3 — Bonus: convenience aliases ===&lt;br /&gt;
&lt;br /&gt;
Add these lines to your &amp;lt;code&amp;gt;~/.bash_aliases&amp;lt;/code&amp;gt; and reload your environment again:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias cds=&amp;quot;cd $myScratch&amp;quot;&lt;br /&gt;
alias cdb=&amp;quot;cd $myBkp&amp;quot;&lt;br /&gt;
alias cdn=&amp;quot;cd $myNoBkp&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|&#039;&#039;&#039;Important:&#039;&#039;&#039; the alias lines must come &#039;&#039;&#039;after&#039;&#039;&#039; the variable definitions in &amp;lt;code&amp;gt;~/.bash_aliases&amp;lt;/code&amp;gt;, because they reference those variables.}}&lt;br /&gt;
&lt;br /&gt;
If your aliases still do not work after &amp;lt;code&amp;gt;source ~/.bashrc&amp;lt;/code&amp;gt;, your &amp;lt;code&amp;gt;~/.bashrc&amp;lt;/code&amp;gt; may not be sourcing &amp;lt;code&amp;gt;~/.bash_aliases&amp;lt;/code&amp;gt; at all. Add this block to the &#039;&#039;&#039;end&#039;&#039;&#039; of your &amp;lt;code&amp;gt;~/.bashrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ -f ~/.bash_aliases ]; then&lt;br /&gt;
    . ~/.bash_aliases&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then &amp;lt;code&amp;gt;source ~/.bashrc&amp;lt;/code&amp;gt; once more.&lt;br /&gt;
&lt;br /&gt;
== Part 2 — Python Virtual Environment ==&lt;br /&gt;
&lt;br /&gt;
We isolate the analyser&#039;s dependencies in a virtual environment living on Lustre scratch.&lt;br /&gt;
&lt;br /&gt;
=== 2.1 — Load the software stack and Python ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ module purge&lt;br /&gt;
$ module load 2024&lt;br /&gt;
$ module load Python/3.12.3&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 2.2 — Create the virtual environment (in Lustre scratch) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir $myScratch/hpcCourse; cd $_&lt;br /&gt;
$ python -m venv $myScratch/hpcCourse/venv&lt;br /&gt;
$ source $myScratch/hpcCourse/venv/bin/activate&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;cd $_&amp;lt;/code&amp;gt; reuses the last argument of the previous command — here, the directory you just created.}}&lt;br /&gt;
&lt;br /&gt;
=== 2.3 — Check you are using the venv&#039;s Python ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ which python      # should point inside .../hpcCourse/venv/bin&lt;br /&gt;
$ python -V          # should report Python 3.12.3&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 2.4 — Install the required libraries ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pip install matplotlib pandas datetime&lt;br /&gt;
$ pip freeze          # for checking what is installed&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Part 3 — The Launcher Script &amp;lt;code&amp;gt;weather.sh&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
=== Tasks ===&lt;br /&gt;
&lt;br /&gt;
# Copy the Python script into your course folder:&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; inline&amp;gt;cp /lustre/shared/hpcCourses/Basics/weer_vanaf_2000.py $myScratch/hpcCourse/&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# Write a bash script called &#039;&#039;&#039;&amp;lt;code&amp;gt;weather.sh&amp;lt;/code&amp;gt;&#039;&#039;&#039; that loads the modules and activates the virtual environment you created, and make it executable.&lt;br /&gt;
# The script should end with the run command below. &#039;&#039;&#039;Hint:&#039;&#039;&#039; use variables for paths.&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; inline&amp;gt;python $myScratch/hpcCourse/weer_vanaf_2000.py 240&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#: (&amp;lt;code&amp;gt;240&amp;lt;/code&amp;gt; is the argument passed to the analyser — the number of months of data to plot, i.e. ~20 years.)&lt;br /&gt;
&lt;br /&gt;
=== Example solution — &amp;lt;code&amp;gt;weather.sh&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# weather.sh — load the environment and run the Weather Data Analyser&lt;br /&gt;
&lt;br /&gt;
# Load the software stack and Python&lt;br /&gt;
module purge&lt;br /&gt;
module load 2024&lt;br /&gt;
module load Python/3.12.3&lt;br /&gt;
&lt;br /&gt;
# Activate the virtual environment&lt;br /&gt;
source &amp;quot;$myScratch/hpcCourse/venv/bin/activate&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Run the analyser (240 = ID of this specific weather station)&lt;br /&gt;
python &amp;quot;$myScratch/hpcCourse/weer_vanaf_2000.py&amp;quot; 240&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make it executable:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ chmod +x $myScratch/hpcCourse/weather.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Part 4 — Find the Job Requirements ==&lt;br /&gt;
&lt;br /&gt;
Before submitting a batch job you need to know how much memory it needs. We start with a deliberately small allocation and increase it until the job stops crashing.&lt;br /&gt;
&lt;br /&gt;
=== Task ===&lt;br /&gt;
&lt;br /&gt;
Find the job requirements (e.g. memory) of the Python script using &amp;lt;code&amp;gt;sinteractive&amp;lt;/code&amp;gt;. Increase the amount of RAM until the job no longer crashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ sinteractive --mem 100M --time=0-0:10 -c 1&lt;br /&gt;
$ cd $myScratch/hpcCourse&lt;br /&gt;
$ ./weather.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the job is killed (out-of-memory), exit the interactive session, re-launch &amp;lt;code&amp;gt;sinteractive&amp;lt;/code&amp;gt; with a larger &amp;lt;code&amp;gt;--mem&amp;lt;/code&amp;gt; value (e.g. &amp;lt;code&amp;gt;200M&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;500M&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;1G&amp;lt;/code&amp;gt;, …) and run again. Repeat until &amp;lt;code&amp;gt;weather.sh&amp;lt;/code&amp;gt; completes cleanly. &#039;&#039;&#039;Note the smallest &amp;lt;code&amp;gt;--mem&amp;lt;/code&amp;gt; value that works&#039;&#039;&#039; — you will use it in Step 3.&lt;br /&gt;
&lt;br /&gt;
== Part 5 — Write and Submit a SLURM Script ==&lt;br /&gt;
&lt;br /&gt;
=== Tasks ===&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Write&#039;&#039;&#039; a SLURM script for the job using the resource requirements you determined in Step 2. Label it &#039;&#039;&#039;&amp;lt;code&amp;gt;weather.slurm&amp;lt;/code&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
# &#039;&#039;&#039;Submit&#039;&#039;&#039; the job with &amp;lt;code&amp;gt;sbatch&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &#039;&#039;&#039;Check the status&#039;&#039;&#039; of your job and cancel it if needed, though probably not since the jobs are very short.&lt;br /&gt;
# &#039;&#039;&#039;Check the figures&#039;&#039;&#039; generated by the Python script.&lt;br /&gt;
&lt;br /&gt;
{{Note|&#039;&#039;&#039;Tip:&#039;&#039;&#039; a SLURM template is available at &amp;lt;code&amp;gt;/lustre/shared/hpcCourses/Basics/script_slurm.sh&amp;lt;/code&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
=== Example solution — &amp;lt;code&amp;gt;weather.slurm&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --job-name=weather&lt;br /&gt;
#SBATCH --mem=&amp;lt;RAM-from-Step-2&amp;gt;     # e.g. 500M — the value you found in Step 2&lt;br /&gt;
#SBATCH --time=0-0:10&lt;br /&gt;
#SBATCH --cpus-per-task=1&lt;br /&gt;
#SBATCH --output=weather-%j.out&lt;br /&gt;
#SBATCH --error=weather-%j.err&lt;br /&gt;
&lt;br /&gt;
cd &amp;quot;$myScratch/hpcCourse&amp;quot;&lt;br /&gt;
./weather.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Submit, monitor, and collect results ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Submit the job&lt;br /&gt;
$ sbatch weather.slurm&lt;br /&gt;
&lt;br /&gt;
# Check the status of your jobs&lt;br /&gt;
$ squeue --me&lt;br /&gt;
&lt;br /&gt;
# Cancel a job if needed (replace &amp;lt;jobid&amp;gt; with the ID from squeue / sbatch)&lt;br /&gt;
$ scancel &amp;lt;jobid&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Once finished, inspect the output and the generated figures&lt;br /&gt;
$ ls $myScratch/hpcCourse&lt;br /&gt;
$ cat weather-&amp;lt;jobid&amp;gt;.out&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The analyser writes its figures into your course folder — open them to confirm the run succeeded.&lt;br /&gt;
&lt;br /&gt;
== Checklist ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;echo $myScratch&amp;lt;/code&amp;gt; prints your scratch path and &amp;lt;code&amp;gt;cd $myScratch&amp;lt;/code&amp;gt; works&lt;br /&gt;
* &amp;lt;code&amp;gt;cds&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;cdb&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;cdn&amp;lt;/code&amp;gt; aliases jump to the right folders&lt;br /&gt;
* Virtual environment activates and &amp;lt;code&amp;gt;which python&amp;lt;/code&amp;gt; points inside it&lt;br /&gt;
* &amp;lt;code&amp;gt;weather.sh&amp;lt;/code&amp;gt; is executable and runs the analyser interactively&lt;br /&gt;
* You know the minimum &amp;lt;code&amp;gt;--mem&amp;lt;/code&amp;gt; the job needs (from Step 2)&lt;br /&gt;
* &amp;lt;code&amp;gt;weather.slurm&amp;lt;/code&amp;gt; submits with &amp;lt;code&amp;gt;sbatch&amp;lt;/code&amp;gt; and the figures are generated&lt;br /&gt;
&lt;br /&gt;
You are now ready for the &#039;&#039;&#039;HPC Advanced&#039;&#039;&#039; course.&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=HPC_Advanced/Preparation_Exercise&amp;diff=2786</id>
		<title>HPC Advanced/Preparation Exercise</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=HPC_Advanced/Preparation_Exercise&amp;diff=2786"/>
		<updated>2026-06-17T06:20:26Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: Fix headers&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= HPC Basics Refresher — Weather Data Analyser =&lt;br /&gt;
&lt;br /&gt;
{{Note|&#039;&#039;&#039;Who is this for?&#039;&#039;&#039; This is a self-paced preparation exercise for people who are attending the &#039;&#039;&#039;HPC Advanced&#039;&#039;&#039; course but did &#039;&#039;&#039;not&#039;&#039;&#039; attend &#039;&#039;&#039;HPC Basics&#039;&#039;&#039;. Working through it end to end means you arrive at the advanced course already comfortable with environment variables, virtual environments, launcher scripts, interactive jobs, and SLURM batch submission on &#039;&#039;&#039;Anunna&#039;&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The application:&#039;&#039;&#039; a small Python script that loads weather data from a Dutch weather station and draws some figures.&lt;br /&gt;
&lt;br /&gt;
Source: &amp;lt;code&amp;gt;/lustre/shared/hpcCourses/Basics/weer_vanaf_2000.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By the end you will have:&lt;br /&gt;
&lt;br /&gt;
* Set up handy Lustre path variables (&amp;lt;code&amp;gt;$myScratch&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;$myBkp&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;$myNoBkp&amp;lt;/code&amp;gt;) and aliases&lt;br /&gt;
* Created a Python virtual environment on Lustre scratch&lt;br /&gt;
* Written an executable launcher script (&amp;lt;code&amp;gt;weather.sh&amp;lt;/code&amp;gt;)&lt;br /&gt;
* Measured the job&#039;s memory requirement interactively&lt;br /&gt;
* Written and submitted a SLURM batch script (&amp;lt;code&amp;gt;weather.slurm&amp;lt;/code&amp;gt;) and collected the figures&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Conventions in this document:&#039;&#039; lines starting with &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; are commands you type at the shell (do not type the &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;). &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;placeholder&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; means &#039;&#039;substitute your own value&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Part 1 — Environment Variables &amp;amp; Aliases ==&lt;br /&gt;
&lt;br /&gt;
The Anunna &amp;lt;code&amp;gt;getLustreDir&amp;lt;/code&amp;gt; helper writes your personal Lustre directories (&amp;lt;code&amp;gt;$myScratch&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;$myBkp&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;$myNoBkp&amp;lt;/code&amp;gt;) into your environment so you never have to type long paths again.&lt;br /&gt;
&lt;br /&gt;
=== 1.1 — Set up the variables ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Provided it does not exist&lt;br /&gt;
# Create an empty ~/.bash_aliases if you do not already have one&lt;br /&gt;
$ touch ~/.bash_aliases&lt;br /&gt;
&lt;br /&gt;
# Load the anunna module &lt;br /&gt;
$ module load anunna&lt;br /&gt;
&lt;br /&gt;
# Inspect what getLustreDir does&lt;br /&gt;
$ getLustreDir -h&lt;br /&gt;
&lt;br /&gt;
# Append the export lines to your ~/.bash_aliases&lt;br /&gt;
$ getLustreDir -e &amp;gt;&amp;gt; ~/.bash_aliases&lt;br /&gt;
&lt;br /&gt;
# Check the result (cat, less, more or nano all work)&lt;br /&gt;
$ cat ~/.bash_aliases&lt;br /&gt;
&lt;br /&gt;
# Reload your environment so the new variables take effect&lt;br /&gt;
$ source ~/.bashrc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 1.2 — Test the variables ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Test 1 — does this print your scratch folder location?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ echo $myScratch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Test 2 — does this take you to your scratch folder?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ cd $myScratch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If both work, your variables are live.&lt;br /&gt;
&lt;br /&gt;
=== 1.3 — Bonus: convenience aliases ===&lt;br /&gt;
&lt;br /&gt;
Add these lines to your &amp;lt;code&amp;gt;~/.bash_aliases&amp;lt;/code&amp;gt; and reload your environment again:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias cds=&amp;quot;cd $myScratch&amp;quot;&lt;br /&gt;
alias cdb=&amp;quot;cd $myBkp&amp;quot;&lt;br /&gt;
alias cdn=&amp;quot;cd $myNoBkp&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|&#039;&#039;&#039;Important:&#039;&#039;&#039; the alias lines must come &#039;&#039;&#039;after&#039;&#039;&#039; the variable definitions in &amp;lt;code&amp;gt;~/.bash_aliases&amp;lt;/code&amp;gt;, because they reference those variables.}}&lt;br /&gt;
&lt;br /&gt;
If your aliases still do not work after &amp;lt;code&amp;gt;source ~/.bashrc&amp;lt;/code&amp;gt;, your &amp;lt;code&amp;gt;~/.bashrc&amp;lt;/code&amp;gt; may not be sourcing &amp;lt;code&amp;gt;~/.bash_aliases&amp;lt;/code&amp;gt; at all. Add this block to the &#039;&#039;&#039;end&#039;&#039;&#039; of your &amp;lt;code&amp;gt;~/.bashrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ -f ~/.bash_aliases ]; then&lt;br /&gt;
    . ~/.bash_aliases&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then &amp;lt;code&amp;gt;source ~/.bashrc&amp;lt;/code&amp;gt; once more.&lt;br /&gt;
&lt;br /&gt;
== Part 2 — Python Virtual Environment ==&lt;br /&gt;
&lt;br /&gt;
We isolate the analyser&#039;s dependencies in a virtual environment living on Lustre scratch.&lt;br /&gt;
&lt;br /&gt;
=== 2.1 — Load the software stack and Python ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ module purge&lt;br /&gt;
$ module load 2024&lt;br /&gt;
$ module load Python/3.12.3&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 2.2 — Create the virtual environment (in Lustre scratch) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir $myScratch/hpcCourse; cd $_&lt;br /&gt;
$ python -m venv $myScratch/hpcCourse/venv&lt;br /&gt;
$ source $myScratch/hpcCourse/venv/bin/activate&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;cd $_&amp;lt;/code&amp;gt; reuses the last argument of the previous command — here, the directory you just created.}}&lt;br /&gt;
&lt;br /&gt;
=== 2.3 — Check you are using the venv&#039;s Python ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ which python      # should point inside .../hpcCourse/venv/bin&lt;br /&gt;
$ python -V          # should report Python 3.12.3&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 2.4 — Install the required libraries ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pip install matplotlib pandas datetime&lt;br /&gt;
$ pip freeze          # for checking what is installed&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Part 3 — The Launcher Script &amp;lt;code&amp;gt;weather.sh&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
=== Tasks ===&lt;br /&gt;
&lt;br /&gt;
# Copy the Python script into your course folder:&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; inline&amp;gt;cp /lustre/shared/hpcCourses/Basics/weer_vanaf_2000.py $myScratch/hpcCourse/&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# Write a bash script called &#039;&#039;&#039;&amp;lt;code&amp;gt;weather.sh&amp;lt;/code&amp;gt;&#039;&#039;&#039; that loads the modules and activates the virtual environment you created, and make it executable.&lt;br /&gt;
# The script should end with the run command below. &#039;&#039;&#039;Hint:&#039;&#039;&#039; use variables for paths.&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; inline&amp;gt;python $myScratch/hpcCourse/weer_vanaf_2000.py 240&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#: (&amp;lt;code&amp;gt;240&amp;lt;/code&amp;gt; is the argument passed to the analyser — the number of months of data to plot, i.e. ~20 years.)&lt;br /&gt;
&lt;br /&gt;
=== Example solution — &amp;lt;code&amp;gt;weather.sh&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# weather.sh — load the environment and run the Weather Data Analyser&lt;br /&gt;
&lt;br /&gt;
# Load the software stack and Python&lt;br /&gt;
module purge&lt;br /&gt;
module load 2024&lt;br /&gt;
module load Python/3.12.3&lt;br /&gt;
&lt;br /&gt;
# Activate the virtual environment&lt;br /&gt;
source &amp;quot;$myScratch/hpcCourse/venv/bin/activate&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Run the analyser (240 = months of data to plot, ~20 years)&lt;br /&gt;
python &amp;quot;$myScratch/hpcCourse/weer_vanaf_2000.py&amp;quot; 240&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make it executable:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ chmod +x $myScratch/hpcCourse/weather.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Part 4 — Find the Job Requirements ==&lt;br /&gt;
&lt;br /&gt;
Before submitting a batch job you need to know how much memory it needs. We start with a deliberately small allocation and increase it until the job stops crashing.&lt;br /&gt;
&lt;br /&gt;
=== Task ===&lt;br /&gt;
&lt;br /&gt;
Find the job requirements (e.g. memory) of the Python script using &amp;lt;code&amp;gt;sinteractive&amp;lt;/code&amp;gt;. Increase the amount of RAM until the job no longer crashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ sinteractive --mem 100M --time=0-0:10 -c 1&lt;br /&gt;
$ cd $myScratch/hpcCourse&lt;br /&gt;
$ ./weather.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the job is killed (out-of-memory), exit the interactive session, re-launch &amp;lt;code&amp;gt;sinteractive&amp;lt;/code&amp;gt; with a larger &amp;lt;code&amp;gt;--mem&amp;lt;/code&amp;gt; value (e.g. &amp;lt;code&amp;gt;200M&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;500M&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;1G&amp;lt;/code&amp;gt;, …) and run again. Repeat until &amp;lt;code&amp;gt;weather.sh&amp;lt;/code&amp;gt; completes cleanly. &#039;&#039;&#039;Note the smallest &amp;lt;code&amp;gt;--mem&amp;lt;/code&amp;gt; value that works&#039;&#039;&#039; — you will use it in Step 3.&lt;br /&gt;
&lt;br /&gt;
== Part 5 — Write and Submit a SLURM Script ==&lt;br /&gt;
&lt;br /&gt;
=== Tasks ===&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Write&#039;&#039;&#039; a SLURM script for the job using the resource requirements you determined in Step 2. Label it &#039;&#039;&#039;&amp;lt;code&amp;gt;weather.slurm&amp;lt;/code&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
# &#039;&#039;&#039;Submit&#039;&#039;&#039; the job with &amp;lt;code&amp;gt;sbatch&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &#039;&#039;&#039;Check the status&#039;&#039;&#039; of your job and cancel it if needed.&lt;br /&gt;
# &#039;&#039;&#039;Check the figures&#039;&#039;&#039; generated by the Python script.&lt;br /&gt;
&lt;br /&gt;
{{Note|&#039;&#039;&#039;Tip:&#039;&#039;&#039; a SLURM template is available at &amp;lt;code&amp;gt;/lustre/shared/hpcCourses/Basics/script_slurm.sh&amp;lt;/code&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
=== Example solution — &amp;lt;code&amp;gt;weather.slurm&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --job-name=weather&lt;br /&gt;
#SBATCH --mem=&amp;lt;RAM-from-Step-2&amp;gt;     # e.g. 500M — the value you found in Step 2&lt;br /&gt;
#SBATCH --time=0-0:10&lt;br /&gt;
#SBATCH --cpus-per-task=1&lt;br /&gt;
#SBATCH --output=weather-%j.out&lt;br /&gt;
#SBATCH --error=weather-%j.err&lt;br /&gt;
&lt;br /&gt;
cd &amp;quot;$myScratch/hpcCourse&amp;quot;&lt;br /&gt;
./weather.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Submit, monitor, and collect results ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Submit the job&lt;br /&gt;
$ sbatch weather.slurm&lt;br /&gt;
&lt;br /&gt;
# Check the status of your jobs&lt;br /&gt;
$ squeue --me&lt;br /&gt;
&lt;br /&gt;
# Cancel a job if needed (replace &amp;lt;jobid&amp;gt; with the ID from squeue / sbatch)&lt;br /&gt;
$ scancel &amp;lt;jobid&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Once finished, inspect the output and the generated figures&lt;br /&gt;
$ ls $myScratch/hpcCourse&lt;br /&gt;
$ cat weather-&amp;lt;jobid&amp;gt;.out&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The analyser writes its figures into your course folder — open them to confirm the run succeeded.&lt;br /&gt;
&lt;br /&gt;
== Checklist ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;echo $myScratch&amp;lt;/code&amp;gt; prints your scratch path and &amp;lt;code&amp;gt;cd $myScratch&amp;lt;/code&amp;gt; works&lt;br /&gt;
* &amp;lt;code&amp;gt;cds&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;cdb&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;cdn&amp;lt;/code&amp;gt; aliases jump to the right folders&lt;br /&gt;
* Virtual environment activates and &amp;lt;code&amp;gt;which python&amp;lt;/code&amp;gt; points inside it&lt;br /&gt;
* &amp;lt;code&amp;gt;weather.sh&amp;lt;/code&amp;gt; is executable and runs the analyser interactively&lt;br /&gt;
* You know the minimum &amp;lt;code&amp;gt;--mem&amp;lt;/code&amp;gt; the job needs (from Step 2)&lt;br /&gt;
* &amp;lt;code&amp;gt;weather.slurm&amp;lt;/code&amp;gt; submits with &amp;lt;code&amp;gt;sbatch&amp;lt;/code&amp;gt; and the figures are generated&lt;br /&gt;
&lt;br /&gt;
You are now ready for the &#039;&#039;&#039;HPC Advanced&#039;&#039;&#039; course.&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=HPC_Advanced/Preparation_Exercise&amp;diff=2771</id>
		<title>HPC Advanced/Preparation Exercise</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=HPC_Advanced/Preparation_Exercise&amp;diff=2771"/>
		<updated>2026-06-16T13:55:10Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: /* 1.1 — Set up the variables */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= HPC Basics Refresher — Weather Data Analyser =&lt;br /&gt;
&lt;br /&gt;
{{Note|&#039;&#039;&#039;Who is this for?&#039;&#039;&#039; This is a self-paced preparation exercise for people who are attending the &#039;&#039;&#039;HPC Advanced&#039;&#039;&#039; course but did &#039;&#039;&#039;not&#039;&#039;&#039; attend &#039;&#039;&#039;HPC Basics&#039;&#039;&#039;. Working through it end to end means you arrive at the advanced course already comfortable with environment variables, virtual environments, launcher scripts, interactive jobs, and SLURM batch submission on &#039;&#039;&#039;Anunna&#039;&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The application:&#039;&#039;&#039; a small Python script that loads weather data from a Dutch weather station and draws some figures.&lt;br /&gt;
&lt;br /&gt;
Source: &amp;lt;code&amp;gt;/lustre/shared/hpcCourses/Basics/weer_vanaf_2000.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By the end you will have:&lt;br /&gt;
&lt;br /&gt;
* Set up handy Lustre path variables (&amp;lt;code&amp;gt;$myScratch&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;$myBkp&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;$myNoBkp&amp;lt;/code&amp;gt;) and aliases&lt;br /&gt;
* Created a Python virtual environment on Lustre scratch&lt;br /&gt;
* Written an executable launcher script (&amp;lt;code&amp;gt;weather.sh&amp;lt;/code&amp;gt;)&lt;br /&gt;
* Measured the job&#039;s memory requirement interactively&lt;br /&gt;
* Written and submitted a SLURM batch script (&amp;lt;code&amp;gt;weather.slurm&amp;lt;/code&amp;gt;) and collected the figures&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Conventions in this document:&#039;&#039; lines starting with &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; are commands you type at the shell (do not type the &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;). &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;placeholder&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; means &#039;&#039;substitute your own value&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Part 1 — Environment Variables &amp;amp; Aliases ==&lt;br /&gt;
&lt;br /&gt;
The Anunna &amp;lt;code&amp;gt;getLustreDir&amp;lt;/code&amp;gt; helper writes your personal Lustre directories (&amp;lt;code&amp;gt;$myScratch&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;$myBkp&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;$myNoBkp&amp;lt;/code&amp;gt;) into your environment so you never have to type long paths again.&lt;br /&gt;
&lt;br /&gt;
=== 1.1 — Set up the variables ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Provided it does not exist&lt;br /&gt;
# Create an empty ~/.bash_aliases if you do not already have one&lt;br /&gt;
$ touch ~/.bash_aliases&lt;br /&gt;
&lt;br /&gt;
# Load the anunna module &lt;br /&gt;
$ module load anunna&lt;br /&gt;
&lt;br /&gt;
# Inspect what getLustreDir does&lt;br /&gt;
$ getLustreDir -h&lt;br /&gt;
&lt;br /&gt;
# Append the export lines to your ~/.bash_aliases&lt;br /&gt;
$ getLustreDir -e &amp;gt;&amp;gt; ~/.bash_aliases&lt;br /&gt;
&lt;br /&gt;
# Check the result (cat, less, more or nano all work)&lt;br /&gt;
$ cat ~/.bash_aliases&lt;br /&gt;
&lt;br /&gt;
# Reload your environment so the new variables take effect&lt;br /&gt;
$ source ~/.bashrc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 1.2 — Test the variables ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Test 1 — does this print your scratch folder location?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ echo $myScratch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Test 2 — does this take you to your scratch folder?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ cd $myScratch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If both work, your variables are live.&lt;br /&gt;
&lt;br /&gt;
=== 1.3 — Bonus: convenience aliases ===&lt;br /&gt;
&lt;br /&gt;
Add these lines to your &amp;lt;code&amp;gt;~/.bash_aliases&amp;lt;/code&amp;gt; and reload your environment again:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias cds=&amp;quot;cd $myScratch&amp;quot;&lt;br /&gt;
alias cdb=&amp;quot;cd $myBkp&amp;quot;&lt;br /&gt;
alias cdn=&amp;quot;cd $myNoBkp&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|&#039;&#039;&#039;Important:&#039;&#039;&#039; the alias lines must come &#039;&#039;&#039;after&#039;&#039;&#039; the variable definitions in &amp;lt;code&amp;gt;~/.bash_aliases&amp;lt;/code&amp;gt;, because they reference those variables.}}&lt;br /&gt;
&lt;br /&gt;
If your aliases still do not work after &amp;lt;code&amp;gt;source ~/.bashrc&amp;lt;/code&amp;gt;, your &amp;lt;code&amp;gt;~/.bashrc&amp;lt;/code&amp;gt; may not be sourcing &amp;lt;code&amp;gt;~/.bash_aliases&amp;lt;/code&amp;gt; at all. Add this block to the &#039;&#039;&#039;end&#039;&#039;&#039; of your &amp;lt;code&amp;gt;~/.bashrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ -f ~/.bash_aliases ]; then&lt;br /&gt;
    . ~/.bash_aliases&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then &amp;lt;code&amp;gt;source ~/.bashrc&amp;lt;/code&amp;gt; once more.&lt;br /&gt;
&lt;br /&gt;
== Part 2 (Step 0) — Python Virtual Environment ==&lt;br /&gt;
&lt;br /&gt;
We isolate the analyser&#039;s dependencies in a virtual environment living on Lustre scratch.&lt;br /&gt;
&lt;br /&gt;
=== 2.1 — Load the software stack and Python ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ module purge&lt;br /&gt;
$ module load 2024&lt;br /&gt;
$ module load Python/3.12.3&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 2.2 — Create the virtual environment (in Lustre scratch) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir $myScratch/hpcCourse; cd $_&lt;br /&gt;
$ python -m venv $myScratch/hpcCourse/venv&lt;br /&gt;
$ source $myScratch/hpcCourse/venv/bin/activate&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;cd $_&amp;lt;/code&amp;gt; reuses the last argument of the previous command — here, the directory you just created.}}&lt;br /&gt;
&lt;br /&gt;
=== 2.3 — Check you are using the venv&#039;s Python ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ which python      # should point inside .../hpcCourse/venv/bin&lt;br /&gt;
$ python -V          # should report Python 3.12.3&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 2.4 — Install the required libraries ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pip install matplotlib pandas datetime&lt;br /&gt;
$ pip freeze          # for checking what is installed&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Part 3 (Step 1) — The Launcher Script &amp;lt;code&amp;gt;weather.sh&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
=== Tasks ===&lt;br /&gt;
&lt;br /&gt;
# Copy the Python script into your course folder:&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; inline&amp;gt;cp /lustre/shared/hpcCourses/Basics/weer_vanaf_2000.py $myScratch/hpcCourse/&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# Write a bash script called &#039;&#039;&#039;&amp;lt;code&amp;gt;weather.sh&amp;lt;/code&amp;gt;&#039;&#039;&#039; that loads the modules and activates the virtual environment you created, and make it executable.&lt;br /&gt;
# The script should end with the run command below. &#039;&#039;&#039;Hint:&#039;&#039;&#039; use variables for paths.&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; inline&amp;gt;python $myScratch/hpcCourse/weer_vanaf_2000.py 240&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#: (&amp;lt;code&amp;gt;240&amp;lt;/code&amp;gt; is the argument passed to the analyser — the number of months of data to plot, i.e. ~20 years.)&lt;br /&gt;
&lt;br /&gt;
=== Example solution — &amp;lt;code&amp;gt;weather.sh&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# weather.sh — load the environment and run the Weather Data Analyser&lt;br /&gt;
&lt;br /&gt;
# Load the software stack and Python&lt;br /&gt;
module purge&lt;br /&gt;
module load 2024&lt;br /&gt;
module load Python/3.12.3&lt;br /&gt;
&lt;br /&gt;
# Activate the virtual environment&lt;br /&gt;
source &amp;quot;$myScratch/hpcCourse/venv/bin/activate&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Run the analyser (240 = months of data to plot, ~20 years)&lt;br /&gt;
python &amp;quot;$myScratch/hpcCourse/weer_vanaf_2000.py&amp;quot; 240&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make it executable:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ chmod +x $myScratch/hpcCourse/weather.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Part 4 (Step 2) — Find the Job Requirements ==&lt;br /&gt;
&lt;br /&gt;
Before submitting a batch job you need to know how much memory it needs. We start with a deliberately small allocation and increase it until the job stops crashing.&lt;br /&gt;
&lt;br /&gt;
=== Task ===&lt;br /&gt;
&lt;br /&gt;
Find the job requirements (e.g. memory) of the Python script using &amp;lt;code&amp;gt;sinteractive&amp;lt;/code&amp;gt;. Increase the amount of RAM until the job no longer crashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ sinteractive --mem 100M --time=0-0:10 -c 1&lt;br /&gt;
$ cd $myScratch/hpcCourse&lt;br /&gt;
$ ./weather.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the job is killed (out-of-memory), exit the interactive session, re-launch &amp;lt;code&amp;gt;sinteractive&amp;lt;/code&amp;gt; with a larger &amp;lt;code&amp;gt;--mem&amp;lt;/code&amp;gt; value (e.g. &amp;lt;code&amp;gt;200M&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;500M&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;1G&amp;lt;/code&amp;gt;, …) and run again. Repeat until &amp;lt;code&amp;gt;weather.sh&amp;lt;/code&amp;gt; completes cleanly. &#039;&#039;&#039;Note the smallest &amp;lt;code&amp;gt;--mem&amp;lt;/code&amp;gt; value that works&#039;&#039;&#039; — you will use it in Step 3.&lt;br /&gt;
&lt;br /&gt;
== Part 5 (Step 3) — Write and Submit a SLURM Script ==&lt;br /&gt;
&lt;br /&gt;
=== Tasks ===&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Write&#039;&#039;&#039; a SLURM script for the job using the resource requirements you determined in Step 2. Label it &#039;&#039;&#039;&amp;lt;code&amp;gt;weather.slurm&amp;lt;/code&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
# &#039;&#039;&#039;Submit&#039;&#039;&#039; the job with &amp;lt;code&amp;gt;sbatch&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &#039;&#039;&#039;Check the status&#039;&#039;&#039; of your job and cancel it if needed.&lt;br /&gt;
# &#039;&#039;&#039;Check the figures&#039;&#039;&#039; generated by the Python script.&lt;br /&gt;
&lt;br /&gt;
{{Note|&#039;&#039;&#039;Tip:&#039;&#039;&#039; a SLURM template is available at &amp;lt;code&amp;gt;/lustre/shared/hpcCourses/Basics/script_slurm.sh&amp;lt;/code&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
=== Example solution — &amp;lt;code&amp;gt;weather.slurm&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --job-name=weather&lt;br /&gt;
#SBATCH --mem=&amp;lt;RAM-from-Step-2&amp;gt;     # e.g. 500M — the value you found in Step 2&lt;br /&gt;
#SBATCH --time=0-0:10&lt;br /&gt;
#SBATCH --cpus-per-task=1&lt;br /&gt;
#SBATCH --output=weather-%j.out&lt;br /&gt;
#SBATCH --error=weather-%j.err&lt;br /&gt;
&lt;br /&gt;
cd &amp;quot;$myScratch/hpcCourse&amp;quot;&lt;br /&gt;
./weather.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Submit, monitor, and collect results ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Submit the job&lt;br /&gt;
$ sbatch weather.slurm&lt;br /&gt;
&lt;br /&gt;
# Check the status of your jobs&lt;br /&gt;
$ squeue --me&lt;br /&gt;
&lt;br /&gt;
# Cancel a job if needed (replace &amp;lt;jobid&amp;gt; with the ID from squeue / sbatch)&lt;br /&gt;
$ scancel &amp;lt;jobid&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Once finished, inspect the output and the generated figures&lt;br /&gt;
$ ls $myScratch/hpcCourse&lt;br /&gt;
$ cat weather-&amp;lt;jobid&amp;gt;.out&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The analyser writes its figures into your course folder — open them to confirm the run succeeded.&lt;br /&gt;
&lt;br /&gt;
== Checklist ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;echo $myScratch&amp;lt;/code&amp;gt; prints your scratch path and &amp;lt;code&amp;gt;cd $myScratch&amp;lt;/code&amp;gt; works&lt;br /&gt;
* &amp;lt;code&amp;gt;cds&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;cdb&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;cdn&amp;lt;/code&amp;gt; aliases jump to the right folders&lt;br /&gt;
* Virtual environment activates and &amp;lt;code&amp;gt;which python&amp;lt;/code&amp;gt; points inside it&lt;br /&gt;
* &amp;lt;code&amp;gt;weather.sh&amp;lt;/code&amp;gt; is executable and runs the analyser interactively&lt;br /&gt;
* You know the minimum &amp;lt;code&amp;gt;--mem&amp;lt;/code&amp;gt; the job needs (from Step 2)&lt;br /&gt;
* &amp;lt;code&amp;gt;weather.slurm&amp;lt;/code&amp;gt; submits with &amp;lt;code&amp;gt;sbatch&amp;lt;/code&amp;gt; and the figures are generated&lt;br /&gt;
&lt;br /&gt;
You are now ready for the &#039;&#039;&#039;HPC Advanced&#039;&#039;&#039; course.&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=HPC_Advanced/Preparation_Exercise&amp;diff=2770</id>
		<title>HPC Advanced/Preparation Exercise</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=HPC_Advanced/Preparation_Exercise&amp;diff=2770"/>
		<updated>2026-06-16T13:48:31Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: Created page with &amp;quot;= HPC Basics Refresher — Weather Data Analyser =  {{Note|&amp;#039;&amp;#039;&amp;#039;Who is this for?&amp;#039;&amp;#039;&amp;#039; This is a self-paced preparation exercise for people who are attending the &amp;#039;&amp;#039;&amp;#039;HPC Advanced&amp;#039;&amp;#039;&amp;#039; course but did &amp;#039;&amp;#039;&amp;#039;not&amp;#039;&amp;#039;&amp;#039; attend &amp;#039;&amp;#039;&amp;#039;HPC Basics&amp;#039;&amp;#039;&amp;#039;. Working through it end to end means you arrive at the advanced course already comfortable with environment variables, virtual environments, launcher scripts, interactive jobs, and SLURM batch submission on &amp;#039;&amp;#039;&amp;#039;Anunna&amp;#039;&amp;#039;&amp;#039;.}}  &amp;#039;&amp;#039;&amp;#039;The application:&amp;#039;&amp;#039;&amp;#039; a s...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= HPC Basics Refresher — Weather Data Analyser =&lt;br /&gt;
&lt;br /&gt;
{{Note|&#039;&#039;&#039;Who is this for?&#039;&#039;&#039; This is a self-paced preparation exercise for people who are attending the &#039;&#039;&#039;HPC Advanced&#039;&#039;&#039; course but did &#039;&#039;&#039;not&#039;&#039;&#039; attend &#039;&#039;&#039;HPC Basics&#039;&#039;&#039;. Working through it end to end means you arrive at the advanced course already comfortable with environment variables, virtual environments, launcher scripts, interactive jobs, and SLURM batch submission on &#039;&#039;&#039;Anunna&#039;&#039;&#039;.}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;The application:&#039;&#039;&#039; a small Python script that loads weather data from a Dutch weather station and draws some figures.&lt;br /&gt;
&lt;br /&gt;
Source: &amp;lt;code&amp;gt;/lustre/shared/hpcCourses/Basics/weer_vanaf_2000.py&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By the end you will have:&lt;br /&gt;
&lt;br /&gt;
* Set up handy Lustre path variables (&amp;lt;code&amp;gt;$myScratch&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;$myBkp&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;$myNoBkp&amp;lt;/code&amp;gt;) and aliases&lt;br /&gt;
* Created a Python virtual environment on Lustre scratch&lt;br /&gt;
* Written an executable launcher script (&amp;lt;code&amp;gt;weather.sh&amp;lt;/code&amp;gt;)&lt;br /&gt;
* Measured the job&#039;s memory requirement interactively&lt;br /&gt;
* Written and submitted a SLURM batch script (&amp;lt;code&amp;gt;weather.slurm&amp;lt;/code&amp;gt;) and collected the figures&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Conventions in this document:&#039;&#039; lines starting with &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; are commands you type at the shell (do not type the &amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt;). &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;placeholder&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; means &#039;&#039;substitute your own value&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Part 1 — Environment Variables &amp;amp; Aliases ==&lt;br /&gt;
&lt;br /&gt;
The Anunna &amp;lt;code&amp;gt;getLustreDir&amp;lt;/code&amp;gt; helper writes your personal Lustre directories (&amp;lt;code&amp;gt;$myScratch&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;$myBkp&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;$myNoBkp&amp;lt;/code&amp;gt;) into your environment so you never have to type long paths again.&lt;br /&gt;
&lt;br /&gt;
=== 1.1 — Set up the variables ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Create an empty ~/.bash_aliases if you do not already have one&lt;br /&gt;
$ touch ~/.bash_aliases&lt;br /&gt;
&lt;br /&gt;
# Load the anunna module (this provides getLustreDir)&lt;br /&gt;
$ module load anunna&lt;br /&gt;
&lt;br /&gt;
# Inspect what getLustreDir does&lt;br /&gt;
$ getLustreDir -h&lt;br /&gt;
&lt;br /&gt;
# Append the export lines to your ~/.bash_aliases&lt;br /&gt;
$ getLustreDir -e &amp;gt;&amp;gt; ~/.bash_aliases&lt;br /&gt;
&lt;br /&gt;
# Check the result (cat, less, more or nano all work)&lt;br /&gt;
$ cat ~/.bash_aliases&lt;br /&gt;
&lt;br /&gt;
# Reload your environment so the new variables take effect&lt;br /&gt;
$ source ~/.bashrc&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 1.2 — Test the variables ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Test 1 — does this print your scratch folder location?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ echo $myScratch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Test 2 — does this take you to your scratch folder?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ cd $myScratch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If both work, your variables are live.&lt;br /&gt;
&lt;br /&gt;
=== 1.3 — Bonus: convenience aliases ===&lt;br /&gt;
&lt;br /&gt;
Add these lines to your &amp;lt;code&amp;gt;~/.bash_aliases&amp;lt;/code&amp;gt; and reload your environment again:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
alias cds=&amp;quot;cd $myScratch&amp;quot;&lt;br /&gt;
alias cdb=&amp;quot;cd $myBkp&amp;quot;&lt;br /&gt;
alias cdn=&amp;quot;cd $myNoBkp&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|&#039;&#039;&#039;Important:&#039;&#039;&#039; the alias lines must come &#039;&#039;&#039;after&#039;&#039;&#039; the variable definitions in &amp;lt;code&amp;gt;~/.bash_aliases&amp;lt;/code&amp;gt;, because they reference those variables.}}&lt;br /&gt;
&lt;br /&gt;
If your aliases still do not work after &amp;lt;code&amp;gt;source ~/.bashrc&amp;lt;/code&amp;gt;, your &amp;lt;code&amp;gt;~/.bashrc&amp;lt;/code&amp;gt; may not be sourcing &amp;lt;code&amp;gt;~/.bash_aliases&amp;lt;/code&amp;gt; at all. Add this block to the &#039;&#039;&#039;end&#039;&#039;&#039; of your &amp;lt;code&amp;gt;~/.bashrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ -f ~/.bash_aliases ]; then&lt;br /&gt;
    . ~/.bash_aliases&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then &amp;lt;code&amp;gt;source ~/.bashrc&amp;lt;/code&amp;gt; once more.&lt;br /&gt;
&lt;br /&gt;
== Part 2 (Step 0) — Python Virtual Environment ==&lt;br /&gt;
&lt;br /&gt;
We isolate the analyser&#039;s dependencies in a virtual environment living on Lustre scratch.&lt;br /&gt;
&lt;br /&gt;
=== 2.1 — Load the software stack and Python ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ module purge&lt;br /&gt;
$ module load 2024&lt;br /&gt;
$ module load Python/3.12.3&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 2.2 — Create the virtual environment (in Lustre scratch) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ mkdir $myScratch/hpcCourse; cd $_&lt;br /&gt;
$ python -m venv $myScratch/hpcCourse/venv&lt;br /&gt;
$ source $myScratch/hpcCourse/venv/bin/activate&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;cd $_&amp;lt;/code&amp;gt; reuses the last argument of the previous command — here, the directory you just created.}}&lt;br /&gt;
&lt;br /&gt;
=== 2.3 — Check you are using the venv&#039;s Python ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ which python      # should point inside .../hpcCourse/venv/bin&lt;br /&gt;
$ python -V          # should report Python 3.12.3&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 2.4 — Install the required libraries ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ pip install matplotlib pandas datetime&lt;br /&gt;
$ pip freeze          # for checking what is installed&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|&#039;&#039;&#039;Note on &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt;:&#039;&#039;&#039; &amp;lt;code&amp;gt;datetime&amp;lt;/code&amp;gt; is part of the Python &#039;&#039;&#039;standard library&#039;&#039;&#039; — it ships with the interpreter and does not actually need to be installed. The analyser imports the built-in module. The line above is kept for parity with the course slides; you only truly need &amp;lt;code&amp;gt;matplotlib&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pandas&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
&lt;br /&gt;
== Part 3 (Step 1) — The Launcher Script &amp;lt;code&amp;gt;weather.sh&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
=== Tasks ===&lt;br /&gt;
&lt;br /&gt;
# Copy the Python script into your course folder:&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; inline&amp;gt;cp /lustre/shared/hpcCourses/Basics/weer_vanaf_2000.py $myScratch/hpcCourse/&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# Write a bash script called &#039;&#039;&#039;&amp;lt;code&amp;gt;weather.sh&amp;lt;/code&amp;gt;&#039;&#039;&#039; that loads the modules and activates the virtual environment you created, and make it executable.&lt;br /&gt;
# The script should end with the run command below. &#039;&#039;&#039;Hint:&#039;&#039;&#039; use variables for paths.&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot; inline&amp;gt;python $myScratch/hpcCourse/weer_vanaf_2000.py 240&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#: (&amp;lt;code&amp;gt;240&amp;lt;/code&amp;gt; is the argument passed to the analyser — the number of months of data to plot, i.e. ~20 years.)&lt;br /&gt;
&lt;br /&gt;
=== Example solution — &amp;lt;code&amp;gt;weather.sh&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
# weather.sh — load the environment and run the Weather Data Analyser&lt;br /&gt;
&lt;br /&gt;
# Load the software stack and Python&lt;br /&gt;
module purge&lt;br /&gt;
module load 2024&lt;br /&gt;
module load Python/3.12.3&lt;br /&gt;
&lt;br /&gt;
# Activate the virtual environment&lt;br /&gt;
source &amp;quot;$myScratch/hpcCourse/venv/bin/activate&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# Run the analyser (240 = months of data to plot, ~20 years)&lt;br /&gt;
python &amp;quot;$myScratch/hpcCourse/weer_vanaf_2000.py&amp;quot; 240&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Make it executable:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ chmod +x $myScratch/hpcCourse/weather.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Part 4 (Step 2) — Find the Job Requirements ==&lt;br /&gt;
&lt;br /&gt;
Before submitting a batch job you need to know how much memory it needs. We start with a deliberately small allocation and increase it until the job stops crashing.&lt;br /&gt;
&lt;br /&gt;
=== Task ===&lt;br /&gt;
&lt;br /&gt;
Find the job requirements (e.g. memory) of the Python script using &amp;lt;code&amp;gt;sinteractive&amp;lt;/code&amp;gt;. Increase the amount of RAM until the job no longer crashes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$ sinteractive --mem 100M --time=0-0:10 -c 1&lt;br /&gt;
$ cd $myScratch/hpcCourse&lt;br /&gt;
$ ./weather.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the job is killed (out-of-memory), exit the interactive session, re-launch &amp;lt;code&amp;gt;sinteractive&amp;lt;/code&amp;gt; with a larger &amp;lt;code&amp;gt;--mem&amp;lt;/code&amp;gt; value (e.g. &amp;lt;code&amp;gt;200M&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;500M&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;1G&amp;lt;/code&amp;gt;, …) and run again. Repeat until &amp;lt;code&amp;gt;weather.sh&amp;lt;/code&amp;gt; completes cleanly. &#039;&#039;&#039;Note the smallest &amp;lt;code&amp;gt;--mem&amp;lt;/code&amp;gt; value that works&#039;&#039;&#039; — you will use it in Step 3.&lt;br /&gt;
&lt;br /&gt;
== Part 5 (Step 3) — Write and Submit a SLURM Script ==&lt;br /&gt;
&lt;br /&gt;
=== Tasks ===&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Write&#039;&#039;&#039; a SLURM script for the job using the resource requirements you determined in Step 2. Label it &#039;&#039;&#039;&amp;lt;code&amp;gt;weather.slurm&amp;lt;/code&amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
# &#039;&#039;&#039;Submit&#039;&#039;&#039; the job with &amp;lt;code&amp;gt;sbatch&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &#039;&#039;&#039;Check the status&#039;&#039;&#039; of your job and cancel it if needed.&lt;br /&gt;
# &#039;&#039;&#039;Check the figures&#039;&#039;&#039; generated by the Python script.&lt;br /&gt;
&lt;br /&gt;
{{Note|&#039;&#039;&#039;Tip:&#039;&#039;&#039; a SLURM template is available at &amp;lt;code&amp;gt;/lustre/shared/hpcCourses/Basics/script_slurm.sh&amp;lt;/code&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
=== Example solution — &amp;lt;code&amp;gt;weather.slurm&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
#SBATCH --job-name=weather&lt;br /&gt;
#SBATCH --mem=&amp;lt;RAM-from-Step-2&amp;gt;     # e.g. 500M — the value you found in Step 2&lt;br /&gt;
#SBATCH --time=0-0:10&lt;br /&gt;
#SBATCH --cpus-per-task=1&lt;br /&gt;
#SBATCH --output=weather-%j.out&lt;br /&gt;
#SBATCH --error=weather-%j.err&lt;br /&gt;
&lt;br /&gt;
cd &amp;quot;$myScratch/hpcCourse&amp;quot;&lt;br /&gt;
./weather.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Submit, monitor, and collect results ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Submit the job&lt;br /&gt;
$ sbatch weather.slurm&lt;br /&gt;
&lt;br /&gt;
# Check the status of your jobs&lt;br /&gt;
$ squeue --me&lt;br /&gt;
&lt;br /&gt;
# Cancel a job if needed (replace &amp;lt;jobid&amp;gt; with the ID from squeue / sbatch)&lt;br /&gt;
$ scancel &amp;lt;jobid&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Once finished, inspect the output and the generated figures&lt;br /&gt;
$ ls $myScratch/hpcCourse&lt;br /&gt;
$ cat weather-&amp;lt;jobid&amp;gt;.out&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The analyser writes its figures into your course folder — open them to confirm the run succeeded.&lt;br /&gt;
&lt;br /&gt;
== Checklist ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;echo $myScratch&amp;lt;/code&amp;gt; prints your scratch path and &amp;lt;code&amp;gt;cd $myScratch&amp;lt;/code&amp;gt; works&lt;br /&gt;
* &amp;lt;code&amp;gt;cds&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;cdb&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;cdn&amp;lt;/code&amp;gt; aliases jump to the right folders&lt;br /&gt;
* Virtual environment activates and &amp;lt;code&amp;gt;which python&amp;lt;/code&amp;gt; points inside it&lt;br /&gt;
* &amp;lt;code&amp;gt;weather.sh&amp;lt;/code&amp;gt; is executable and runs the analyser interactively&lt;br /&gt;
* You know the minimum &amp;lt;code&amp;gt;--mem&amp;lt;/code&amp;gt; the job needs (from Step 2)&lt;br /&gt;
* &amp;lt;code&amp;gt;weather.slurm&amp;lt;/code&amp;gt; submits with &amp;lt;code&amp;gt;sbatch&amp;lt;/code&amp;gt; and the figures are generated&lt;br /&gt;
&lt;br /&gt;
You are now ready for the &#039;&#039;&#039;HPC Advanced&#039;&#039;&#039; course.&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Linux_Basic/Linux_Self_Assessment&amp;diff=2737</id>
		<title>Linux Basic/Linux Self Assessment</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Linux_Basic/Linux_Self_Assessment&amp;diff=2737"/>
		<updated>2026-06-11T09:35:21Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Linux Basics — Self-Assessment =&lt;br /&gt;
&lt;br /&gt;
This page lets you verify that you have mastered the material from the [[Linux Basics Course]]. Work through the parts in order on &#039;&#039;&#039;Anunna&#039;&#039;&#039;. The final challenge produces a report file that proves you completed every step — submit (or keep) that file as evidence.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites:&#039;&#039;&#039; an Anunna account and the course data at &amp;lt;code&amp;gt;/lustre/shared/hpcCourses/shell-lesson-data.zip&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Rules:&#039;&#039;&#039;&lt;br /&gt;
* Do everything from the command line. No file-manager GUIs, no OnDemand file browser (the shell is fine).&lt;br /&gt;
* If you get stuck, refer back to the [[:File:WUR Linux Basics Course 2026 Feb.pdf|course slides]],   use &amp;lt;code&amp;gt;man&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--help&amp;lt;/code&amp;gt;, or the [https://swcarpentry.github.io/shell-novice/ Software Carpentry shell course] — that is part of the skill.&lt;br /&gt;
&lt;br /&gt;
== Part 1 — Connect and orient ==&lt;br /&gt;
&lt;br /&gt;
# Connect to Anunna via SSH.&lt;br /&gt;
# Confirm where you are with &amp;lt;code&amp;gt;pwd&amp;lt;/code&amp;gt;. You should be in your home directory (&amp;lt;code&amp;gt;/home/WUR/yourusername&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
== Part 2 — Build the workspace (directories and navigation) ==&lt;br /&gt;
&lt;br /&gt;
# In your home directory, create this directory tree &#039;&#039;&#039;with a single command&#039;&#039;&#039;:&lt;br /&gt;
#: &amp;lt;pre&amp;gt;~/linux_test/&lt;br /&gt;
#: ├── data/&lt;br /&gt;
#: ├── scripts/&lt;br /&gt;
#: └── results/&amp;lt;/pre&amp;gt;&lt;br /&gt;
#: &#039;&#039;Hint: one &amp;lt;code&amp;gt;mkdir&amp;lt;/code&amp;gt; flag makes parent directories for you.&#039;&#039;&lt;br /&gt;
# Change into &amp;lt;code&amp;gt;~/linux_test/data&amp;lt;/code&amp;gt; using a &#039;&#039;&#039;relative&#039;&#039;&#039; path from your home directory.&lt;br /&gt;
# Go back to your home directory using only &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; shortcuts (no full paths).&lt;br /&gt;
&lt;br /&gt;
== Part 3 — Work with files ==&lt;br /&gt;
&lt;br /&gt;
# Copy the course archive into your home directory and extract it:&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cp /lustre/shared/hpcCourses/shell-lesson-data.zip ~/&lt;br /&gt;
unzip ~/shell-lesson-data.zip -d ~/&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# Find the file &amp;lt;code&amp;gt;unicorn.dat&amp;lt;/code&amp;gt; inside the extracted data and &#039;&#039;&#039;copy&#039;&#039;&#039; it to &amp;lt;code&amp;gt;~/linux_test/data/sample.dat&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Inside &amp;lt;code&amp;gt;~/linux_test/data&amp;lt;/code&amp;gt;, create 12 empty files named &amp;lt;code&amp;gt;run_01.log&amp;lt;/code&amp;gt; through &amp;lt;code&amp;gt;run_12.log&amp;lt;/code&amp;gt; &#039;&#039;&#039;with a single command&#039;&#039;&#039; (brace ranges).&lt;br /&gt;
# Delete &#039;&#039;&#039;only&#039;&#039;&#039; the even-numbered log files using wildcards/ranges — in as few commands as you can. Check with &amp;lt;code&amp;gt;ls&amp;lt;/code&amp;gt; that exactly 6 odd-numbered files remain.&lt;br /&gt;
&lt;br /&gt;
== Part 4 — Pipes, filters, redirects ==&lt;br /&gt;
&lt;br /&gt;
# Count how many lines in &amp;lt;code&amp;gt;sample.dat&amp;lt;/code&amp;gt; contain the pattern &amp;lt;code&amp;gt;TACCGGACAA&amp;lt;/code&amp;gt;, using &amp;lt;code&amp;gt;grep&amp;lt;/code&amp;gt; piped into &amp;lt;code&amp;gt;wc&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Redirect that number into &amp;lt;code&amp;gt;~/linux_test/results/pattern_count.txt&amp;lt;/code&amp;gt; (it should contain a single number, nothing else).&lt;br /&gt;
&lt;br /&gt;
== Part 5 — Environment variables ==&lt;br /&gt;
&lt;br /&gt;
# Create an environment variable holding your full name and &#039;&#039;&#039;export&#039;&#039;&#039; it:&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
export REPORT_AUTHOR=&amp;quot;Your Name&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# Verify it exists with &amp;lt;code&amp;gt;echo $REPORT_AUTHOR&amp;lt;/code&amp;gt; and find it in the output of &amp;lt;code&amp;gt;env&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &#039;&#039;Question to yourself: why is &amp;lt;code&amp;gt;export&amp;lt;/code&amp;gt; needed here? You will find out in the final challenge — your script runs as a child process, and only exported variables reach it.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Part 6 — Final challenge: the report script ==&lt;br /&gt;
&lt;br /&gt;
Using a command-line text editor (&amp;lt;code&amp;gt;nano&amp;lt;/code&amp;gt; is what the course taught, but &amp;lt;code&amp;gt;vim&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;emacs&amp;lt;/code&amp;gt; are equally fine), create the file &amp;lt;code&amp;gt;~/linux_test/scripts/generate_report.sh&amp;lt;/code&amp;gt; with exactly this behaviour. Write it yourself — the skeleton below shows the required output labels, you fill in the commands.&lt;br /&gt;
&lt;br /&gt;
The script must:&lt;br /&gt;
&lt;br /&gt;
* start with the correct &#039;&#039;&#039;interpreter header&#039;&#039;&#039; for bash,&lt;br /&gt;
* write all output to &amp;lt;code&amp;gt;~/linux_test/results/report.txt&amp;lt;/code&amp;gt; (overwriting any previous report),&lt;br /&gt;
* produce one labelled line per check, in this order:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Label !! Content !! What it proves&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;USER:&amp;lt;/code&amp;gt; || output of &amp;lt;code&amp;gt;whoami&amp;lt;/code&amp;gt; || you ran it yourself&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;DATE:&amp;lt;/code&amp;gt; || output of &amp;lt;code&amp;gt;date&amp;lt;/code&amp;gt; || when&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;AUTHOR:&amp;lt;/code&amp;gt; || value of &amp;lt;code&amp;gt;$REPORT_AUTHOR&amp;lt;/code&amp;gt; || you understand &amp;lt;code&amp;gt;export&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;SHEBANG:&amp;lt;/code&amp;gt; || first line of the script itself (&amp;lt;code&amp;gt;head -n 1 &amp;quot;$0&amp;quot;&amp;lt;/code&amp;gt;) || interpreter header present&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;PERMS:&amp;lt;/code&amp;gt; || permission octal of the script itself (&amp;lt;code&amp;gt;stat -c &#039;%a&#039; &amp;quot;$0&amp;quot;&amp;lt;/code&amp;gt;) || you made it executable&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;LOGFILES:&amp;lt;/code&amp;gt; || number of &amp;lt;code&amp;gt;.log&amp;lt;/code&amp;gt; files in &amp;lt;code&amp;gt;~/linux_test/data&amp;lt;/code&amp;gt; || Part 3 globbing done&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;PATTERN:&amp;lt;/code&amp;gt; || contents of &amp;lt;code&amp;gt;~/linux_test/results/pattern_count.txt&amp;lt;/code&amp;gt; || Part 4 done&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A starting skeleton (the first two lines are done for you):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
REPORT=~/linux_test/results/report.txt&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;USER: $(whoami)&amp;quot; &amp;gt; &amp;quot;$REPORT&amp;quot;&lt;br /&gt;
echo &amp;quot;DATE: $(date)&amp;quot; &amp;gt;&amp;gt; &amp;quot;$REPORT&amp;quot;&lt;br /&gt;
# ... your turn: AUTHOR, SHEBANG, PERMS, LOGFILES, PATTERN ...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Mind the difference between &amp;lt;code&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; — only the first line should overwrite.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Run it ===&lt;br /&gt;
&lt;br /&gt;
# Make the script executable for yourself with &amp;lt;code&amp;gt;chmod&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Change into &amp;lt;code&amp;gt;~/linux_test/scripts&amp;lt;/code&amp;gt; and run it with a &#039;&#039;&#039;relative&#039;&#039;&#039; path:&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd ~/linux_test/scripts&lt;br /&gt;
./generate_report.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# Run it once more from your home directory using the &#039;&#039;&#039;full&#039;&#039;&#039; path. Both must work.&lt;br /&gt;
# &#039;&#039;Bonus question: why does plain &amp;lt;code&amp;gt;generate_report.sh&amp;lt;/code&amp;gt; (no &amp;lt;code&amp;gt;./&amp;lt;/code&amp;gt;) fail? Which environment variable is responsible?&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Check yourself ===&lt;br /&gt;
&lt;br /&gt;
Display the report:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cat ~/linux_test/results/report.txt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You pass if &#039;&#039;&#039;all&#039;&#039;&#039; of the following hold:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;AUTHOR:&amp;lt;/code&amp;gt; shows your name (not empty — if it is empty, you forgot &amp;lt;code&amp;gt;export&amp;lt;/code&amp;gt;);&lt;br /&gt;
* &amp;lt;code&amp;gt;SHEBANG:&amp;lt;/code&amp;gt; shows &amp;lt;code&amp;gt;#!/bin/bash&amp;lt;/code&amp;gt;;&lt;br /&gt;
* &amp;lt;code&amp;gt;PERMS:&amp;lt;/code&amp;gt; starts with a &amp;lt;code&amp;gt;7&amp;lt;/code&amp;gt; (e.g. &amp;lt;code&amp;gt;744&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;755&amp;lt;/code&amp;gt;) — owner has read, write &#039;&#039;&#039;and&#039;&#039;&#039; execute;&lt;br /&gt;
* &amp;lt;code&amp;gt;LOGFILES:&amp;lt;/code&amp;gt; is &amp;lt;code&amp;gt;6&amp;lt;/code&amp;gt;;&lt;br /&gt;
* &amp;lt;code&amp;gt;PATTERN:&amp;lt;/code&amp;gt; is a number greater than &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If any line is wrong, fix the corresponding part and re-run the script — that is the whole point of scripts.&lt;br /&gt;
&lt;br /&gt;
== For instructors ==&lt;br /&gt;
&lt;br /&gt;
A submitted &amp;lt;code&amp;gt;report.txt&amp;lt;/code&amp;gt; is verifiable at a glance, or in bulk:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
grep -E &#039;^(AUTHOR: .+|SHEBANG: #!/bin/bash|PERMS: 7..|LOGFILES: 6|PATTERN: [1-9])&#039; report.txt | wc -l&lt;br /&gt;
# Expect: 5&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Asking students to also submit the script itself catches copy-pasted reports: the &amp;lt;code&amp;gt;SHEBANG:&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;PERMS:&amp;lt;/code&amp;gt; lines must be consistent with the actual file.&lt;br /&gt;
&lt;br /&gt;
[[Category:Courses]]&lt;br /&gt;
[[Category:Linux]]&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Linux_Basic/Linux_Self_Assessment&amp;diff=2736</id>
		<title>Linux Basic/Linux Self Assessment</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Linux_Basic/Linux_Self_Assessment&amp;diff=2736"/>
		<updated>2026-06-11T09:34:55Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Linux Basics — Self-Assessment =&lt;br /&gt;
&lt;br /&gt;
This page lets you verify that you have mastered the material from the [[Linux Basics Course]]. Work through the parts in order on &#039;&#039;&#039;Anunna&#039;&#039;&#039;. The final challenge produces a report file that proves you completed every step — submit (or keep) that file as evidence.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites:&#039;&#039;&#039; an Anunna account and the course data at &amp;lt;code&amp;gt;/lustre/shared/hpcCourses/shell-lesson-data.zip&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Rules:&#039;&#039;&#039;&lt;br /&gt;
* Do everything from the command line. No file-manager GUIs, no OnDemand file browser (the shell is fine).&lt;br /&gt;
* If you get stuck, refer back to the [[:File:WUR Linux Basics Course 2026 Feb.pdf|course slides]]  use &amp;lt;code&amp;gt;man&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--help&amp;lt;/code&amp;gt;, or the [https://swcarpentry.github.io/shell-novice/ Software Carpentry shell course] — that is part of the skill.&lt;br /&gt;
&lt;br /&gt;
== Part 1 — Connect and orient ==&lt;br /&gt;
&lt;br /&gt;
# Connect to Anunna via SSH.&lt;br /&gt;
# Confirm where you are with &amp;lt;code&amp;gt;pwd&amp;lt;/code&amp;gt;. You should be in your home directory (&amp;lt;code&amp;gt;/home/WUR/yourusername&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
== Part 2 — Build the workspace (directories and navigation) ==&lt;br /&gt;
&lt;br /&gt;
# In your home directory, create this directory tree &#039;&#039;&#039;with a single command&#039;&#039;&#039;:&lt;br /&gt;
#: &amp;lt;pre&amp;gt;~/linux_test/&lt;br /&gt;
#: ├── data/&lt;br /&gt;
#: ├── scripts/&lt;br /&gt;
#: └── results/&amp;lt;/pre&amp;gt;&lt;br /&gt;
#: &#039;&#039;Hint: one &amp;lt;code&amp;gt;mkdir&amp;lt;/code&amp;gt; flag makes parent directories for you.&#039;&#039;&lt;br /&gt;
# Change into &amp;lt;code&amp;gt;~/linux_test/data&amp;lt;/code&amp;gt; using a &#039;&#039;&#039;relative&#039;&#039;&#039; path from your home directory.&lt;br /&gt;
# Go back to your home directory using only &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; shortcuts (no full paths).&lt;br /&gt;
&lt;br /&gt;
== Part 3 — Work with files ==&lt;br /&gt;
&lt;br /&gt;
# Copy the course archive into your home directory and extract it:&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cp /lustre/shared/hpcCourses/shell-lesson-data.zip ~/&lt;br /&gt;
unzip ~/shell-lesson-data.zip -d ~/&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# Find the file &amp;lt;code&amp;gt;unicorn.dat&amp;lt;/code&amp;gt; inside the extracted data and &#039;&#039;&#039;copy&#039;&#039;&#039; it to &amp;lt;code&amp;gt;~/linux_test/data/sample.dat&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Inside &amp;lt;code&amp;gt;~/linux_test/data&amp;lt;/code&amp;gt;, create 12 empty files named &amp;lt;code&amp;gt;run_01.log&amp;lt;/code&amp;gt; through &amp;lt;code&amp;gt;run_12.log&amp;lt;/code&amp;gt; &#039;&#039;&#039;with a single command&#039;&#039;&#039; (brace ranges).&lt;br /&gt;
# Delete &#039;&#039;&#039;only&#039;&#039;&#039; the even-numbered log files using wildcards/ranges — in as few commands as you can. Check with &amp;lt;code&amp;gt;ls&amp;lt;/code&amp;gt; that exactly 6 odd-numbered files remain.&lt;br /&gt;
&lt;br /&gt;
== Part 4 — Pipes, filters, redirects ==&lt;br /&gt;
&lt;br /&gt;
# Count how many lines in &amp;lt;code&amp;gt;sample.dat&amp;lt;/code&amp;gt; contain the pattern &amp;lt;code&amp;gt;TACCGGACAA&amp;lt;/code&amp;gt;, using &amp;lt;code&amp;gt;grep&amp;lt;/code&amp;gt; piped into &amp;lt;code&amp;gt;wc&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Redirect that number into &amp;lt;code&amp;gt;~/linux_test/results/pattern_count.txt&amp;lt;/code&amp;gt; (it should contain a single number, nothing else).&lt;br /&gt;
&lt;br /&gt;
== Part 5 — Environment variables ==&lt;br /&gt;
&lt;br /&gt;
# Create an environment variable holding your full name and &#039;&#039;&#039;export&#039;&#039;&#039; it:&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
export REPORT_AUTHOR=&amp;quot;Your Name&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# Verify it exists with &amp;lt;code&amp;gt;echo $REPORT_AUTHOR&amp;lt;/code&amp;gt; and find it in the output of &amp;lt;code&amp;gt;env&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &#039;&#039;Question to yourself: why is &amp;lt;code&amp;gt;export&amp;lt;/code&amp;gt; needed here? You will find out in the final challenge — your script runs as a child process, and only exported variables reach it.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Part 6 — Final challenge: the report script ==&lt;br /&gt;
&lt;br /&gt;
Using a command-line text editor (&amp;lt;code&amp;gt;nano&amp;lt;/code&amp;gt; is what the course taught, but &amp;lt;code&amp;gt;vim&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;emacs&amp;lt;/code&amp;gt; are equally fine), create the file &amp;lt;code&amp;gt;~/linux_test/scripts/generate_report.sh&amp;lt;/code&amp;gt; with exactly this behaviour. Write it yourself — the skeleton below shows the required output labels, you fill in the commands.&lt;br /&gt;
&lt;br /&gt;
The script must:&lt;br /&gt;
&lt;br /&gt;
* start with the correct &#039;&#039;&#039;interpreter header&#039;&#039;&#039; for bash,&lt;br /&gt;
* write all output to &amp;lt;code&amp;gt;~/linux_test/results/report.txt&amp;lt;/code&amp;gt; (overwriting any previous report),&lt;br /&gt;
* produce one labelled line per check, in this order:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Label !! Content !! What it proves&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;USER:&amp;lt;/code&amp;gt; || output of &amp;lt;code&amp;gt;whoami&amp;lt;/code&amp;gt; || you ran it yourself&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;DATE:&amp;lt;/code&amp;gt; || output of &amp;lt;code&amp;gt;date&amp;lt;/code&amp;gt; || when&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;AUTHOR:&amp;lt;/code&amp;gt; || value of &amp;lt;code&amp;gt;$REPORT_AUTHOR&amp;lt;/code&amp;gt; || you understand &amp;lt;code&amp;gt;export&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;SHEBANG:&amp;lt;/code&amp;gt; || first line of the script itself (&amp;lt;code&amp;gt;head -n 1 &amp;quot;$0&amp;quot;&amp;lt;/code&amp;gt;) || interpreter header present&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;PERMS:&amp;lt;/code&amp;gt; || permission octal of the script itself (&amp;lt;code&amp;gt;stat -c &#039;%a&#039; &amp;quot;$0&amp;quot;&amp;lt;/code&amp;gt;) || you made it executable&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;LOGFILES:&amp;lt;/code&amp;gt; || number of &amp;lt;code&amp;gt;.log&amp;lt;/code&amp;gt; files in &amp;lt;code&amp;gt;~/linux_test/data&amp;lt;/code&amp;gt; || Part 3 globbing done&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;PATTERN:&amp;lt;/code&amp;gt; || contents of &amp;lt;code&amp;gt;~/linux_test/results/pattern_count.txt&amp;lt;/code&amp;gt; || Part 4 done&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A starting skeleton (the first two lines are done for you):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
REPORT=~/linux_test/results/report.txt&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;USER: $(whoami)&amp;quot; &amp;gt; &amp;quot;$REPORT&amp;quot;&lt;br /&gt;
echo &amp;quot;DATE: $(date)&amp;quot; &amp;gt;&amp;gt; &amp;quot;$REPORT&amp;quot;&lt;br /&gt;
# ... your turn: AUTHOR, SHEBANG, PERMS, LOGFILES, PATTERN ...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Mind the difference between &amp;lt;code&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; — only the first line should overwrite.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Run it ===&lt;br /&gt;
&lt;br /&gt;
# Make the script executable for yourself with &amp;lt;code&amp;gt;chmod&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Change into &amp;lt;code&amp;gt;~/linux_test/scripts&amp;lt;/code&amp;gt; and run it with a &#039;&#039;&#039;relative&#039;&#039;&#039; path:&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd ~/linux_test/scripts&lt;br /&gt;
./generate_report.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# Run it once more from your home directory using the &#039;&#039;&#039;full&#039;&#039;&#039; path. Both must work.&lt;br /&gt;
# &#039;&#039;Bonus question: why does plain &amp;lt;code&amp;gt;generate_report.sh&amp;lt;/code&amp;gt; (no &amp;lt;code&amp;gt;./&amp;lt;/code&amp;gt;) fail? Which environment variable is responsible?&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Check yourself ===&lt;br /&gt;
&lt;br /&gt;
Display the report:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cat ~/linux_test/results/report.txt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You pass if &#039;&#039;&#039;all&#039;&#039;&#039; of the following hold:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;AUTHOR:&amp;lt;/code&amp;gt; shows your name (not empty — if it is empty, you forgot &amp;lt;code&amp;gt;export&amp;lt;/code&amp;gt;);&lt;br /&gt;
* &amp;lt;code&amp;gt;SHEBANG:&amp;lt;/code&amp;gt; shows &amp;lt;code&amp;gt;#!/bin/bash&amp;lt;/code&amp;gt;;&lt;br /&gt;
* &amp;lt;code&amp;gt;PERMS:&amp;lt;/code&amp;gt; starts with a &amp;lt;code&amp;gt;7&amp;lt;/code&amp;gt; (e.g. &amp;lt;code&amp;gt;744&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;755&amp;lt;/code&amp;gt;) — owner has read, write &#039;&#039;&#039;and&#039;&#039;&#039; execute;&lt;br /&gt;
* &amp;lt;code&amp;gt;LOGFILES:&amp;lt;/code&amp;gt; is &amp;lt;code&amp;gt;6&amp;lt;/code&amp;gt;;&lt;br /&gt;
* &amp;lt;code&amp;gt;PATTERN:&amp;lt;/code&amp;gt; is a number greater than &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If any line is wrong, fix the corresponding part and re-run the script — that is the whole point of scripts.&lt;br /&gt;
&lt;br /&gt;
== For instructors ==&lt;br /&gt;
&lt;br /&gt;
A submitted &amp;lt;code&amp;gt;report.txt&amp;lt;/code&amp;gt; is verifiable at a glance, or in bulk:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
grep -E &#039;^(AUTHOR: .+|SHEBANG: #!/bin/bash|PERMS: 7..|LOGFILES: 6|PATTERN: [1-9])&#039; report.txt | wc -l&lt;br /&gt;
# Expect: 5&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Asking students to also submit the script itself catches copy-pasted reports: the &amp;lt;code&amp;gt;SHEBANG:&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;PERMS:&amp;lt;/code&amp;gt; lines must be consistent with the actual file.&lt;br /&gt;
&lt;br /&gt;
[[Category:Courses]]&lt;br /&gt;
[[Category:Linux]]&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Linux_Basic/Linux_Self_Assessment&amp;diff=2735</id>
		<title>Linux Basic/Linux Self Assessment</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Linux_Basic/Linux_Self_Assessment&amp;diff=2735"/>
		<updated>2026-06-11T09:34:18Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Linux Basics — Self-Assessment =&lt;br /&gt;
&lt;br /&gt;
This page lets you verify that you have mastered the material from the [[Linux Basics Course]]. Work through the parts in order on &#039;&#039;&#039;Anunna&#039;&#039;&#039;. The final challenge produces a report file that proves you completed every step — submit (or keep) that file as evidence.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites:&#039;&#039;&#039; an Anunna account and the course data at &amp;lt;code&amp;gt;/lustre/shared/hpcCourses/shell-lesson-data.zip&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Rules:&#039;&#039;&#039;&lt;br /&gt;
* Do everything from the command line. No file-manager GUIs, no OnDemand file browser (the shell is fine).&lt;br /&gt;
* If you get stuck, refer back to the [[course slides]]  use &amp;lt;code&amp;gt;man&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--help&amp;lt;/code&amp;gt;, or the [https://swcarpentry.github.io/shell-novice/ Software Carpentry shell course] — that is part of the skill.&lt;br /&gt;
&lt;br /&gt;
== Part 1 — Connect and orient ==&lt;br /&gt;
&lt;br /&gt;
# Connect to Anunna via SSH.&lt;br /&gt;
# Confirm where you are with &amp;lt;code&amp;gt;pwd&amp;lt;/code&amp;gt;. You should be in your home directory (&amp;lt;code&amp;gt;/home/WUR/yourusername&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
== Part 2 — Build the workspace (directories and navigation) ==&lt;br /&gt;
&lt;br /&gt;
# In your home directory, create this directory tree &#039;&#039;&#039;with a single command&#039;&#039;&#039;:&lt;br /&gt;
#: &amp;lt;pre&amp;gt;~/linux_test/&lt;br /&gt;
#: ├── data/&lt;br /&gt;
#: ├── scripts/&lt;br /&gt;
#: └── results/&amp;lt;/pre&amp;gt;&lt;br /&gt;
#: &#039;&#039;Hint: one &amp;lt;code&amp;gt;mkdir&amp;lt;/code&amp;gt; flag makes parent directories for you.&#039;&#039;&lt;br /&gt;
# Change into &amp;lt;code&amp;gt;~/linux_test/data&amp;lt;/code&amp;gt; using a &#039;&#039;&#039;relative&#039;&#039;&#039; path from your home directory.&lt;br /&gt;
# Go back to your home directory using only &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; shortcuts (no full paths).&lt;br /&gt;
&lt;br /&gt;
== Part 3 — Work with files ==&lt;br /&gt;
&lt;br /&gt;
# Copy the course archive into your home directory and extract it:&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cp /lustre/shared/hpcCourses/shell-lesson-data.zip ~/&lt;br /&gt;
unzip ~/shell-lesson-data.zip -d ~/&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# Find the file &amp;lt;code&amp;gt;unicorn.dat&amp;lt;/code&amp;gt; inside the extracted data and &#039;&#039;&#039;copy&#039;&#039;&#039; it to &amp;lt;code&amp;gt;~/linux_test/data/sample.dat&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Inside &amp;lt;code&amp;gt;~/linux_test/data&amp;lt;/code&amp;gt;, create 12 empty files named &amp;lt;code&amp;gt;run_01.log&amp;lt;/code&amp;gt; through &amp;lt;code&amp;gt;run_12.log&amp;lt;/code&amp;gt; &#039;&#039;&#039;with a single command&#039;&#039;&#039; (brace ranges).&lt;br /&gt;
# Delete &#039;&#039;&#039;only&#039;&#039;&#039; the even-numbered log files using wildcards/ranges — in as few commands as you can. Check with &amp;lt;code&amp;gt;ls&amp;lt;/code&amp;gt; that exactly 6 odd-numbered files remain.&lt;br /&gt;
&lt;br /&gt;
== Part 4 — Pipes, filters, redirects ==&lt;br /&gt;
&lt;br /&gt;
# Count how many lines in &amp;lt;code&amp;gt;sample.dat&amp;lt;/code&amp;gt; contain the pattern &amp;lt;code&amp;gt;TACCGGACAA&amp;lt;/code&amp;gt;, using &amp;lt;code&amp;gt;grep&amp;lt;/code&amp;gt; piped into &amp;lt;code&amp;gt;wc&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Redirect that number into &amp;lt;code&amp;gt;~/linux_test/results/pattern_count.txt&amp;lt;/code&amp;gt; (it should contain a single number, nothing else).&lt;br /&gt;
&lt;br /&gt;
== Part 5 — Environment variables ==&lt;br /&gt;
&lt;br /&gt;
# Create an environment variable holding your full name and &#039;&#039;&#039;export&#039;&#039;&#039; it:&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
export REPORT_AUTHOR=&amp;quot;Your Name&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# Verify it exists with &amp;lt;code&amp;gt;echo $REPORT_AUTHOR&amp;lt;/code&amp;gt; and find it in the output of &amp;lt;code&amp;gt;env&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &#039;&#039;Question to yourself: why is &amp;lt;code&amp;gt;export&amp;lt;/code&amp;gt; needed here? You will find out in the final challenge — your script runs as a child process, and only exported variables reach it.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Part 6 — Final challenge: the report script ==&lt;br /&gt;
&lt;br /&gt;
Using a command-line text editor (&amp;lt;code&amp;gt;nano&amp;lt;/code&amp;gt; is what the course taught, but &amp;lt;code&amp;gt;vim&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;emacs&amp;lt;/code&amp;gt; are equally fine), create the file &amp;lt;code&amp;gt;~/linux_test/scripts/generate_report.sh&amp;lt;/code&amp;gt; with exactly this behaviour. Write it yourself — the skeleton below shows the required output labels, you fill in the commands.&lt;br /&gt;
&lt;br /&gt;
The script must:&lt;br /&gt;
&lt;br /&gt;
* start with the correct &#039;&#039;&#039;interpreter header&#039;&#039;&#039; for bash,&lt;br /&gt;
* write all output to &amp;lt;code&amp;gt;~/linux_test/results/report.txt&amp;lt;/code&amp;gt; (overwriting any previous report),&lt;br /&gt;
* produce one labelled line per check, in this order:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Label !! Content !! What it proves&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;USER:&amp;lt;/code&amp;gt; || output of &amp;lt;code&amp;gt;whoami&amp;lt;/code&amp;gt; || you ran it yourself&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;DATE:&amp;lt;/code&amp;gt; || output of &amp;lt;code&amp;gt;date&amp;lt;/code&amp;gt; || when&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;AUTHOR:&amp;lt;/code&amp;gt; || value of &amp;lt;code&amp;gt;$REPORT_AUTHOR&amp;lt;/code&amp;gt; || you understand &amp;lt;code&amp;gt;export&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;SHEBANG:&amp;lt;/code&amp;gt; || first line of the script itself (&amp;lt;code&amp;gt;head -n 1 &amp;quot;$0&amp;quot;&amp;lt;/code&amp;gt;) || interpreter header present&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;PERMS:&amp;lt;/code&amp;gt; || permission octal of the script itself (&amp;lt;code&amp;gt;stat -c &#039;%a&#039; &amp;quot;$0&amp;quot;&amp;lt;/code&amp;gt;) || you made it executable&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;LOGFILES:&amp;lt;/code&amp;gt; || number of &amp;lt;code&amp;gt;.log&amp;lt;/code&amp;gt; files in &amp;lt;code&amp;gt;~/linux_test/data&amp;lt;/code&amp;gt; || Part 3 globbing done&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;PATTERN:&amp;lt;/code&amp;gt; || contents of &amp;lt;code&amp;gt;~/linux_test/results/pattern_count.txt&amp;lt;/code&amp;gt; || Part 4 done&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A starting skeleton (the first two lines are done for you):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
REPORT=~/linux_test/results/report.txt&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;USER: $(whoami)&amp;quot; &amp;gt; &amp;quot;$REPORT&amp;quot;&lt;br /&gt;
echo &amp;quot;DATE: $(date)&amp;quot; &amp;gt;&amp;gt; &amp;quot;$REPORT&amp;quot;&lt;br /&gt;
# ... your turn: AUTHOR, SHEBANG, PERMS, LOGFILES, PATTERN ...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Mind the difference between &amp;lt;code&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; — only the first line should overwrite.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Run it ===&lt;br /&gt;
&lt;br /&gt;
# Make the script executable for yourself with &amp;lt;code&amp;gt;chmod&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Change into &amp;lt;code&amp;gt;~/linux_test/scripts&amp;lt;/code&amp;gt; and run it with a &#039;&#039;&#039;relative&#039;&#039;&#039; path:&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd ~/linux_test/scripts&lt;br /&gt;
./generate_report.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# Run it once more from your home directory using the &#039;&#039;&#039;full&#039;&#039;&#039; path. Both must work.&lt;br /&gt;
# &#039;&#039;Bonus question: why does plain &amp;lt;code&amp;gt;generate_report.sh&amp;lt;/code&amp;gt; (no &amp;lt;code&amp;gt;./&amp;lt;/code&amp;gt;) fail? Which environment variable is responsible?&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Check yourself ===&lt;br /&gt;
&lt;br /&gt;
Display the report:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cat ~/linux_test/results/report.txt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You pass if &#039;&#039;&#039;all&#039;&#039;&#039; of the following hold:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;AUTHOR:&amp;lt;/code&amp;gt; shows your name (not empty — if it is empty, you forgot &amp;lt;code&amp;gt;export&amp;lt;/code&amp;gt;);&lt;br /&gt;
* &amp;lt;code&amp;gt;SHEBANG:&amp;lt;/code&amp;gt; shows &amp;lt;code&amp;gt;#!/bin/bash&amp;lt;/code&amp;gt;;&lt;br /&gt;
* &amp;lt;code&amp;gt;PERMS:&amp;lt;/code&amp;gt; starts with a &amp;lt;code&amp;gt;7&amp;lt;/code&amp;gt; (e.g. &amp;lt;code&amp;gt;744&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;755&amp;lt;/code&amp;gt;) — owner has read, write &#039;&#039;&#039;and&#039;&#039;&#039; execute;&lt;br /&gt;
* &amp;lt;code&amp;gt;LOGFILES:&amp;lt;/code&amp;gt; is &amp;lt;code&amp;gt;6&amp;lt;/code&amp;gt;;&lt;br /&gt;
* &amp;lt;code&amp;gt;PATTERN:&amp;lt;/code&amp;gt; is a number greater than &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If any line is wrong, fix the corresponding part and re-run the script — that is the whole point of scripts.&lt;br /&gt;
&lt;br /&gt;
== For instructors ==&lt;br /&gt;
&lt;br /&gt;
A submitted &amp;lt;code&amp;gt;report.txt&amp;lt;/code&amp;gt; is verifiable at a glance, or in bulk:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
grep -E &#039;^(AUTHOR: .+|SHEBANG: #!/bin/bash|PERMS: 7..|LOGFILES: 6|PATTERN: [1-9])&#039; report.txt | wc -l&lt;br /&gt;
# Expect: 5&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Asking students to also submit the script itself catches copy-pasted reports: the &amp;lt;code&amp;gt;SHEBANG:&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;PERMS:&amp;lt;/code&amp;gt; lines must be consistent with the actual file.&lt;br /&gt;
&lt;br /&gt;
[[Category:Courses]]&lt;br /&gt;
[[Category:Linux]]&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Linux_Basic/Linux_Self_Assessment&amp;diff=2734</id>
		<title>Linux Basic/Linux Self Assessment</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Linux_Basic/Linux_Self_Assessment&amp;diff=2734"/>
		<updated>2026-06-11T09:32:26Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Linux Basics — Self-Assessment =&lt;br /&gt;
&lt;br /&gt;
This page lets you verify that you have mastered the material from the [[Linux Basics Course]]. Work through the parts in order on &#039;&#039;&#039;Anunna&#039;&#039;&#039;. The final challenge produces a report file that proves you completed every step — submit (or keep) that file as evidence.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites:&#039;&#039;&#039; an Anunna account and the course data at &amp;lt;code&amp;gt;/lustre/shared/hpcCourses/shell-lesson-data.zip&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Rules:&#039;&#039;&#039;&lt;br /&gt;
* Do everything from the command line. No file-manager GUIs, no OnDemand file browser (the shell is fine).&lt;br /&gt;
* If you get stuck, use &amp;lt;code&amp;gt;man&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--help&amp;lt;/code&amp;gt;, or the [https://swcarpentry.github.io/shell-novice/ Software Carpentry shell course] — that is part of the skill.&lt;br /&gt;
&lt;br /&gt;
== Part 1 — Connect and orient ==&lt;br /&gt;
&lt;br /&gt;
# Connect to Anunna via SSH.&lt;br /&gt;
# Confirm where you are with &amp;lt;code&amp;gt;pwd&amp;lt;/code&amp;gt;. You should be in your home directory (&amp;lt;code&amp;gt;/home/WUR/yourusername&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
== Part 2 — Build the workspace (directories and navigation) ==&lt;br /&gt;
&lt;br /&gt;
# In your home directory, create this directory tree &#039;&#039;&#039;with a single command&#039;&#039;&#039;:&lt;br /&gt;
#: &amp;lt;pre&amp;gt;~/linux_test/&lt;br /&gt;
#: ├── data/&lt;br /&gt;
#: ├── scripts/&lt;br /&gt;
#: └── results/&amp;lt;/pre&amp;gt;&lt;br /&gt;
#: &#039;&#039;Hint: one &amp;lt;code&amp;gt;mkdir&amp;lt;/code&amp;gt; flag makes parent directories for you.&#039;&#039;&lt;br /&gt;
# Change into &amp;lt;code&amp;gt;~/linux_test/data&amp;lt;/code&amp;gt; using a &#039;&#039;&#039;relative&#039;&#039;&#039; path from your home directory.&lt;br /&gt;
# Go back to your home directory using only &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; shortcuts (no full paths).&lt;br /&gt;
&lt;br /&gt;
== Part 3 — Work with files ==&lt;br /&gt;
&lt;br /&gt;
# Copy the course archive into your home directory and extract it:&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cp /lustre/shared/hpcCourses/shell-lesson-data.zip ~/&lt;br /&gt;
unzip ~/shell-lesson-data.zip -d ~/&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# Find the file &amp;lt;code&amp;gt;unicorn.dat&amp;lt;/code&amp;gt; inside the extracted data and &#039;&#039;&#039;copy&#039;&#039;&#039; it to &amp;lt;code&amp;gt;~/linux_test/data/sample.dat&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Inside &amp;lt;code&amp;gt;~/linux_test/data&amp;lt;/code&amp;gt;, create 12 empty files named &amp;lt;code&amp;gt;run_01.log&amp;lt;/code&amp;gt; through &amp;lt;code&amp;gt;run_12.log&amp;lt;/code&amp;gt; &#039;&#039;&#039;with a single command&#039;&#039;&#039; (brace ranges).&lt;br /&gt;
# Delete &#039;&#039;&#039;only&#039;&#039;&#039; the even-numbered log files using wildcards/ranges — in as few commands as you can. Check with &amp;lt;code&amp;gt;ls&amp;lt;/code&amp;gt; that exactly 6 odd-numbered files remain.&lt;br /&gt;
&lt;br /&gt;
== Part 4 — Pipes, filters, redirects ==&lt;br /&gt;
&lt;br /&gt;
# Count how many lines in &amp;lt;code&amp;gt;sample.dat&amp;lt;/code&amp;gt; contain the pattern &amp;lt;code&amp;gt;TACCGGACAA&amp;lt;/code&amp;gt;, using &amp;lt;code&amp;gt;grep&amp;lt;/code&amp;gt; piped into &amp;lt;code&amp;gt;wc&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Redirect that number into &amp;lt;code&amp;gt;~/linux_test/results/pattern_count.txt&amp;lt;/code&amp;gt; (it should contain a single number, nothing else).&lt;br /&gt;
&lt;br /&gt;
== Part 5 — Environment variables ==&lt;br /&gt;
&lt;br /&gt;
# Create an environment variable holding your full name and &#039;&#039;&#039;export&#039;&#039;&#039; it:&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
export REPORT_AUTHOR=&amp;quot;Your Name&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# Verify it exists with &amp;lt;code&amp;gt;echo $REPORT_AUTHOR&amp;lt;/code&amp;gt; and find it in the output of &amp;lt;code&amp;gt;env&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &#039;&#039;Question to yourself: why is &amp;lt;code&amp;gt;export&amp;lt;/code&amp;gt; needed here? You will find out in the final challenge — your script runs as a child process, and only exported variables reach it.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Part 6 — Final challenge: the report script ==&lt;br /&gt;
&lt;br /&gt;
Using a command-line text editor (&amp;lt;code&amp;gt;nano&amp;lt;/code&amp;gt; is what the course taught, but &amp;lt;code&amp;gt;vim&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;emacs&amp;lt;/code&amp;gt; are equally fine), create the file &amp;lt;code&amp;gt;~/linux_test/scripts/generate_report.sh&amp;lt;/code&amp;gt; with exactly this behaviour. Write it yourself — the skeleton below shows the required output labels, you fill in the commands.&lt;br /&gt;
&lt;br /&gt;
The script must:&lt;br /&gt;
&lt;br /&gt;
* start with the correct &#039;&#039;&#039;interpreter header&#039;&#039;&#039; for bash,&lt;br /&gt;
* write all output to &amp;lt;code&amp;gt;~/linux_test/results/report.txt&amp;lt;/code&amp;gt; (overwriting any previous report),&lt;br /&gt;
* produce one labelled line per check, in this order:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Label !! Content !! What it proves&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;USER:&amp;lt;/code&amp;gt; || output of &amp;lt;code&amp;gt;whoami&amp;lt;/code&amp;gt; || you ran it yourself&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;DATE:&amp;lt;/code&amp;gt; || output of &amp;lt;code&amp;gt;date&amp;lt;/code&amp;gt; || when&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;AUTHOR:&amp;lt;/code&amp;gt; || value of &amp;lt;code&amp;gt;$REPORT_AUTHOR&amp;lt;/code&amp;gt; || you understand &amp;lt;code&amp;gt;export&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;SHEBANG:&amp;lt;/code&amp;gt; || first line of the script itself (&amp;lt;code&amp;gt;head -n 1 &amp;quot;$0&amp;quot;&amp;lt;/code&amp;gt;) || interpreter header present&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;PERMS:&amp;lt;/code&amp;gt; || permission octal of the script itself (&amp;lt;code&amp;gt;stat -c &#039;%a&#039; &amp;quot;$0&amp;quot;&amp;lt;/code&amp;gt;) || you made it executable&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;LOGFILES:&amp;lt;/code&amp;gt; || number of &amp;lt;code&amp;gt;.log&amp;lt;/code&amp;gt; files in &amp;lt;code&amp;gt;~/linux_test/data&amp;lt;/code&amp;gt; || Part 3 globbing done&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;PATTERN:&amp;lt;/code&amp;gt; || contents of &amp;lt;code&amp;gt;~/linux_test/results/pattern_count.txt&amp;lt;/code&amp;gt; || Part 4 done&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A starting skeleton (the first two lines are done for you):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
REPORT=~/linux_test/results/report.txt&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;USER: $(whoami)&amp;quot; &amp;gt; &amp;quot;$REPORT&amp;quot;&lt;br /&gt;
echo &amp;quot;DATE: $(date)&amp;quot; &amp;gt;&amp;gt; &amp;quot;$REPORT&amp;quot;&lt;br /&gt;
# ... your turn: AUTHOR, SHEBANG, PERMS, LOGFILES, PATTERN ...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Mind the difference between &amp;lt;code&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; — only the first line should overwrite.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Run it ===&lt;br /&gt;
&lt;br /&gt;
# Make the script executable for yourself with &amp;lt;code&amp;gt;chmod&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Change into &amp;lt;code&amp;gt;~/linux_test/scripts&amp;lt;/code&amp;gt; and run it with a &#039;&#039;&#039;relative&#039;&#039;&#039; path:&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd ~/linux_test/scripts&lt;br /&gt;
./generate_report.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# Run it once more from your home directory using the &#039;&#039;&#039;full&#039;&#039;&#039; path. Both must work.&lt;br /&gt;
# &#039;&#039;Bonus question: why does plain &amp;lt;code&amp;gt;generate_report.sh&amp;lt;/code&amp;gt; (no &amp;lt;code&amp;gt;./&amp;lt;/code&amp;gt;) fail? Which environment variable is responsible?&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Check yourself ===&lt;br /&gt;
&lt;br /&gt;
Display the report:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cat ~/linux_test/results/report.txt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You pass if &#039;&#039;&#039;all&#039;&#039;&#039; of the following hold:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;AUTHOR:&amp;lt;/code&amp;gt; shows your name (not empty — if it is empty, you forgot &amp;lt;code&amp;gt;export&amp;lt;/code&amp;gt;);&lt;br /&gt;
* &amp;lt;code&amp;gt;SHEBANG:&amp;lt;/code&amp;gt; shows &amp;lt;code&amp;gt;#!/bin/bash&amp;lt;/code&amp;gt;;&lt;br /&gt;
* &amp;lt;code&amp;gt;PERMS:&amp;lt;/code&amp;gt; starts with a &amp;lt;code&amp;gt;7&amp;lt;/code&amp;gt; (e.g. &amp;lt;code&amp;gt;744&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;755&amp;lt;/code&amp;gt;) — owner has read, write &#039;&#039;&#039;and&#039;&#039;&#039; execute;&lt;br /&gt;
* &amp;lt;code&amp;gt;LOGFILES:&amp;lt;/code&amp;gt; is &amp;lt;code&amp;gt;6&amp;lt;/code&amp;gt;;&lt;br /&gt;
* &amp;lt;code&amp;gt;PATTERN:&amp;lt;/code&amp;gt; is a number greater than &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If any line is wrong, fix the corresponding part and re-run the script — that is the whole point of scripts.&lt;br /&gt;
&lt;br /&gt;
== For instructors ==&lt;br /&gt;
&lt;br /&gt;
A submitted &amp;lt;code&amp;gt;report.txt&amp;lt;/code&amp;gt; is verifiable at a glance, or in bulk:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
grep -E &#039;^(AUTHOR: .+|SHEBANG: #!/bin/bash|PERMS: 7..|LOGFILES: 6|PATTERN: [1-9])&#039; report.txt | wc -l&lt;br /&gt;
# Expect: 5&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Asking students to also submit the script itself catches copy-pasted reports: the &amp;lt;code&amp;gt;SHEBANG:&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;PERMS:&amp;lt;/code&amp;gt; lines must be consistent with the actual file.&lt;br /&gt;
&lt;br /&gt;
[[Category:Courses]]&lt;br /&gt;
[[Category:Linux]]&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Linux_Basic&amp;diff=2733</id>
		<title>Linux Basic</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Linux_Basic&amp;diff=2733"/>
		<updated>2026-06-11T09:24:11Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: Added a link to the self-assessment test&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Are you interested in using the High Performance Computing (HPC) Cluster but lack basic Linux knowledge? Join our free 5-hour course on Linux fundamentals for working on the HPC. You will learn the essential Linux commands and skills needed to efficiently navigate the system and automate repetitive tasks.&lt;br /&gt;
&lt;br /&gt;
The course is organized by the Anunna team and SRF, with contributions from WUR scientists experienced in working with the HPC.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Please bring your laptop so you can actively participate and complete the hands-on exercises during the workshop.&lt;br /&gt;
See [[2026 Course dates]] for more information on scheduling and registration details.&lt;br /&gt;
&lt;br /&gt;
==== Self-study material: ====&lt;br /&gt;
If you are not able to attend the course, you can make use of the following resources&lt;br /&gt;
&lt;br /&gt;
* [[:File:WUR Linux Basics Course 2026 Feb.pdf|Latest Slides]]: Slides of the latest course session offered at thw WUR &lt;br /&gt;
* [https://labex.io/linuxjourney Linux Journey]: Great site for self-paced learning about linux. It offers free virtual machines for training&lt;br /&gt;
* [https://www.linux-path.com/en Linux Path]: Fork of Linux journey, has additional curated&lt;br /&gt;
* [https://carpentries.org Software Carpentry]: Community of free lessons on many topics. For linux click Learn &amp;gt; lessons &amp;gt; Unix shell.&lt;br /&gt;
&lt;br /&gt;
=== Self-assessment ===&lt;br /&gt;
The material of this course is a pre-requirement to the HPC and container courses offered by the WUR. In order to attend them we require you do a self-assessment test of your knowledge of the linux command line.&lt;br /&gt;
&lt;br /&gt;
* [[Linux Basic/Linux Self Assessment]]&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Linux_Basic/Linux_Self_Assessment&amp;diff=2732</id>
		<title>Linux Basic/Linux Self Assessment</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Linux_Basic/Linux_Self_Assessment&amp;diff=2732"/>
		<updated>2026-06-11T09:17:54Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: Created page with &amp;quot;= Linux Basics — Self-Assessment =  This page lets you verify that you have mastered the material from the Linux Basics Course. Work through the parts in order on &amp;#039;&amp;#039;&amp;#039;Anunna&amp;#039;&amp;#039;&amp;#039;. The final challenge produces a report file that proves you completed every step — submit (or keep) that file as evidence.  &amp;#039;&amp;#039;&amp;#039;Prerequisites:&amp;#039;&amp;#039;&amp;#039; an Anunna account and the course data at &amp;lt;code&amp;gt;/lustre/shared/hpcCourses/shell-lesson-data.zip&amp;lt;/code&amp;gt;.  &amp;#039;&amp;#039;&amp;#039;Rules:&amp;#039;&amp;#039;&amp;#039; * Do everything from the comm...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Linux Basics — Self-Assessment =&lt;br /&gt;
&lt;br /&gt;
This page lets you verify that you have mastered the material from the [[Linux Basics Course]]. Work through the parts in order on &#039;&#039;&#039;Anunna&#039;&#039;&#039;. The final challenge produces a report file that proves you completed every step — submit (or keep) that file as evidence.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Prerequisites:&#039;&#039;&#039; an Anunna account and the course data at &amp;lt;code&amp;gt;/lustre/shared/hpcCourses/shell-lesson-data.zip&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Rules:&#039;&#039;&#039;&lt;br /&gt;
* Do everything from the command line. No file-manager GUIs, no OnDemand file browser.&lt;br /&gt;
* If you get stuck, use &amp;lt;code&amp;gt;man&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--help&amp;lt;/code&amp;gt;, or the [https://swcarpentry.github.io/shell-novice/ Software Carpentry shell course] — that is part of the skill.&lt;br /&gt;
&lt;br /&gt;
== Part 1 — Connect and orient ==&lt;br /&gt;
&lt;br /&gt;
# Connect to Anunna via SSH.&lt;br /&gt;
# Confirm where you are with &amp;lt;code&amp;gt;pwd&amp;lt;/code&amp;gt;. You should be in your home directory (&amp;lt;code&amp;gt;/home/WUR/yourusername&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
== Part 2 — Build the workspace (directories and navigation) ==&lt;br /&gt;
&lt;br /&gt;
# In your home directory, create this directory tree &#039;&#039;&#039;with a single command&#039;&#039;&#039;:&lt;br /&gt;
#: &amp;lt;pre&amp;gt;~/linux_test/&lt;br /&gt;
#: ├── data/&lt;br /&gt;
#: ├── scripts/&lt;br /&gt;
#: └── results/&amp;lt;/pre&amp;gt;&lt;br /&gt;
#: &#039;&#039;Hint: one &amp;lt;code&amp;gt;mkdir&amp;lt;/code&amp;gt; flag makes parent directories for you.&#039;&#039;&lt;br /&gt;
# Change into &amp;lt;code&amp;gt;~/linux_test/data&amp;lt;/code&amp;gt; using a &#039;&#039;&#039;relative&#039;&#039;&#039; path from your home directory.&lt;br /&gt;
# Go back to your home directory using only &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; shortcuts (no full paths).&lt;br /&gt;
&lt;br /&gt;
== Part 3 — Work with files ==&lt;br /&gt;
&lt;br /&gt;
# Copy the course archive into your home directory and extract it:&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cp /lustre/shared/hpcCourses/shell-lesson-data.zip ~/&lt;br /&gt;
unzip ~/shell-lesson-data.zip -d ~/&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# Find the file &amp;lt;code&amp;gt;unicorn.dat&amp;lt;/code&amp;gt; inside the extracted data and &#039;&#039;&#039;copy&#039;&#039;&#039; it to &amp;lt;code&amp;gt;~/linux_test/data/sample.dat&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Inside &amp;lt;code&amp;gt;~/linux_test/data&amp;lt;/code&amp;gt;, create 12 empty files named &amp;lt;code&amp;gt;run_01.log&amp;lt;/code&amp;gt; through &amp;lt;code&amp;gt;run_12.log&amp;lt;/code&amp;gt; &#039;&#039;&#039;with a single command&#039;&#039;&#039; (brace ranges).&lt;br /&gt;
# Delete &#039;&#039;&#039;only&#039;&#039;&#039; the even-numbered log files using wildcards/ranges — in as few commands as you can. Check with &amp;lt;code&amp;gt;ls&amp;lt;/code&amp;gt; that exactly 6 odd-numbered files remain.&lt;br /&gt;
&lt;br /&gt;
== Part 4 — Pipes, filters, redirects ==&lt;br /&gt;
&lt;br /&gt;
# Count how many lines in &amp;lt;code&amp;gt;sample.dat&amp;lt;/code&amp;gt; contain the pattern &amp;lt;code&amp;gt;TACCGGACAA&amp;lt;/code&amp;gt;, using &amp;lt;code&amp;gt;grep&amp;lt;/code&amp;gt; piped into &amp;lt;code&amp;gt;wc&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Redirect that number into &amp;lt;code&amp;gt;~/linux_test/results/pattern_count.txt&amp;lt;/code&amp;gt; (it should contain a single number, nothing else).&lt;br /&gt;
&lt;br /&gt;
== Part 5 — Environment variables ==&lt;br /&gt;
&lt;br /&gt;
# Create an environment variable holding your full name and &#039;&#039;&#039;export&#039;&#039;&#039; it:&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
export REPORT_AUTHOR=&amp;quot;Your Name&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# Verify it exists with &amp;lt;code&amp;gt;echo $REPORT_AUTHOR&amp;lt;/code&amp;gt; and find it in the output of &amp;lt;code&amp;gt;env&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &#039;&#039;Question to yourself: why is &amp;lt;code&amp;gt;export&amp;lt;/code&amp;gt; needed here? You will find out in the final challenge — your script runs as a child process, and only exported variables reach it.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Part 6 — Final challenge: the report script ==&lt;br /&gt;
&lt;br /&gt;
Using a command-line text editor (&amp;lt;code&amp;gt;nano&amp;lt;/code&amp;gt; is what the course taught, but &amp;lt;code&amp;gt;vim&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;emacs&amp;lt;/code&amp;gt; are equally fine), create the file &amp;lt;code&amp;gt;~/linux_test/scripts/generate_report.sh&amp;lt;/code&amp;gt; with exactly this behaviour. Write it yourself — the skeleton below shows the required output labels, you fill in the commands.&lt;br /&gt;
&lt;br /&gt;
The script must:&lt;br /&gt;
&lt;br /&gt;
* start with the correct &#039;&#039;&#039;interpreter header&#039;&#039;&#039; for bash,&lt;br /&gt;
* write all output to &amp;lt;code&amp;gt;~/linux_test/results/report.txt&amp;lt;/code&amp;gt; (overwriting any previous report),&lt;br /&gt;
* produce one labelled line per check, in this order:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Label !! Content !! What it proves&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;USER:&amp;lt;/code&amp;gt; || output of &amp;lt;code&amp;gt;whoami&amp;lt;/code&amp;gt; || you ran it yourself&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;DATE:&amp;lt;/code&amp;gt; || output of &amp;lt;code&amp;gt;date&amp;lt;/code&amp;gt; || when&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;AUTHOR:&amp;lt;/code&amp;gt; || value of &amp;lt;code&amp;gt;$REPORT_AUTHOR&amp;lt;/code&amp;gt; || you understand &amp;lt;code&amp;gt;export&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;SHEBANG:&amp;lt;/code&amp;gt; || first line of the script itself (&amp;lt;code&amp;gt;head -n 1 &amp;quot;$0&amp;quot;&amp;lt;/code&amp;gt;) || interpreter header present&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;PERMS:&amp;lt;/code&amp;gt; || permission octal of the script itself (&amp;lt;code&amp;gt;stat -c &#039;%a&#039; &amp;quot;$0&amp;quot;&amp;lt;/code&amp;gt;) || you made it executable&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;LOGFILES:&amp;lt;/code&amp;gt; || number of &amp;lt;code&amp;gt;.log&amp;lt;/code&amp;gt; files in &amp;lt;code&amp;gt;~/linux_test/data&amp;lt;/code&amp;gt; || Part 3 globbing done&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;PATTERN:&amp;lt;/code&amp;gt; || contents of &amp;lt;code&amp;gt;~/linux_test/results/pattern_count.txt&amp;lt;/code&amp;gt; || Part 4 done&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A starting skeleton (the first two lines are done for you):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
REPORT=~/linux_test/results/report.txt&lt;br /&gt;
&lt;br /&gt;
echo &amp;quot;USER: $(whoami)&amp;quot; &amp;gt; &amp;quot;$REPORT&amp;quot;&lt;br /&gt;
echo &amp;quot;DATE: $(date)&amp;quot; &amp;gt;&amp;gt; &amp;quot;$REPORT&amp;quot;&lt;br /&gt;
# ... your turn: AUTHOR, SHEBANG, PERMS, LOGFILES, PATTERN ...&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Mind the difference between &amp;lt;code&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;gt;&amp;gt;&amp;lt;/code&amp;gt; — only the first line should overwrite.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Run it ===&lt;br /&gt;
&lt;br /&gt;
# Make the script executable for yourself with &amp;lt;code&amp;gt;chmod&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Change into &amp;lt;code&amp;gt;~/linux_test/scripts&amp;lt;/code&amp;gt; and run it with a &#039;&#039;&#039;relative&#039;&#039;&#039; path:&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cd ~/linux_test/scripts&lt;br /&gt;
./generate_report.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# Run it once more from your home directory using the &#039;&#039;&#039;full&#039;&#039;&#039; path. Both must work.&lt;br /&gt;
# &#039;&#039;Bonus question: why does plain &amp;lt;code&amp;gt;generate_report.sh&amp;lt;/code&amp;gt; (no &amp;lt;code&amp;gt;./&amp;lt;/code&amp;gt;) fail? Which environment variable is responsible?&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Check yourself ===&lt;br /&gt;
&lt;br /&gt;
Display the report:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
cat ~/linux_test/results/report.txt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You pass if &#039;&#039;&#039;all&#039;&#039;&#039; of the following hold:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;AUTHOR:&amp;lt;/code&amp;gt; shows your name (not empty — if it is empty, you forgot &amp;lt;code&amp;gt;export&amp;lt;/code&amp;gt;);&lt;br /&gt;
* &amp;lt;code&amp;gt;SHEBANG:&amp;lt;/code&amp;gt; shows &amp;lt;code&amp;gt;#!/bin/bash&amp;lt;/code&amp;gt;;&lt;br /&gt;
* &amp;lt;code&amp;gt;PERMS:&amp;lt;/code&amp;gt; starts with a &amp;lt;code&amp;gt;7&amp;lt;/code&amp;gt; (e.g. &amp;lt;code&amp;gt;744&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;755&amp;lt;/code&amp;gt;) — owner has read, write &#039;&#039;&#039;and&#039;&#039;&#039; execute;&lt;br /&gt;
* &amp;lt;code&amp;gt;LOGFILES:&amp;lt;/code&amp;gt; is &amp;lt;code&amp;gt;6&amp;lt;/code&amp;gt;;&lt;br /&gt;
* &amp;lt;code&amp;gt;PATTERN:&amp;lt;/code&amp;gt; is a number greater than &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If any line is wrong, fix the corresponding part and re-run the script — that is the whole point of scripts.&lt;br /&gt;
&lt;br /&gt;
== For instructors ==&lt;br /&gt;
&lt;br /&gt;
A submitted &amp;lt;code&amp;gt;report.txt&amp;lt;/code&amp;gt; is verifiable at a glance, or in bulk:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
grep -E &#039;^(AUTHOR: .+|SHEBANG: #!/bin/bash|PERMS: 7..|LOGFILES: 6|PATTERN: [1-9])&#039; report.txt | wc -l&lt;br /&gt;
# Expect: 5&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Asking students to also submit the script itself catches copy-pasted reports: the &amp;lt;code&amp;gt;SHEBANG:&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;PERMS:&amp;lt;/code&amp;gt; lines must be consistent with the actual file.&lt;br /&gt;
&lt;br /&gt;
[[Category:Courses]]&lt;br /&gt;
[[Category:Linux]]&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=SACCT&amp;diff=2717</id>
		<title>SACCT</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=SACCT&amp;diff=2717"/>
		<updated>2026-04-14T05:33:28Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The command [http://slurm.schedmd.com/sacct.html sacct] is meant to show your usage of  Anunna.&lt;br /&gt;
&lt;br /&gt;
For instance at the login screen the command: sacct -a gives the following result:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
user001@login200:~$ sacct -a &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;[[File:sacct capture.jpg]]&lt;br /&gt;
&lt;br /&gt;
It is a standard view to see all the users jobs of that day.&lt;br /&gt;
Better is to modify this command with special parameters to see what you are using from Anunna.&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
user001@login200:~$ sacct -P -X --delimiter=&#039;,&#039; -S 2026-01-01 -E 2026-02-01  \ &lt;br /&gt;
--format=comment%15,User,Partition%20,JobID,JobName,ncpus,nnodes,NodeList,Start,alloccpus,cputime%12,cputimeraw,state  &amp;gt; usage_report_$(date -I).csv&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;The csv-file can be uploaded in Excel. This gives you the next overview. &lt;br /&gt;
Cputimeraw is the time of cpu-usage in seconds. The parameters &amp;quot;-S 2026-01-01 -E 2026-02-01&amp;quot; give you the start date and the end date of period you want to present.&lt;br /&gt;
&lt;br /&gt;
[[File:sacct uitgebreid.jpg]]&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=SACCT&amp;diff=2716</id>
		<title>SACCT</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=SACCT&amp;diff=2716"/>
		<updated>2026-04-14T05:32:15Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The command [http://slurm.schedmd.com/sacct.html sacct] is meant to show your usage of  Anunna.&lt;br /&gt;
&lt;br /&gt;
For instance at the login screen the command: sacct -a gives the following result:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;[test001@nfs01 ~]$ sacct -a&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:sacct capture.jpg]]&lt;br /&gt;
&lt;br /&gt;
It is a standard view to see all the users jobs of that day.&lt;br /&gt;
Better is to modify this command with special parameters to see what you are using from Anunna.&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
user001@login200:~$ sacct -P -X --delimiter=&#039;,&#039; -S 2026-01-01 -E 2026-02-01  \ &lt;br /&gt;
--format=comment%15,User,Partition%20,JobID,JobName,ncpus,nnodes,NodeList,Start,alloccpus,cputime%12,cputimeraw,state  &amp;gt; usage_report_$(date -I).csv&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;The csv-file can be uploaded in Excel. This gives you the next overview. &lt;br /&gt;
Cputimeraw is the time of cpu-usage in seconds. The parameters &amp;quot;-S 2026-01-01 -E 2026-02-01&amp;quot; give you the start date and the end date of period you want to present.&lt;br /&gt;
&lt;br /&gt;
[[File:sacct uitgebreid.jpg]]&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Tutorials&amp;diff=2706</id>
		<title>Tutorials</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Tutorials&amp;diff=2706"/>
		<updated>2026-03-25T10:37:06Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: /* Apptainer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Tutorials ==&lt;br /&gt;
&lt;br /&gt;
=== Modules ===&lt;br /&gt;
[[Create Your Own Modules]]&lt;br /&gt;
&lt;br /&gt;
=== Apptainer ===&lt;br /&gt;
&lt;br /&gt;
* [[Tutorials/Apptainer-Introduction|Introduction]]&lt;br /&gt;
* [[Tutorials/Apptainer-PullingImages|Pulling Images]]&lt;br /&gt;
* [[Tutorials/Apptainer-FakerootAndOverlays|Fakeroot and overlays]]&lt;br /&gt;
* [[Tutorials/Apptainer-FakerootAndSandbox|Fakeroot  and sandbox]]&lt;br /&gt;
* [[Tutorials/Apptainer-DefinitionFiles|Definition Files]]&lt;br /&gt;
* [[Tutorials/Apptainer-GPUs|GPUs]]&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Tutorials&amp;diff=2705</id>
		<title>Tutorials</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Tutorials&amp;diff=2705"/>
		<updated>2026-03-25T10:36:07Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Tutorials ==&lt;br /&gt;
&lt;br /&gt;
=== Modules ===&lt;br /&gt;
[[Create Your Own Modules]]&lt;br /&gt;
&lt;br /&gt;
=== Apptainer ===&lt;br /&gt;
&lt;br /&gt;
* Introduction&lt;br /&gt;
* [[Tutorials/Apptainer-PullingImages|Pulling Images]]&lt;br /&gt;
* [[Tutorials/Apptainer-FakerootAndOverlays|Fakeroot and overlays]]&lt;br /&gt;
* [[Tutorials/Apptainer-FakerootAndSandbox|Fakeroot  and sandbox]]&lt;br /&gt;
* [[Tutorials/Apptainer-DefinitionFiles|Definition Files]]&lt;br /&gt;
* [[Tutorials/Apptainer-GPUs|GPUs]]&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Tutorials/Apptainer-GPUs&amp;diff=2704</id>
		<title>Tutorials/Apptainer-GPUs</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Tutorials/Apptainer-GPUs&amp;diff=2704"/>
		<updated>2026-03-25T10:33:38Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Running Apptainer with GPUs =&lt;br /&gt;
&lt;br /&gt;
Apptainer can pass through GPU hardware from the host into a container, allowing you to run GPU-accelerated workloads (such as deep learning inference or training) inside a fully contained environment. This page covers how to use both NVIDIA and AMD GPUs on the Anunna cluster.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Important:&#039;&#039;&#039; Before you begin, make sure the following are in place:&lt;br /&gt;
&lt;br /&gt;
* Your &amp;lt;code&amp;gt;.sif&amp;lt;/code&amp;gt; image files should be stored on &#039;&#039;&#039;Lustre&#039;&#039;&#039; (e.g. in your scratch space), not in your home directory.&lt;br /&gt;
* Set your Apptainer cache to Lustre, since these images can get quite large:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
export APPTAINER_CACHEDIR=$myScratch/Apptainer&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How GPU Passthrough Works ==&lt;br /&gt;
&lt;br /&gt;
Apptainer does not include GPU drivers inside the container. Instead, it &#039;&#039;&#039;binds&#039;&#039;&#039; the GPU drivers and libraries from the host system into the container at runtime. This means:&lt;br /&gt;
&lt;br /&gt;
* The container must include software built for the correct GPU framework (CUDA for NVIDIA, ROCm for AMD).&lt;br /&gt;
* The host must have the matching GPU drivers installed (which Anunna already has on the GPU nodes).&lt;br /&gt;
* You tell Apptainer to enable GPU access using a flag: &amp;lt;code&amp;gt;--nv&amp;lt;/code&amp;gt; for NVIDIA or &amp;lt;code&amp;gt;--rocm&amp;lt;/code&amp;gt; for AMD.&lt;br /&gt;
&lt;br /&gt;
== NVIDIA GPUs (&amp;lt;code&amp;gt;gpu&amp;lt;/code&amp;gt; partition) ==&lt;br /&gt;
&lt;br /&gt;
To use NVIDIA GPUs, you need to:&lt;br /&gt;
&lt;br /&gt;
# Request a node on the &amp;lt;code&amp;gt;gpu&amp;lt;/code&amp;gt; partition.&lt;br /&gt;
# Use the &amp;lt;code&amp;gt;--nv&amp;lt;/code&amp;gt; flag when running your container.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;--nv&amp;lt;/code&amp;gt; flag tells Apptainer to:&lt;br /&gt;
* Make the &amp;lt;code&amp;gt;/dev/nvidiaX&amp;lt;/code&amp;gt; device entries available inside the container.&lt;br /&gt;
* Locate and bind the CUDA libraries from the host into the container.&lt;br /&gt;
* Set &amp;lt;code&amp;gt;LD_LIBRARY_PATH&amp;lt;/code&amp;gt; so the container uses the host&#039;s GPU libraries.&lt;br /&gt;
&lt;br /&gt;
=== Example: Transcribing Audio with Whisper (NVIDIA) ===&lt;br /&gt;
&lt;br /&gt;
[https://github.com/openai/whisper OpenAI Whisper] is a speech recognition model that benefits greatly from GPU acceleration. Let&#039;s build a container that runs Whisper on an NVIDIA GPU.&lt;br /&gt;
&lt;br /&gt;
==== The Definition File ====&lt;br /&gt;
&lt;br /&gt;
Create a file called &amp;lt;code&amp;gt;whisper_nvidia.def&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;Bootstrap: docker&lt;br /&gt;
From: pytorch/pytorch:2.6.0-cuda12.4-cudnn9-devel&lt;br /&gt;
&lt;br /&gt;
%post&lt;br /&gt;
    apt-get update&lt;br /&gt;
    apt-get install -y ffmpeg git&lt;br /&gt;
    pip install openai-whisper&lt;br /&gt;
    apt-get clean&lt;br /&gt;
&lt;br /&gt;
%environment&lt;br /&gt;
    export LC_ALL=C&lt;br /&gt;
&lt;br /&gt;
%runscript&lt;br /&gt;
    exec whisper --device cuda&amp;quot;$@&amp;quot;&lt;br /&gt;
&lt;br /&gt;
%help&lt;br /&gt;
    Whisper speech recognition container (NVIDIA GPU).&lt;br /&gt;
    Usage: apptainer run --nv whisper_nvidia.sif &amp;lt;audio_file&amp;gt; [options]&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A quick walkthrough of what is happening here:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Section !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;Bootstrap / From&amp;lt;/code&amp;gt; || Uses the official PyTorch Docker image, which already includes Python, PyTorch, CUDA, and cuDNN.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;%post&amp;lt;/code&amp;gt; || Installs &amp;lt;code&amp;gt;ffmpeg&amp;lt;/code&amp;gt; (required by Whisper for audio decoding), &amp;lt;code&amp;gt;git&amp;lt;/code&amp;gt;, and the Whisper package itself.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;%environment&amp;lt;/code&amp;gt; || Sets the locale to avoid encoding warnings.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;%runscript&amp;lt;/code&amp;gt; || Makes &amp;lt;code&amp;gt;whisper&amp;lt;/code&amp;gt; the default command, passing through any arguments.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;%help&amp;lt;/code&amp;gt; || Provides usage information (accessible via &amp;lt;code&amp;gt;apptainer run-help&amp;lt;/code&amp;gt;).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Building the Image ====&lt;br /&gt;
&lt;br /&gt;
Request a compute node and build:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
module reset&lt;br /&gt;
module load utilities Apptainer&lt;br /&gt;
apptainer build whisper_nvidia.sif whisper_nvidia.def&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Running Whisper ====&lt;br /&gt;
&lt;br /&gt;
Once built, run Whisper on the sample audio file. First, request a GPU node:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
srun --partition=gpu --gres=gpu:1 --pty bash&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then load Apptainer and run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
module reset&lt;br /&gt;
module load utilities Apptainer&lt;br /&gt;
apptainer run --nv whisper_nvidia.sif /lustre/shared/hpcCourses/Whisper/audio.mp3 --model base&lt;br /&gt;
apptainer run --nv whisper_nvidia.sif /lustre/shared/hpcCourses/Whisper/audio.mp3 --model large&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;--nv&amp;lt;/code&amp;gt; flag is what makes the GPU visible to the container. Without it, PyTorch would not detect any CUDA devices and Whisper would fall back to CPU (much slower).&lt;br /&gt;
&lt;br /&gt;
You can verify GPU access from inside the container with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer exec --nv whisper_nvidia.sif python -c &amp;quot;import torch; print(torch.cuda.is_available())&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should print &amp;lt;code&amp;gt;True&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== AMD GPUs (&amp;lt;code&amp;gt;gpu_amd&amp;lt;/code&amp;gt; partition) ==&lt;br /&gt;
&lt;br /&gt;
To use AMD GPUs, you need to:&lt;br /&gt;
&lt;br /&gt;
# Request a node on the &amp;lt;code&amp;gt;gpu_amd&amp;lt;/code&amp;gt; partition.&lt;br /&gt;
# Use the &amp;lt;code&amp;gt;--rocm&amp;lt;/code&amp;gt; flag when running your container.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;--rocm&amp;lt;/code&amp;gt; flag tells Apptainer to:&lt;br /&gt;
* Make the &amp;lt;code&amp;gt;/dev/dri/&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/dev/kfd&amp;lt;/code&amp;gt; device entries available inside the container.&lt;br /&gt;
* Locate and bind the ROCm libraries from the host into the container.&lt;br /&gt;
* Set &amp;lt;code&amp;gt;LD_LIBRARY_PATH&amp;lt;/code&amp;gt; so the container uses the host&#039;s ROCm libraries.&lt;br /&gt;
&lt;br /&gt;
=== Example: Transcribing Audio with Whisper (AMD) ===&lt;br /&gt;
&lt;br /&gt;
The same Whisper workflow, but using an AMD GPU with the ROCm stack.&lt;br /&gt;
&lt;br /&gt;
==== The Definition File ====&lt;br /&gt;
&lt;br /&gt;
Create a file called &amp;lt;code&amp;gt;whisper_amd.def&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Bootstrap: docker&lt;br /&gt;
From: rocm/pytorch:rocm7.2_ubuntu24.04_py3.13_pytorch_release_2.10.0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
%post&lt;br /&gt;
    apt-get update&lt;br /&gt;
    apt-get install -y ffmpeg git&lt;br /&gt;
    pip install openai-whisper&lt;br /&gt;
    apt-get clean&lt;br /&gt;
&lt;br /&gt;
%environment&lt;br /&gt;
    export LC_ALL=C&lt;br /&gt;
&lt;br /&gt;
%runscript&lt;br /&gt;
    exec whisper --device cuda &amp;quot;$@&amp;quot;&lt;br /&gt;
&lt;br /&gt;
%help&lt;br /&gt;
    Whisper speech recognition container (AMD ROCm GPU).&lt;br /&gt;
    Usage: apptainer run --rocm whisper_amd.sif &amp;lt;audio_file&amp;gt; [options]  --model &amp;lt;model_size&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The structure is identical to the NVIDIA version. The only difference is the base image: instead of &amp;lt;code&amp;gt;pytorch/pytorch&amp;lt;/code&amp;gt; (which includes CUDA), we use &amp;lt;code&amp;gt;rocm/pytorch&amp;lt;/code&amp;gt; (which includes ROCm). PyTorch&#039;s API is the same regardless of the backend — &amp;lt;code&amp;gt;torch.cuda.is_available()&amp;lt;/code&amp;gt; returns &amp;lt;code&amp;gt;True&amp;lt;/code&amp;gt; on ROCm as well, since ROCm maps onto the CUDA API.&lt;br /&gt;
&lt;br /&gt;
==== Building the Image ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
module reset&lt;br /&gt;
module load utilities Apptainer&lt;br /&gt;
apptainer build whisper_amd.sif whisper_amd.def&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Running Whisper ====&lt;br /&gt;
&lt;br /&gt;
Request an AMD GPU node:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
srun --partition=gpu_amd --gres=gpu:1 --pty bash&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then load Apptainer and run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;module reset&lt;br /&gt;
module load utilities Apptainer&lt;br /&gt;
apptainer run --rocm whisper_amd.sif /lustre/shared/hpcCourses/Whisper/audio.mp3 --model base  &lt;br /&gt;
apptainer run --rocm whisper_amd.sif /lustre/shared/hpcCourses/Whisper/audio.mp3 --model large  &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that even though we are on an AMD GPU, the &amp;lt;code&amp;gt;--device cuda&amp;lt;/code&amp;gt; flag is correct. PyTorch&#039;s ROCm backend uses the same &amp;lt;code&amp;gt;cuda&amp;lt;/code&amp;gt; device name for compatibility.&lt;br /&gt;
&lt;br /&gt;
Verify GPU access:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer exec --rocm whisper_amd.sif python -c &amp;quot;import torch; print(torch.cuda.is_available())&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! !! NVIDIA !! AMD&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Partition&#039;&#039;&#039; || &amp;lt;code&amp;gt;gpu&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;gpu_amd&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Apptainer flag&#039;&#039;&#039; || &amp;lt;code&amp;gt;--nv&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;--rocm&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Base image&#039;&#039;&#039; || &amp;lt;code&amp;gt;pytorch/pytorch&amp;lt;/code&amp;gt; (includes CUDA) || &amp;lt;code&amp;gt;rocm/pytorch&amp;lt;/code&amp;gt; (includes ROCm)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;PyTorch device&#039;&#039;&#039; || &amp;lt;code&amp;gt;--device cuda&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;--device cuda&amp;lt;/code&amp;gt; (same API)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Host devices bound&#039;&#039;&#039; || &amp;lt;code&amp;gt;/dev/nvidiaX&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;/dev/dri/&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/kfd&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The key takeaway: the only things that change between NVIDIA and AMD are the &#039;&#039;&#039;base container image&#039;&#039;&#039;, the &#039;&#039;&#039;Apptainer flag&#039;&#039;&#039;, and the &#039;&#039;&#039;Slurm partition&#039;&#039;&#039;. Your application code stays the same.&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Tutorials/Apptainer-GPUs&amp;diff=2703</id>
		<title>Tutorials/Apptainer-GPUs</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Tutorials/Apptainer-GPUs&amp;diff=2703"/>
		<updated>2026-03-25T09:42:06Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: Created page with &amp;quot;= Running Apptainer with GPUs =  Apptainer can pass through GPU hardware from the host into a container, allowing you to run GPU-accelerated workloads (such as deep learning inference or training) inside a fully contained environment. This page covers how to use both NVIDIA and AMD GPUs on the Anunna cluster.  &amp;#039;&amp;#039;&amp;#039;Important:&amp;#039;&amp;#039;&amp;#039; Before you begin, make sure the following are in place:  * Your &amp;lt;code&amp;gt;.sif&amp;lt;/code&amp;gt; image files should be stored on &amp;#039;&amp;#039;&amp;#039;Lustre&amp;#039;&amp;#039;&amp;#039; (e.g. in your scrat...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Running Apptainer with GPUs =&lt;br /&gt;
&lt;br /&gt;
Apptainer can pass through GPU hardware from the host into a container, allowing you to run GPU-accelerated workloads (such as deep learning inference or training) inside a fully contained environment. This page covers how to use both NVIDIA and AMD GPUs on the Anunna cluster.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Important:&#039;&#039;&#039; Before you begin, make sure the following are in place:&lt;br /&gt;
&lt;br /&gt;
* Your &amp;lt;code&amp;gt;.sif&amp;lt;/code&amp;gt; image files should be stored on &#039;&#039;&#039;Lustre&#039;&#039;&#039; (e.g. in your scratch space), not in your home directory.&lt;br /&gt;
* Set your Apptainer cache to Lustre:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
export APPTAINER_CACHEDIR=$myScratch/Apptainer&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How GPU Passthrough Works ==&lt;br /&gt;
&lt;br /&gt;
Apptainer does not include GPU drivers inside the container. Instead, it &#039;&#039;&#039;binds&#039;&#039;&#039; the GPU drivers and libraries from the host system into the container at runtime. This means:&lt;br /&gt;
&lt;br /&gt;
* The container must include software built for the correct GPU framework (CUDA for NVIDIA, ROCm for AMD).&lt;br /&gt;
* The host must have the matching GPU drivers installed (which Anunna already has on the GPU nodes).&lt;br /&gt;
* You tell Apptainer to enable GPU access using a flag: &amp;lt;code&amp;gt;--nv&amp;lt;/code&amp;gt; for NVIDIA or &amp;lt;code&amp;gt;--rocm&amp;lt;/code&amp;gt; for AMD.&lt;br /&gt;
&lt;br /&gt;
== NVIDIA GPUs (&amp;lt;code&amp;gt;gpu&amp;lt;/code&amp;gt; partition) ==&lt;br /&gt;
&lt;br /&gt;
To use NVIDIA GPUs, you need to:&lt;br /&gt;
&lt;br /&gt;
# Request a node on the &amp;lt;code&amp;gt;gpu&amp;lt;/code&amp;gt; partition.&lt;br /&gt;
# Use the &amp;lt;code&amp;gt;--nv&amp;lt;/code&amp;gt; flag when running your container.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;--nv&amp;lt;/code&amp;gt; flag tells Apptainer to:&lt;br /&gt;
* Make the &amp;lt;code&amp;gt;/dev/nvidiaX&amp;lt;/code&amp;gt; device entries available inside the container.&lt;br /&gt;
* Locate and bind the CUDA libraries from the host into the container.&lt;br /&gt;
* Set &amp;lt;code&amp;gt;LD_LIBRARY_PATH&amp;lt;/code&amp;gt; so the container uses the host&#039;s GPU libraries.&lt;br /&gt;
&lt;br /&gt;
=== Example: Transcribing Audio with Whisper (NVIDIA) ===&lt;br /&gt;
&lt;br /&gt;
[https://github.com/openai/whisper OpenAI Whisper] is a speech recognition model that benefits greatly from GPU acceleration. Let&#039;s build a container that runs Whisper on an NVIDIA GPU.&lt;br /&gt;
&lt;br /&gt;
==== The Definition File ====&lt;br /&gt;
&lt;br /&gt;
Create a file called &amp;lt;code&amp;gt;whisper_nvidia.def&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Bootstrap: docker&lt;br /&gt;
From: pytorch/pytorch:2.6.0-cuda12.4-cudnn9-devel&lt;br /&gt;
&lt;br /&gt;
%post&lt;br /&gt;
    apt-get update&lt;br /&gt;
    apt-get install -y ffmpeg git&lt;br /&gt;
    pip install openai-whisper&lt;br /&gt;
    apt-get clean&lt;br /&gt;
&lt;br /&gt;
%environment&lt;br /&gt;
    export LC_ALL=C&lt;br /&gt;
&lt;br /&gt;
%runscript&lt;br /&gt;
    exec whisper &amp;quot;$@&amp;quot;&lt;br /&gt;
&lt;br /&gt;
%help&lt;br /&gt;
    Whisper speech recognition container (NVIDIA GPU).&lt;br /&gt;
    Usage: apptainer run --nv whisper_nvidia.sif &amp;lt;audio_file&amp;gt; [options]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A quick walkthrough of what is happening here:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Section !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;Bootstrap / From&amp;lt;/code&amp;gt; || Uses the official PyTorch Docker image, which already includes Python, PyTorch, CUDA, and cuDNN.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;%post&amp;lt;/code&amp;gt; || Installs &amp;lt;code&amp;gt;ffmpeg&amp;lt;/code&amp;gt; (required by Whisper for audio decoding), &amp;lt;code&amp;gt;git&amp;lt;/code&amp;gt;, and the Whisper package itself.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;%environment&amp;lt;/code&amp;gt; || Sets the locale to avoid encoding warnings.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;%runscript&amp;lt;/code&amp;gt; || Makes &amp;lt;code&amp;gt;whisper&amp;lt;/code&amp;gt; the default command, passing through any arguments.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;%help&amp;lt;/code&amp;gt; || Provides usage information (accessible via &amp;lt;code&amp;gt;apptainer run-help&amp;lt;/code&amp;gt;).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Building the Image ====&lt;br /&gt;
&lt;br /&gt;
Request a compute node and build:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
module reset&lt;br /&gt;
module load utilities Apptainer&lt;br /&gt;
apptainer build whisper_nvidia.sif whisper_nvidia.def&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Running Whisper ====&lt;br /&gt;
&lt;br /&gt;
Once built, run Whisper on the sample audio file. First, request a GPU node:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
srun --partition=gpu --gres=gpu:1 --pty bash&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then load Apptainer and run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
module reset&lt;br /&gt;
module load utilities Apptainer&lt;br /&gt;
apptainer run --nv whisper_nvidia.sif /lustre/shared/hpcCourses/Whisper/audio.mp3 --model base --device cuda&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;--nv&amp;lt;/code&amp;gt; flag is what makes the GPU visible to the container. Without it, PyTorch would not detect any CUDA devices and Whisper would fall back to CPU (much slower).&lt;br /&gt;
&lt;br /&gt;
You can verify GPU access from inside the container with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer exec --nv whisper_nvidia.sif python -c &amp;quot;import torch; print(torch.cuda.is_available())&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This should print &amp;lt;code&amp;gt;True&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== AMD GPUs (&amp;lt;code&amp;gt;gpu_amd&amp;lt;/code&amp;gt; partition) ==&lt;br /&gt;
&lt;br /&gt;
To use AMD GPUs, you need to:&lt;br /&gt;
&lt;br /&gt;
# Request a node on the &amp;lt;code&amp;gt;gpu_amd&amp;lt;/code&amp;gt; partition.&lt;br /&gt;
# Use the &amp;lt;code&amp;gt;--rocm&amp;lt;/code&amp;gt; flag when running your container.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;--rocm&amp;lt;/code&amp;gt; flag tells Apptainer to:&lt;br /&gt;
* Make the &amp;lt;code&amp;gt;/dev/dri/&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/dev/kfd&amp;lt;/code&amp;gt; device entries available inside the container.&lt;br /&gt;
* Locate and bind the ROCm libraries from the host into the container.&lt;br /&gt;
* Set &amp;lt;code&amp;gt;LD_LIBRARY_PATH&amp;lt;/code&amp;gt; so the container uses the host&#039;s ROCm libraries.&lt;br /&gt;
&lt;br /&gt;
=== Example: Transcribing Audio with Whisper (AMD) ===&lt;br /&gt;
&lt;br /&gt;
The same Whisper workflow, but using an AMD GPU with the ROCm stack.&lt;br /&gt;
&lt;br /&gt;
==== The Definition File ====&lt;br /&gt;
&lt;br /&gt;
Create a file called &amp;lt;code&amp;gt;whisper_amd.def&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Bootstrap: docker&lt;br /&gt;
From: rocm/pytorch:rocm6.2.4_ubuntu22.04_py3.10_pytorch_release_2.5.0&lt;br /&gt;
&lt;br /&gt;
%post&lt;br /&gt;
    apt-get update&lt;br /&gt;
    apt-get install -y ffmpeg git&lt;br /&gt;
    pip install openai-whisper&lt;br /&gt;
    apt-get clean&lt;br /&gt;
&lt;br /&gt;
%environment&lt;br /&gt;
    export LC_ALL=C&lt;br /&gt;
&lt;br /&gt;
%runscript&lt;br /&gt;
    exec whisper &amp;quot;$@&amp;quot;&lt;br /&gt;
&lt;br /&gt;
%help&lt;br /&gt;
    Whisper speech recognition container (AMD ROCm GPU).&lt;br /&gt;
    Usage: apptainer run --rocm whisper_amd.sif &amp;lt;audio_file&amp;gt; [options]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The structure is identical to the NVIDIA version. The only difference is the base image: instead of &amp;lt;code&amp;gt;pytorch/pytorch&amp;lt;/code&amp;gt; (which includes CUDA), we use &amp;lt;code&amp;gt;rocm/pytorch&amp;lt;/code&amp;gt; (which includes ROCm). PyTorch&#039;s API is the same regardless of the backend — &amp;lt;code&amp;gt;torch.cuda.is_available()&amp;lt;/code&amp;gt; returns &amp;lt;code&amp;gt;True&amp;lt;/code&amp;gt; on ROCm as well, since ROCm maps onto the CUDA API.&lt;br /&gt;
&lt;br /&gt;
==== Building the Image ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
module reset&lt;br /&gt;
module load utilities Apptainer&lt;br /&gt;
apptainer build whisper_amd.sif whisper_amd.def&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Running Whisper ====&lt;br /&gt;
&lt;br /&gt;
Request an AMD GPU node:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
srun --partition=gpu_amd --gres=gpu:1 --pty bash&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then load Apptainer and run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
module reset&lt;br /&gt;
module load utilities Apptainer&lt;br /&gt;
apptainer run --rocm whisper_amd.sif /lustre/shared/hpcCourses/Whisper/audio.mp3 --model base --device cuda&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that even though we are on an AMD GPU, the &amp;lt;code&amp;gt;--device cuda&amp;lt;/code&amp;gt; flag is correct. PyTorch&#039;s ROCm backend uses the same &amp;lt;code&amp;gt;cuda&amp;lt;/code&amp;gt; device name for compatibility.&lt;br /&gt;
&lt;br /&gt;
Verify GPU access:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer exec --rocm whisper_amd.sif python -c &amp;quot;import torch; print(torch.cuda.is_available())&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! !! NVIDIA !! AMD&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Partition&#039;&#039;&#039; || &amp;lt;code&amp;gt;gpu&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;gpu_amd&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Apptainer flag&#039;&#039;&#039; || &amp;lt;code&amp;gt;--nv&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;--rocm&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Base image&#039;&#039;&#039; || &amp;lt;code&amp;gt;pytorch/pytorch&amp;lt;/code&amp;gt; (includes CUDA) || &amp;lt;code&amp;gt;rocm/pytorch&amp;lt;/code&amp;gt; (includes ROCm)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;PyTorch device&#039;&#039;&#039; || &amp;lt;code&amp;gt;--device cuda&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;--device cuda&amp;lt;/code&amp;gt; (same API)&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Host devices bound&#039;&#039;&#039; || &amp;lt;code&amp;gt;/dev/nvidiaX&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;/dev/dri/&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/kfd&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The key takeaway: the only things that change between NVIDIA and AMD are the &#039;&#039;&#039;base container image&#039;&#039;&#039;, the &#039;&#039;&#039;Apptainer flag&#039;&#039;&#039;, and the &#039;&#039;&#039;Slurm partition&#039;&#039;&#039;. Your application code stays the same.&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Tutorials/Apptainer-Introduction&amp;diff=2702</id>
		<title>Tutorials/Apptainer-Introduction</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Tutorials/Apptainer-Introduction&amp;diff=2702"/>
		<updated>2026-03-25T09:23:54Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: /* apptainer pull */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction to Apptainer =&lt;br /&gt;
&lt;br /&gt;
== What is Apptainer? ==&lt;br /&gt;
&lt;br /&gt;
Apptainer (formerly known as Singularity) is a container platform designed for High Performance Computing (HPC) environments. If you have heard of Docker, Apptainer solves a similar problem — it lets you package an application together with all of its dependencies (libraries, tools, configuration) into a single portable unit called a &#039;&#039;&#039;container&#039;&#039;&#039;. The key difference is that Apptainer was built from the ground up to run safely on shared multi-user systems like HPC clusters, where Docker cannot be used because it requires root privileges that would pose a security risk.&lt;br /&gt;
&lt;br /&gt;
Some important differences between Apptainer and Docker:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! !! Apptainer !! Docker&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Privileges&#039;&#039;&#039; || Runs as a normal user — no root access needed || Requires root or membership in the &amp;lt;code&amp;gt;docker&amp;lt;/code&amp;gt; group, which is effectively root&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Image format&#039;&#039;&#039; || Single portable &amp;lt;code&amp;gt;.sif&amp;lt;/code&amp;gt; file || Layered images stored in a daemon&#039;s internal storage&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Integration with host&#039;&#039;&#039; || Seamless access to host filesystems, GPUs, and network by default || Isolated by default; explicit configuration needed to share resources&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Designed for&#039;&#039;&#039; || HPC, scientific computing, shared multi-user systems || Cloud, microservices, development environments&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Docker compatibility&#039;&#039;&#039; || Can pull and run Docker images directly || N/A&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Why Apptainer for Research? ===&lt;br /&gt;
&lt;br /&gt;
Two features make Apptainer particularly valuable for scientific work:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Portability:&#039;&#039;&#039; An Apptainer container is a single &amp;lt;code&amp;gt;.sif&amp;lt;/code&amp;gt; file. You can build it on your laptop, copy it to the cluster, share it with a collaborator, or archive it alongside a publication. It will run the same way everywhere Apptainer is installed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Reproducibility:&#039;&#039;&#039; A container captures the exact software environment used for an analysis — down to the specific library versions. This means an experiment can be repeated months or years later with the same environment, even if the host system has changed. When combined with a definition file (a text recipe that describes how the container was built), every step is documented and reproducible.&lt;br /&gt;
&lt;br /&gt;
== Loading Apptainer ==&lt;br /&gt;
&lt;br /&gt;
On the Anunna HPC cluster, Apptainer is available in the &amp;lt;code&amp;gt;utilities&amp;lt;/code&amp;gt; module bucket. Load it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
module reset&lt;br /&gt;
module load utilities&lt;br /&gt;
module load Apptainer&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can verify it is loaded by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer --version&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Best Practices ==&lt;br /&gt;
&lt;br /&gt;
=== Set Your Cache Directory ===&lt;br /&gt;
&lt;br /&gt;
Apptainer downloads container layers to a local cache before building SIF files. By default this cache lives under your home directory (&amp;lt;code&amp;gt;$HOME/.apptainer/cache&amp;lt;/code&amp;gt;), which can quickly exceed your home quota — especially with large images.&lt;br /&gt;
&lt;br /&gt;
Change the cache location to your scratch space by setting the &amp;lt;code&amp;gt;APPTAINER_CACHEDIR&amp;lt;/code&amp;gt; variable. You will need to create the directory first:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mkdir -p $myScratch/Apptainer&lt;br /&gt;
export APPTAINER_CACHEDIR=$myScratch/Apptainer&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider adding the &amp;lt;code&amp;gt;export&amp;lt;/code&amp;gt; line to your &amp;lt;code&amp;gt;~/.bashrc&amp;lt;/code&amp;gt; so it is set automatically in every session.&lt;br /&gt;
&lt;br /&gt;
=== Do Not Run Apptainer on the Login Nodes ===&lt;br /&gt;
&lt;br /&gt;
Building and running containers can be resource-intensive. Always request a compute node (e.g. via &amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt;) before running Apptainer commands. The login nodes are shared and should not be used for heavy workloads.&lt;br /&gt;
&lt;br /&gt;
=== Do Not Store Images in Your Home Directory ===&lt;br /&gt;
&lt;br /&gt;
SIF files can easily be hundreds of megabytes or even several gigabytes in size. Store them on Lustre (e.g. in your scratch or project space) rather than in your home directory to avoid quota issues. Running images can be I/O intensive and this is not suitable for the home directory.&lt;br /&gt;
&lt;br /&gt;
== Basic Commands ==&lt;br /&gt;
&lt;br /&gt;
Apptainer has five core commands you will use regularly:&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;apptainer pull&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Downloads a container image from a remote registry and saves it as a &amp;lt;code&amp;gt;.sif&amp;lt;/code&amp;gt; file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer pull ubuntu.sif docker://ubuntu:18.04&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;apptainer build&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
The build command is used for converting images from one format to another. It can create a SIF from a definition file, convert a sandbox to a SIF, or convert between formats.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Build from a definition file&lt;br /&gt;
apptainer build myimage.sif myrecipe.def&lt;br /&gt;
&lt;br /&gt;
# Convert a sandbox directory to a SIF&lt;br /&gt;
apptainer build myimage.sif /path/to/sandbox/&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;apptainer exec&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Runs a single specific command inside a container and returns the output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer exec ubuntu.sif cat /etc/os-release&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;apptainer shell&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Opens an interactive shell inside the container, allowing you to explore and run commands as if you had logged into a different machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer shell ubuntu.sif&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;apptainer run&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Executes the container&#039;s default action (its &#039;&#039;&#039;runscript&#039;&#039;&#039;). What this does depends on how the container was built.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer run myimage.sif&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== At a Glance ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;apptainer pull&amp;lt;/code&amp;gt; || Download an image from a registry&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;apptainer build&amp;lt;/code&amp;gt; || Build an image from a definition file or sandbox&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;apptainer exec&amp;lt;/code&amp;gt; || Run a single command inside a container&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;apptainer shell&amp;lt;/code&amp;gt; || Open an interactive shell inside a container&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;apptainer run&amp;lt;/code&amp;gt; || Run the container&#039;s default action&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Tutorials/Apptainer-Introduction&amp;diff=2701</id>
		<title>Tutorials/Apptainer-Introduction</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Tutorials/Apptainer-Introduction&amp;diff=2701"/>
		<updated>2026-03-25T09:18:12Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: Created page with &amp;quot;= Introduction to Apptainer =  == What is Apptainer? ==  Apptainer (formerly known as Singularity) is a container platform designed for High Performance Computing (HPC) environments. If you have heard of Docker, Apptainer solves a similar problem — it lets you package an application together with all of its dependencies (libraries, tools, configuration) into a single portable unit called a &amp;#039;&amp;#039;&amp;#039;container&amp;#039;&amp;#039;&amp;#039;. The key difference is that Apptainer was built from the ground...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction to Apptainer =&lt;br /&gt;
&lt;br /&gt;
== What is Apptainer? ==&lt;br /&gt;
&lt;br /&gt;
Apptainer (formerly known as Singularity) is a container platform designed for High Performance Computing (HPC) environments. If you have heard of Docker, Apptainer solves a similar problem — it lets you package an application together with all of its dependencies (libraries, tools, configuration) into a single portable unit called a &#039;&#039;&#039;container&#039;&#039;&#039;. The key difference is that Apptainer was built from the ground up to run safely on shared multi-user systems like HPC clusters, where Docker cannot be used because it requires root privileges that would pose a security risk.&lt;br /&gt;
&lt;br /&gt;
Some important differences between Apptainer and Docker:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! !! Apptainer !! Docker&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Privileges&#039;&#039;&#039; || Runs as a normal user — no root access needed || Requires root or membership in the &amp;lt;code&amp;gt;docker&amp;lt;/code&amp;gt; group, which is effectively root&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Image format&#039;&#039;&#039; || Single portable &amp;lt;code&amp;gt;.sif&amp;lt;/code&amp;gt; file || Layered images stored in a daemon&#039;s internal storage&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Integration with host&#039;&#039;&#039; || Seamless access to host filesystems, GPUs, and network by default || Isolated by default; explicit configuration needed to share resources&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Designed for&#039;&#039;&#039; || HPC, scientific computing, shared multi-user systems || Cloud, microservices, development environments&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Docker compatibility&#039;&#039;&#039; || Can pull and run Docker images directly || N/A&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Why Apptainer for Research? ===&lt;br /&gt;
&lt;br /&gt;
Two features make Apptainer particularly valuable for scientific work:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Portability:&#039;&#039;&#039; An Apptainer container is a single &amp;lt;code&amp;gt;.sif&amp;lt;/code&amp;gt; file. You can build it on your laptop, copy it to the cluster, share it with a collaborator, or archive it alongside a publication. It will run the same way everywhere Apptainer is installed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Reproducibility:&#039;&#039;&#039; A container captures the exact software environment used for an analysis — down to the specific library versions. This means an experiment can be repeated months or years later with the same results, even if the host system has changed. When combined with a definition file (a text recipe that describes how the container was built), every step is documented and reproducible.&lt;br /&gt;
&lt;br /&gt;
== Loading Apptainer ==&lt;br /&gt;
&lt;br /&gt;
On the Anunna HPC cluster, Apptainer is available in the &amp;lt;code&amp;gt;utilities&amp;lt;/code&amp;gt; module bucket. Load it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
module reset&lt;br /&gt;
module load utilities Apptainer&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can verify it is loaded by running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer --version&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Best Practices ==&lt;br /&gt;
&lt;br /&gt;
=== Set Your Cache Directory ===&lt;br /&gt;
&lt;br /&gt;
Apptainer downloads container layers to a local cache before building SIF files. By default this cache lives under your home directory (&amp;lt;code&amp;gt;$HOME/.apptainer/cache&amp;lt;/code&amp;gt;), which can quickly exceed your home quota — especially with large images.&lt;br /&gt;
&lt;br /&gt;
Change the cache location to your scratch space by setting the &amp;lt;code&amp;gt;APPTAINER_CACHEDIR&amp;lt;/code&amp;gt; variable. You will need to create the directory first:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mkdir -p $myScratch/Apptainer&lt;br /&gt;
export APPTAINER_CACHEDIR=$myScratch/Apptainer&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Consider adding the &amp;lt;code&amp;gt;export&amp;lt;/code&amp;gt; line to your &amp;lt;code&amp;gt;~/.bashrc&amp;lt;/code&amp;gt; so it is set automatically in every session.&lt;br /&gt;
&lt;br /&gt;
=== Do Not Run Apptainer on the Login Nodes ===&lt;br /&gt;
&lt;br /&gt;
Building and running containers can be resource-intensive. Always request a compute node (e.g. via &amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt;) before running Apptainer commands. The login nodes are shared and should not be used for heavy workloads.&lt;br /&gt;
&lt;br /&gt;
=== Do Not Store Images in Your Home Directory ===&lt;br /&gt;
&lt;br /&gt;
SIF files can easily be hundreds of megabytes or even several gigabytes in size. Store them on Lustre (e.g. in your scratch or project space) rather than in your home directory to avoid quota issues.&lt;br /&gt;
&lt;br /&gt;
== Basic Commands ==&lt;br /&gt;
&lt;br /&gt;
Apptainer has five core commands you will use regularly:&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;apptainer pull&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Downloads a container image from a remote registry and saves it as a &amp;lt;code&amp;gt;.sif&amp;lt;/code&amp;gt; file. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer pull ubuntu.sif docker://ubuntu:24.04&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;apptainer build&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
The build command is used for converting images from one format to another. It can create a SIF from a definition file, convert a sandbox to a SIF, or convert between formats.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Build from a definition file&lt;br /&gt;
apptainer build myimage.sif myrecipe.def&lt;br /&gt;
&lt;br /&gt;
# Convert a sandbox directory to a SIF&lt;br /&gt;
apptainer build myimage.sif /path/to/sandbox/&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;apptainer exec&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Runs a single specific command inside a container and returns the output.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer exec ubuntu.sif cat /etc/os-release&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;apptainer shell&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Opens an interactive shell inside the container, allowing you to explore and run commands as if you had logged into a different machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer shell ubuntu.sif&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;apptainer run&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Executes the container&#039;s default action (its &#039;&#039;&#039;runscript&#039;&#039;&#039;). What this does depends on how the container was built.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer run myimage.sif&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== At a Glance ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;apptainer pull&amp;lt;/code&amp;gt; || Download an image from a registry&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;apptainer build&amp;lt;/code&amp;gt; || Build an image from a definition file or sandbox&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;apptainer exec&amp;lt;/code&amp;gt; || Run a single command inside a container&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;apptainer shell&amp;lt;/code&amp;gt; || Open an interactive shell inside a container&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;apptainer run&amp;lt;/code&amp;gt; || Run the container&#039;s default action&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Main_Page&amp;diff=2700</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Main_Page&amp;diff=2700"/>
		<updated>2026-03-25T06:56:50Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: Add tutorials section  and edited the heading of the courses section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Anunna is a [http://en.wikipedia.org/wiki/High-performance_computing High Performance Computer] (HPC) infrastructure hosted by [https://www.wur.nl/en/show/supercomputer-anunna-opens-up-more-opportunities-for-data-storage-and-artificial-intelligence-applications.htm Wageningen University &amp;amp; Research Centre]. It is open for use for all WUR research groups as well as other organizations, including companies, that have collaborative projects with WUR. &lt;br /&gt;
&lt;br /&gt;
= About =&lt;br /&gt;
&lt;br /&gt;
* [[History of the Cluster|Historical information on the startup of Anunna]]&lt;br /&gt;
&lt;br /&gt;
== Access Policy ==&lt;br /&gt;
[[Access_Policy | Main Article: Access Policy]]&lt;br /&gt;
&lt;br /&gt;
Access needs to be granted actively (by creation of an account on the cluster by FB-IT). Use of resources is limited by the scheduler. Note that the use of Anunna is not free of charge. &lt;br /&gt;
&lt;br /&gt;
= Our Courses and Tutorials =&lt;br /&gt;
The Anunna team organizes HPC courses three times a year to strengthen basic &amp;amp; more advanced skills and enable users to make the most effective use of our facility.&lt;br /&gt;
&lt;br /&gt;
* [[Linux Basic]]&lt;br /&gt;
* [[HPC Basic]]&lt;br /&gt;
* [[HPC Advanced]]&lt;br /&gt;
* [[2026 Course dates]]&lt;br /&gt;
* [[Tutorials]]&lt;br /&gt;
&lt;br /&gt;
= Using Anunna =&lt;br /&gt;
* [[Tariffs | Costs associated with resource usage]]&lt;br /&gt;
&lt;br /&gt;
== Gaining access to Anunna==&lt;br /&gt;
Access to the cluster and file transfer are traditionally done via [http://en.wikipedia.org/wiki/Secure_Shell SSH and SFTP].&lt;br /&gt;
* [[log_in_to_B4F_cluster | Logging into cluster using ssh]]&lt;br /&gt;
* [[file_transfer | File transfer options]]&lt;br /&gt;
* [[Services | Alternative access methods, and extra features and services on Anunna]]&lt;br /&gt;
* [[Filesystems | Data storage methods on Anunna]]&lt;br /&gt;
&lt;br /&gt;
== Using Anunna for courses (mainly jupyter notebooks) ==&lt;br /&gt;
* [[steps_for_courses | Steps involved to run a course on Anunna]]&lt;br /&gt;
 &lt;br /&gt;
= Events =&lt;br /&gt;
&lt;br /&gt;
* [[Courses]] that have happened and are happening&lt;br /&gt;
* [[Downtime]] that will affect all users&lt;br /&gt;
* [[Meetings]] that may affect the policies of Anunna&lt;br /&gt;
&lt;br /&gt;
= Software =&lt;br /&gt;
* [[Modules]]&lt;br /&gt;
* [[Apptainer]]&lt;br /&gt;
* [[Python]]&lt;br /&gt;
* [[R]] &lt;br /&gt;
* [[Julia]]&lt;br /&gt;
&lt;br /&gt;
== Browser apps ==&lt;br /&gt;
This page provides an overview of the GUI-based applications available Anunna, including background information and practical guidance on how to access and use interactive desktops and graphical tools directly from your web browser.&lt;br /&gt;
&lt;br /&gt;
* [[General overview|General Overview]]&lt;br /&gt;
* [[Anunna Shell Access]]&lt;br /&gt;
* [[Using the File browser|File Browser]]&lt;br /&gt;
* [[Jupyter|Featured Apps]]&lt;br /&gt;
* [[Jupyter]]&lt;br /&gt;
* [[RStudio|R Studio]]&lt;br /&gt;
* [[Linux desktop|Linux Desktop]]&lt;br /&gt;
* [[Requesting new software|Requesting New Software]]&lt;br /&gt;
&lt;br /&gt;
== Command-line Software ==&lt;br /&gt;
&lt;br /&gt;
==== Cluster Scheduler ====&lt;br /&gt;
Anunna uses Slurm as job scheduler.&lt;br /&gt;
* [[Using_Slurm | Submit jobs with Slurm]]&lt;br /&gt;
* [[node_usage_graph | Be aware of how much work the cluster is under right now with &#039;node_usage_graph&#039;]]&lt;br /&gt;
* [[SLURM_Compare | Rosetta Stone of Workload Managers]]&lt;br /&gt;
&lt;br /&gt;
==== [[Globally installed software]] ====&lt;br /&gt;
&lt;br /&gt;
==== [[ABGC_modules |ABGC specific modules]] ====&lt;br /&gt;
&lt;br /&gt;
==== Installation of software by users ====&lt;br /&gt;
* [[Domain_specific_software_on_B4Fcluster_installation_by_users | Installing domain specific software: installation by users]]&lt;br /&gt;
* [[Setting local variables]]&lt;br /&gt;
* [[Installing_R_packages_locally | Installing R packages locally]]&lt;br /&gt;
* [[Setting_up_Python_virtualenv | Setting up and using a virtual environment for Python3 ]]&lt;br /&gt;
* [[Virtual_environment_Python_3.4_or_higher | Setting up and using a virtual environment for Python3.4 or higher ]]&lt;br /&gt;
* [[Installing WRF and WPS]]&lt;br /&gt;
* [[Running scripts on a fixed timeschedule (cron)]]&lt;br /&gt;
&lt;br /&gt;
= Useful Notes = &lt;br /&gt;
&lt;br /&gt;
== Being in control of Environment parameters ==&lt;br /&gt;
&lt;br /&gt;
* [[Using_environment_modules | Using environment modules]]&lt;br /&gt;
* [[Aliases and local variables]]&lt;br /&gt;
* [[Setting local variables]]&lt;br /&gt;
* [[Setting_TMPDIR | Set a custom temporary directory location]]&lt;br /&gt;
* [[Installing_R_packages_locally | Installing R packages locally]]&lt;br /&gt;
* [[Setting_up_Python_virtualenv | Setting up and using a virtual environment for Python3 ]]&lt;br /&gt;
* [[Locale_settings]] (how numbers and dates are displayed)&lt;br /&gt;
&lt;br /&gt;
== Controlling costs ==&lt;br /&gt;
&lt;br /&gt;
* [[SACCT | using SACCT to see your costs]]&lt;br /&gt;
* [[get_my_bill | using the &amp;quot;get_my_bill&amp;quot; script to estimate costs]]&lt;br /&gt;
&lt;br /&gt;
== Management ==&lt;br /&gt;
Product Owner of Anunna is Alexander van Ittersum (Wageningen UR,FB-IT, C&amp;amp;PS). [[User: prins089 | Fons Prinsen (Wageningen UR, FB-IT, C&amp;amp;PS)]] is responsible for [[Maintenance_and_Management | Maintenance and Management]] of the cluster.&lt;br /&gt;
&lt;br /&gt;
* [[Roadmap | Ambitions regarding innovation, support and administration of Anunna ]]&lt;br /&gt;
&lt;br /&gt;
= Miscellaneous =&lt;br /&gt;
* [[Bioinformatics_tips_tricks_workflows |Bioinformatics tips, tricks, and workflows]]&lt;br /&gt;
* [[Parallel_R_code_on_SLURM | Running parallel R code on SLURM]]&lt;br /&gt;
* [[Convert_between_MediaWiki_and_other_formats | Convert between MediaWiki format and other formats]]&lt;br /&gt;
* [[Manual GitLab | GitLab: Create projects and add scripts]]&lt;br /&gt;
* [[Monitoring_executions | Monitoring job execution]]&lt;br /&gt;
* [[Shared_folders | Working with shared folders in the Lustre file system]]&lt;br /&gt;
* [[Old_binaries | Running older binaries on the updated OS]]&lt;br /&gt;
* [[locale_settings | How to change language settings for yourself]]&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
* [[Maintenance_and_Management | Maintenance and Management]]&lt;br /&gt;
* [[About_ABGC | About ABGC]]&lt;br /&gt;
* [[Computer_cluster | High Performance Computing @ABGC]]&lt;br /&gt;
* [[Lustre_PFS_layout | Lustre Parallel File System layout]]&lt;br /&gt;
&lt;br /&gt;
= External links =&lt;br /&gt;
{| width=&amp;quot;90%&amp;quot;&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot;&lt;br /&gt;
| width=&amp;quot;30%&amp;quot; |&lt;br /&gt;
* [https://www.wur.nl/en/Value-Creation-Cooperation/Facilities/Wageningen-Shared-Research-Facilities/Our-facilities/Show/High-Performance-Computing-Cluster-HPC-Anunna.htm SRF offers a HPC facilty]&lt;br /&gt;
| width=&amp;quot;30%&amp;quot; |&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Scientific_Linux Scientific Linux]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Help:Cheatsheet Help with editing Wiki pages]&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Tutorials/Apptainer-FakerootAndOverlays&amp;diff=2699</id>
		<title>Tutorials/Apptainer-FakerootAndOverlays</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Tutorials/Apptainer-FakerootAndOverlays&amp;diff=2699"/>
		<updated>2026-03-25T06:54:45Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Apptainer Overlays: Modifying Container Images =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Important:&#039;&#039;&#039; Before you begin, make sure the following are in place:&lt;br /&gt;
&lt;br /&gt;
* You are running on a &#039;&#039;&#039;compute node&#039;&#039;&#039;, not a login node. Request an interactive session first (e.g. via &amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt; or your scheduler).&lt;br /&gt;
* Your &amp;lt;code&amp;gt;.sif&amp;lt;/code&amp;gt; image files should be stored on &#039;&#039;&#039;Lustre&#039;&#039;&#039; (e.g. in your scratch space), not in your home directory. SIF files can be large and will eat through your home quota fast.&lt;br /&gt;
* Set your Apptainer cache to Lustre as well. Add this to your session (or your &amp;lt;code&amp;gt;.bashrc&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
export APPTAINER_CACHEDIR=$myScratch/apptainer_cache&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
&lt;br /&gt;
Load the required modules:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
module reset&lt;br /&gt;
module load utilities Apptainer&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Pulling the Base Image ==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s pull an Ubuntu 24.04 image from Docker Hub:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer pull ./ubuntu_24.04.sif docker://ubuntu:24.04&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will download and convert the image into a SIF file in your current directory.&lt;br /&gt;
&lt;br /&gt;
== The Problem: SIF Images Are Read-Only ==&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s try to update the package list inside the container:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer exec ubuntu_24.04.sif apt update&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will fail. You will see errors about not being able to write to package lists and lock files. This is because SIF files are &#039;&#039;&#039;read-only&#039;&#039;&#039; by design — you cannot modify them directly.&lt;br /&gt;
&lt;br /&gt;
So how do we install software into a container? This is where &#039;&#039;&#039;overlays&#039;&#039;&#039; and &#039;&#039;&#039;fakeroot&#039;&#039;&#039; come in.&lt;br /&gt;
&lt;br /&gt;
== What is fakeroot? ==&lt;br /&gt;
&lt;br /&gt;
On an HPC system you do not have root (administrator) privileges. But many operations inside a container — like installing packages with &amp;lt;code&amp;gt;apt&amp;lt;/code&amp;gt; — expect to be run as root.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;--fakeroot&amp;lt;/code&amp;gt; flag (or &amp;lt;code&amp;gt;-f&amp;lt;/code&amp;gt;) tells Apptainer to make it &#039;&#039;look like&#039;&#039; you are running as root inside the container, even though you are not actually root on the host system. This is enough to trick package managers like &amp;lt;code&amp;gt;apt&amp;lt;/code&amp;gt; into working.&lt;br /&gt;
&lt;br /&gt;
== What is an Overlay? ==&lt;br /&gt;
&lt;br /&gt;
An overlay is a writable layer that sits on top of a read-only SIF image. Think of it like putting a sheet of tracing paper over a printed page — you can write on the tracing paper without changing the original page underneath.&lt;br /&gt;
&lt;br /&gt;
Any changes you make (installed packages, new files, config changes) are stored in the overlay, leaving the original SIF image untouched.&lt;br /&gt;
&lt;br /&gt;
== Creating and Using an Overlay ==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s create a temporary directory to use as our overlay:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ov=$(mktemp -d)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This creates a temporary directory somewhere under &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; and stores the path in the variable &amp;lt;code&amp;gt;$ov&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s try that &amp;lt;code&amp;gt;apt update&amp;lt;/code&amp;gt; again, this time with &amp;lt;code&amp;gt;--fakeroot&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--overlay&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer exec --fakeroot --overlay $ov ubuntu_24.04.sif apt update&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This time it should work. Apptainer is running you as fake root, and any writes are going into the overlay directory instead of trying to modify the read-only SIF.&lt;br /&gt;
&lt;br /&gt;
== Installing Software via the Overlay ==&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s install &amp;lt;code&amp;gt;neofetch&amp;lt;/code&amp;gt; (a tool that displays system information) into the container through the overlay:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer exec --fakeroot --overlay $ov ubuntu_24.04.sif apt install -y neofetch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-y&amp;lt;/code&amp;gt; flag tells &amp;lt;code&amp;gt;apt&amp;lt;/code&amp;gt; to answer &amp;quot;yes&amp;quot; to all prompts automatically.&lt;br /&gt;
&lt;br /&gt;
Once this completes, neofetch is installed — but only in the overlay. The original &amp;lt;code&amp;gt;ubuntu_24.04.sif&amp;lt;/code&amp;gt; is still untouched.&lt;br /&gt;
&lt;br /&gt;
The takeaway tis that the an overlay enables a read-only image to be &amp;quot;modified&amp;quot; at runtime. This enables the use of applications that dowlooad data, e.g. databases at runtime. &lt;br /&gt;
&lt;br /&gt;
== Cleaning Up ==&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to remove the temporary overlay directory when you&#039;re done:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
rm -rf $ov&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Step !! Command&lt;br /&gt;
|-&lt;br /&gt;
| Pull base image || &amp;lt;code&amp;gt;apptainer pull ./ubuntu_24.04.sif docker://ubuntu:24.04&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Create overlay directory || &amp;lt;code&amp;gt;ov=$(mktemp -d)&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Update packages (with overlay + fakeroot) || &amp;lt;code&amp;gt;apptainer exec --fakeroot --overlay $ov ubuntu_24.04.sif apt update&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Install software || &amp;lt;code&amp;gt;apptainer exec --fakeroot --overlay $ov ubuntu_24.04.sif apt install -y neofetch&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Clean up overlay || &amp;lt;code&amp;gt;rm -rf $ov&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Tutorials&amp;diff=2686</id>
		<title>Tutorials</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Tutorials&amp;diff=2686"/>
		<updated>2026-03-12T13:18:36Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Tutorials ==&lt;br /&gt;
&lt;br /&gt;
=== Modules ===&lt;br /&gt;
[[Create Your Own Modules]]&lt;br /&gt;
&lt;br /&gt;
=== Apptainer ===&lt;br /&gt;
&lt;br /&gt;
* [[Tutorials/Apptainer-PullingImages|Pulling Images]]&lt;br /&gt;
* [[Tutorials/Apptainer-FakerootAndOverlays|Fakeroot and overlays]]&lt;br /&gt;
* [[Tutorials/Apptainer-FakerootAndSandbox|Fakeroot  and sandbox]]&lt;br /&gt;
* [[Tutorials/Apptainer-DefinitionFiles|Definition Files]]&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Tutorials/Apptainer-DefinitionFiles&amp;diff=2685</id>
		<title>Tutorials/Apptainer-DefinitionFiles</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Tutorials/Apptainer-DefinitionFiles&amp;diff=2685"/>
		<updated>2026-03-12T12:32:44Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: Created page with &amp;quot;= Apptainer Definition Files: Building Containers from a Recipe =  &amp;#039;&amp;#039;&amp;#039;Important:&amp;#039;&amp;#039;&amp;#039; Before you begin, make sure the following are in place:  * You are running on a &amp;#039;&amp;#039;&amp;#039;compute node&amp;#039;&amp;#039;&amp;#039;, not a login node. Request an interactive session first (e.g. via &amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt; or your scheduler). * Your &amp;lt;code&amp;gt;.sif&amp;lt;/code&amp;gt; image files should be stored on &amp;#039;&amp;#039;&amp;#039;Lustre&amp;#039;&amp;#039;&amp;#039; (e.g. in your scratch space), not in your home directory. SIF files can be large and will eat through your home quota...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Apptainer Definition Files: Building Containers from a Recipe =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Important:&#039;&#039;&#039; Before you begin, make sure the following are in place:&lt;br /&gt;
&lt;br /&gt;
* You are running on a &#039;&#039;&#039;compute node&#039;&#039;&#039;, not a login node. Request an interactive session first (e.g. via &amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt; or your scheduler).&lt;br /&gt;
* Your &amp;lt;code&amp;gt;.sif&amp;lt;/code&amp;gt; image files should be stored on &#039;&#039;&#039;Lustre&#039;&#039;&#039; (e.g. in your scratch space), not in your home directory. SIF files can be large and will eat through your home quota fast.&lt;br /&gt;
* Set your Apptainer cache to Lustre as well. Add this to your session (or your &amp;lt;code&amp;gt;.bashrc&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
export APPTAINER_CACHEDIR=$myScratch/apptainer_cache&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
&lt;br /&gt;
Load the required modules:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
module reset&lt;br /&gt;
module load utilities Apptainer&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== What is a Definition File? ==&lt;br /&gt;
&lt;br /&gt;
In the previous tutorials we modified containers by hand — either through overlays or by entering a sandbox and running commands interactively. That works, but it has a problem: if someone else (or future you) wants to know exactly what was changed, there is no record of the steps taken.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;definition file&#039;&#039;&#039; (sometimes called a &amp;quot;def file&amp;quot; or &amp;quot;recipe&amp;quot;) solves this. It is a plain text file that describes, step by step, how to build a container from scratch. Think of it like a cooking recipe: it lists the base ingredients and every instruction needed to produce the final result. Anyone with the same definition file can reproduce the exact same container.&lt;br /&gt;
&lt;br /&gt;
== The Definition File ==&lt;br /&gt;
&lt;br /&gt;
Create a file called &amp;lt;code&amp;gt;cowsay.def&amp;lt;/code&amp;gt; with the following contents:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Bootstrap: docker&lt;br /&gt;
From: ubuntu:24.04&lt;br /&gt;
&lt;br /&gt;
%post&lt;br /&gt;
    apt-get update&lt;br /&gt;
    apt-get install -y cowsay fortune-mod&lt;br /&gt;
    apt-get clean&lt;br /&gt;
&lt;br /&gt;
%environment&lt;br /&gt;
    export PATH=/usr/games:${PATH}&lt;br /&gt;
&lt;br /&gt;
%runscript&lt;br /&gt;
    fortune | cowsay&lt;br /&gt;
    exec &amp;quot;$@&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&#039;s walk through each section.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;Bootstrap&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;From&amp;lt;/code&amp;gt; (the Header) ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Bootstrap: docker&lt;br /&gt;
From: ubuntu:24.04&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The header tells Apptainer where to get the base image to start from. &amp;lt;code&amp;gt;Bootstrap: docker&amp;lt;/code&amp;gt; means we are pulling from a Docker/OCI registry, and &amp;lt;code&amp;gt;From: ubuntu:24.04&amp;lt;/code&amp;gt; specifies which image. This is equivalent to the &amp;lt;code&amp;gt;apptainer pull docker://ubuntu:24.04&amp;lt;/code&amp;gt; command we used in the earlier tutorials.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;%post&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
%post&lt;br /&gt;
    apt-get update&lt;br /&gt;
    apt-get install -y cowsay fortune-mod&lt;br /&gt;
    apt-get clean&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;%post&amp;lt;/code&amp;gt; section contains commands that run &#039;&#039;&#039;inside the container at build time&#039;&#039;&#039;, as root. This is where you install software, download data, compile code, or make any other modifications to the container&#039;s filesystem. It is the equivalent of what we did interactively inside the sandbox shell.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;%environment&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
%environment&lt;br /&gt;
    export PATH=/usr/games:${PATH}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;%environment&amp;lt;/code&amp;gt; section defines environment variables that are set every time the container runs. Here we add &amp;lt;code&amp;gt;/usr/games&amp;lt;/code&amp;gt; to the PATH so that &amp;lt;code&amp;gt;cowsay&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;fortune&amp;lt;/code&amp;gt; can be found. This replaces the manual &amp;lt;code&amp;gt;echo&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;90-environment.sh&amp;lt;/code&amp;gt; that we did in the sandbox tutorial.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;%runscript&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
%runscript&lt;br /&gt;
    fortune | cowsay&lt;br /&gt;
    exec &amp;quot;$@&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;%runscript&amp;lt;/code&amp;gt; section defines the default action when someone uses &amp;lt;code&amp;gt;apptainer run&amp;lt;/code&amp;gt; on the container. This replaces the manual edit we made to the runscript file in the sandbox tutorial. The &amp;lt;code&amp;gt;exec &amp;quot;$@&amp;quot;&amp;lt;/code&amp;gt; line at the end allows the container to accept additional arguments if needed.&lt;br /&gt;
&lt;br /&gt;
== Building the Image ==&lt;br /&gt;
&lt;br /&gt;
With the definition file in place, build the SIF image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer build cowsay.sif cowsay.def&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Apptainer will pull the base Ubuntu image, run the &amp;lt;code&amp;gt;%post&amp;lt;/code&amp;gt; commands to install the software, set up the environment and runscript, and package everything into &amp;lt;code&amp;gt;cowsay.sif&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Running It ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer run cowsay.sif&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see a random fortune inside a cow speech bubble:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
 ________________________________________&lt;br /&gt;
/ You will be awarded some great honor.  \&lt;br /&gt;
\                                        /&lt;br /&gt;
 ----------------------------------------&lt;br /&gt;
        \   ^__^&lt;br /&gt;
         \  (oo)\_______&lt;br /&gt;
            (__)\       )\/\&lt;br /&gt;
                ||----w |&lt;br /&gt;
                ||     ||&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The same result as the sandbox tutorial — but this time, every step is documented in a single file that anyone can inspect and reproduce.&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Step !! Command&lt;br /&gt;
|-&lt;br /&gt;
| Create the definition file || Write &amp;lt;code&amp;gt;cowsay.def&amp;lt;/code&amp;gt; (see above)&lt;br /&gt;
|-&lt;br /&gt;
| Build the image || &amp;lt;code&amp;gt;apptainer build cowsay.sif cowsay.def&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Run it || &amp;lt;code&amp;gt;apptainer run cowsay.sif&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Definition File Sections at a Glance ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Section !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;Bootstrap&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;From&amp;lt;/code&amp;gt; || Where to get the base image (the starting point)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;%post&amp;lt;/code&amp;gt; || Commands to run inside the container at build time (install software, configure things)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;%environment&amp;lt;/code&amp;gt; || Environment variables set every time the container runs&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;%runscript&amp;lt;/code&amp;gt; || The default command executed by &amp;lt;code&amp;gt;apptainer run&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Tutorials/Apptainer-FakerootAndSandbox&amp;diff=2684</id>
		<title>Tutorials/Apptainer-FakerootAndSandbox</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Tutorials/Apptainer-FakerootAndSandbox&amp;diff=2684"/>
		<updated>2026-03-12T12:22:43Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: Created page with &amp;quot;= Apptainer Sandbox: Modifying Containers Interactively =  &amp;#039;&amp;#039;&amp;#039;Important:&amp;#039;&amp;#039;&amp;#039; Before you begin, make sure the following are in place:  * You are running on a &amp;#039;&amp;#039;&amp;#039;compute node&amp;#039;&amp;#039;&amp;#039;, not a login node. Request an interactive session first (e.g. via &amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt; or your scheduler). * Your &amp;lt;code&amp;gt;.sif&amp;lt;/code&amp;gt; image files should be stored on &amp;#039;&amp;#039;&amp;#039;Lustre&amp;#039;&amp;#039;&amp;#039; (e.g. in your scratch space), not in your home directory. SIF files can be large and will eat through your home quota fast. *...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Apptainer Sandbox: Modifying Containers Interactively =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Important:&#039;&#039;&#039; Before you begin, make sure the following are in place:&lt;br /&gt;
&lt;br /&gt;
* You are running on a &#039;&#039;&#039;compute node&#039;&#039;&#039;, not a login node. Request an interactive session first (e.g. via &amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt; or your scheduler).&lt;br /&gt;
* Your &amp;lt;code&amp;gt;.sif&amp;lt;/code&amp;gt; image files should be stored on &#039;&#039;&#039;Lustre&#039;&#039;&#039; (e.g. in your scratch space), not in your home directory. SIF files can be large and will eat through your home quota fast.&lt;br /&gt;
* Set your Apptainer cache to Lustre as well. Add this to your session (or your &amp;lt;code&amp;gt;.bashrc&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
export APPTAINER_CACHEDIR=$myScratch/apptainer_cache&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
&lt;br /&gt;
Load the required modules:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
module reset&lt;br /&gt;
module load utilities Apptainer&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== What is a Sandbox? ==&lt;br /&gt;
&lt;br /&gt;
In the previous tutorial we used overlays to make changes on top of a read-only SIF image. Another approach is to convert the image into a &#039;&#039;&#039;sandbox&#039;&#039;&#039; — a regular directory on disk that contains the full filesystem of the container. Because it is just a directory, you can write to it directly.&lt;br /&gt;
&lt;br /&gt;
This makes it easy to interactively install software, edit config files, and generally tinker with the container before converting it back into a portable SIF file.&lt;br /&gt;
&lt;br /&gt;
== Pulling as a Sandbox ==&lt;br /&gt;
&lt;br /&gt;
First, create a temporary directory and pull the Ubuntu 24.04 image directly as a sandbox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
sandbox=$(mktemp -d)&lt;br /&gt;
apptainer pull $sandbox/ubuntu --sandbox docker://ubuntu:24.04&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Instead of producing a single &amp;lt;code&amp;gt;.sif&amp;lt;/code&amp;gt; file, this creates a directory at &amp;lt;code&amp;gt;$sandbox/ubuntu&amp;lt;/code&amp;gt; that contains the entire container filesystem. You can &amp;lt;code&amp;gt;ls&amp;lt;/code&amp;gt; it to see the familiar Linux directory structure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ls $sandbox/ubuntu&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see directories like &amp;lt;code&amp;gt;bin&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;etc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;usr&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;var&amp;lt;/code&amp;gt;, and so on — just like a normal Linux root filesystem.&lt;br /&gt;
&lt;br /&gt;
== Entering the Sandbox ==&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s open an interactive shell inside the sandbox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer shell --containall --writable --fakeroot $sandbox/ubuntu&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We are using three flags here, each doing something important:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Flag !! What it does&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;--containall&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;-C&amp;lt;/code&amp;gt;) || Fully isolates the container from the host system. Your home directory, host environment variables, and host filesystems are &#039;&#039;&#039;not&#039;&#039;&#039; mounted into the container. This gives you a clean environment.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;--writable&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;-w&amp;lt;/code&amp;gt;) || Allows you to make changes to the container&#039;s filesystem. Without this flag, even a sandbox would be mounted read-only.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;--fakeroot&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;-f&amp;lt;/code&amp;gt;) || Makes it look like you are running as root inside the container. This is needed because package managers like &amp;lt;code&amp;gt;apt&amp;lt;/code&amp;gt; expect root privileges to install software.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Your prompt should change to &amp;lt;code&amp;gt;Apptainer&amp;gt;&amp;lt;/code&amp;gt;, indicating you are now inside the container.&lt;br /&gt;
&lt;br /&gt;
== Installing Software ==&lt;br /&gt;
&lt;br /&gt;
From inside the container, update the package lists and install &amp;lt;code&amp;gt;nano&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;cowsay&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;fortune-mod&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Apptainer&amp;gt; apt-get update&lt;br /&gt;
Apptainer&amp;gt; apt-get install -y nano cowsay fortune-mod&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once the installation finishes, clean up the apt cache to keep the image small:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Apptainer&amp;gt; apt-get clean&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Fixing the PATH ==&lt;br /&gt;
&lt;br /&gt;
In Ubuntu, &amp;lt;code&amp;gt;cowsay&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;fortune&amp;lt;/code&amp;gt; are installed into &amp;lt;code&amp;gt;/usr/games/&amp;lt;/code&amp;gt;, which is &#039;&#039;&#039;not&#039;&#039;&#039; in the default PATH for non-interactive shells. If we were to build a SIF from this sandbox right now, running &amp;lt;code&amp;gt;fortune&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;cowsay&amp;lt;/code&amp;gt; would fail with a &amp;quot;command not found&amp;quot; error.&lt;br /&gt;
&lt;br /&gt;
We need to add &amp;lt;code&amp;gt;/usr/games&amp;lt;/code&amp;gt; to the container&#039;s PATH. Apptainer reads environment settings from files in &amp;lt;code&amp;gt;/.singularity.d/env/&amp;lt;/code&amp;gt;. Run this command inside the container:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Apptainer&amp;gt; echo &#039;export PATH=/usr/games:${PATH}&#039; &amp;gt;&amp;gt; /.singularity.d/env/90-environment.sh&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This appends a line to the environment script that ensures &amp;lt;code&amp;gt;/usr/games&amp;lt;/code&amp;gt; is on the PATH every time the container runs.&lt;br /&gt;
&lt;br /&gt;
== Editing the Runscript ==&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;runscript&#039;&#039;&#039; is the command that gets executed when you use &amp;lt;code&amp;gt;apptainer run&amp;lt;/code&amp;gt; on the container. It lives at &amp;lt;code&amp;gt;/.singularity.d/runscript&amp;lt;/code&amp;gt;. Let&#039;s edit it so that our container does something fun by default.&lt;br /&gt;
&lt;br /&gt;
Open the runscript with nano:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Apptainer&amp;gt; nano /.singularity.d/runscript&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
OCI_ENTRYPOINT=&#039;&#039;&lt;br /&gt;
# ...various lines...&lt;br /&gt;
exec &amp;quot;$@&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add &amp;lt;code&amp;gt;fortune | cowsay&amp;lt;/code&amp;gt; on the line just &#039;&#039;&#039;above&#039;&#039;&#039; the final &amp;lt;code&amp;gt;exec &amp;quot;$@&amp;quot;&amp;lt;/code&amp;gt;, so the end of the file looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
fortune | cowsay&lt;br /&gt;
exec &amp;quot;$@&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save and exit nano (&amp;lt;code&amp;gt;Ctrl+O&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Enter&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Ctrl+X&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Now exit the container:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Apptainer&amp;gt; exit&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Building the Final SIF Image ==&lt;br /&gt;
&lt;br /&gt;
Convert the sandbox back into a portable SIF file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer build fortune.sif $sandbox/ubuntu&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This compresses the entire sandbox directory into a single &amp;lt;code&amp;gt;fortune.sif&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
== Running It ==&lt;br /&gt;
&lt;br /&gt;
Now for the moment of truth:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer run fortune.sif&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see a random fortune displayed inside a speech bubble from a friendly cow. Something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
 ________________________________________&lt;br /&gt;
/ You will be awarded some great honor. \&lt;br /&gt;
\                                        /&lt;br /&gt;
 ----------------------------------------&lt;br /&gt;
        \   ^__^&lt;br /&gt;
         \  (oo)\_______&lt;br /&gt;
            (__)\       )\/\&lt;br /&gt;
                ||----w |&lt;br /&gt;
                ||     ||&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Every time you run it, you get a different fortune. &lt;br /&gt;
&lt;br /&gt;
== Cleaning Up ==&lt;br /&gt;
&lt;br /&gt;
Remove the temporary sandbox directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
rm -rf $sandbox&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Step !! Command&lt;br /&gt;
|-&lt;br /&gt;
| Create temp directory || &amp;lt;code&amp;gt;sandbox=$(mktemp -d)&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Pull as sandbox || &amp;lt;code&amp;gt;apptainer pull $sandbox/ubuntu --sandbox docker://ubuntu:24.04&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Enter sandbox || &amp;lt;code&amp;gt;apptainer shell --containall --writable --fakeroot $sandbox/ubuntu&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Install software || &amp;lt;code&amp;gt;apt-get update &amp;amp;&amp;amp; apt-get install -y nano cowsay fortune-mod &amp;amp;&amp;amp; apt-get clean&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Fix PATH || &amp;lt;code&amp;gt;echo &#039;export PATH=/usr/games:${PATH}&#039; &amp;gt;&amp;gt; /.singularity.d/env/90-environment.sh&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Edit runscript || &amp;lt;code&amp;gt;nano /.singularity.d/runscript&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Exit container || &amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Build SIF from sandbox || &amp;lt;code&amp;gt;apptainer build fortune.sif $sandbox/ubuntu&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Run it || &amp;lt;code&amp;gt;apptainer run fortune.sif&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Clean up || &amp;lt;code&amp;gt;rm -rf $sandbox&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Tutorials/Apptainer-FakerootAndOverlays&amp;diff=2682</id>
		<title>Tutorials/Apptainer-FakerootAndOverlays</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Tutorials/Apptainer-FakerootAndOverlays&amp;diff=2682"/>
		<updated>2026-03-12T10:00:23Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: /* What is --fakeroot? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Apptainer Overlays: Modifying Container Images =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Important:&#039;&#039;&#039; Before you begin, make sure the following are in place:&lt;br /&gt;
&lt;br /&gt;
* You are running on a &#039;&#039;&#039;compute node&#039;&#039;&#039;, not a login node. Request an interactive session first (e.g. via &amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt; or your scheduler).&lt;br /&gt;
* Your &amp;lt;code&amp;gt;.sif&amp;lt;/code&amp;gt; image files should be stored on &#039;&#039;&#039;Lustre&#039;&#039;&#039; (e.g. in your scratch space), not in your home directory. SIF files can be large and will eat through your home quota fast.&lt;br /&gt;
* Set your Apptainer cache to Lustre as well. Add this to your session (or your &amp;lt;code&amp;gt;.bashrc&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
export APPTAINER_CACHEDIR=$myScratch/apptainer_cache&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
&lt;br /&gt;
Load the required modules:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
module reset&lt;br /&gt;
module load utilities Apptainer&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Pulling the Base Image ==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s pull an Ubuntu 24.04 image from Docker Hub:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer pull ./ubuntu_24.04.sif docker://ubuntu:24.04&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will download and convert the image into a SIF file in your current directory.&lt;br /&gt;
&lt;br /&gt;
== The Problem: SIF Images Are Read-Only ==&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s try to update the package list inside the container:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer exec ubuntu_24.04.sif apt update&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will fail. You will see errors about not being able to write to package lists and lock files. This is because SIF files are &#039;&#039;&#039;read-only&#039;&#039;&#039; by design — you cannot modify them directly.&lt;br /&gt;
&lt;br /&gt;
So how do we install software into a container? This is where &#039;&#039;&#039;overlays&#039;&#039;&#039; and &#039;&#039;&#039;fakeroot&#039;&#039;&#039; come in.&lt;br /&gt;
&lt;br /&gt;
== What is fakeroot? ==&lt;br /&gt;
&lt;br /&gt;
On an HPC system you do not have root (administrator) privileges. But many operations inside a container — like installing packages with &amp;lt;code&amp;gt;apt&amp;lt;/code&amp;gt; — expect to be run as root.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;--fakeroot&amp;lt;/code&amp;gt; flag (or &amp;lt;code&amp;gt;-f&amp;lt;/code&amp;gt;) tells Apptainer to make it &#039;&#039;look like&#039;&#039; you are running as root inside the container, even though you are not actually root on the host system. This is enough to trick package managers like &amp;lt;code&amp;gt;apt&amp;lt;/code&amp;gt; into working.&lt;br /&gt;
&lt;br /&gt;
== What is an Overlay? ==&lt;br /&gt;
&lt;br /&gt;
An overlay is a writable layer that sits on top of a read-only SIF image. Think of it like putting a sheet of tracing paper over a printed page — you can write on the tracing paper without changing the original page underneath.&lt;br /&gt;
&lt;br /&gt;
Any changes you make (installed packages, new files, config changes) are stored in the overlay, leaving the original SIF image untouched.&lt;br /&gt;
&lt;br /&gt;
== Creating and Using an Overlay ==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s create a temporary directory to use as our overlay:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ov=$(mktemp -d)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This creates a temporary directory somewhere under &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; and stores the path in the variable &amp;lt;code&amp;gt;$ov&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s try that &amp;lt;code&amp;gt;apt update&amp;lt;/code&amp;gt; again, this time with &amp;lt;code&amp;gt;--fakeroot&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--overlay&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer exec --fakeroot --overlay $ov ubuntu_24.04.sif apt update&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This time it should work. Apptainer is running you as fake root, and any writes are going into the overlay directory instead of trying to modify the read-only SIF.&lt;br /&gt;
&lt;br /&gt;
== Installing Software via the Overlay ==&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s install &amp;lt;code&amp;gt;neofetch&amp;lt;/code&amp;gt; (a tool that displays system information) into the container through the overlay:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer exec --fakeroot --overlay $ov ubuntu_24.04.sif apt install -y neofetch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-y&amp;lt;/code&amp;gt; flag tells &amp;lt;code&amp;gt;apt&amp;lt;/code&amp;gt; to answer &amp;quot;yes&amp;quot; to all prompts automatically.&lt;br /&gt;
&lt;br /&gt;
Once this completes, neofetch is installed — but only in the overlay. The original &amp;lt;code&amp;gt;ubuntu_24.04.sif&amp;lt;/code&amp;gt; is still untouched.&lt;br /&gt;
&lt;br /&gt;
== Building a New Image from the Original + Overlay ==&lt;br /&gt;
&lt;br /&gt;
Right now your changes only exist in that temporary overlay directory. If you were to delete it or reboot, those changes would be gone. To make your modifications permanent, you can build a new SIF image that bakes in the overlay changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer build --fakeroot ubuntu_neofetch.sif --overlay $ov ubuntu_24.04.sif&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This takes the original &amp;lt;code&amp;gt;ubuntu_24.04.sif&amp;lt;/code&amp;gt;, applies everything in the overlay on top of it, and produces a brand new file: &amp;lt;code&amp;gt;ubuntu_neofetch.sif&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Testing the New Image ==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s verify that neofetch is available in our new image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer exec ubuntu_neofetch.sif neofetch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see the familiar Ubuntu logo and system information output. Neofetch is now permanently part of this new image — no overlay or fakeroot needed to run it.&lt;br /&gt;
&lt;br /&gt;
== Cleaning Up ==&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to remove the temporary overlay directory when you&#039;re done:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
rm -rf $ov&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Step !! Command&lt;br /&gt;
|-&lt;br /&gt;
| Pull base image || &amp;lt;code&amp;gt;apptainer pull ./ubuntu_24.04.sif docker://ubuntu:24.04&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Create overlay directory || &amp;lt;code&amp;gt;ov=$(mktemp -d)&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Update packages (with overlay + fakeroot) || &amp;lt;code&amp;gt;apptainer exec --fakeroot --overlay $ov ubuntu_24.04.sif apt update&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Install software || &amp;lt;code&amp;gt;apptainer exec --fakeroot --overlay $ov ubuntu_24.04.sif apt install -y neofetch&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Build new image from original + overlay || &amp;lt;code&amp;gt;apptainer build --fakeroot ubuntu_neofetch.sif --overlay $ov ubuntu_24.04.sif&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Test the new image || &amp;lt;code&amp;gt;apptainer exec ubuntu_neofetch.sif neofetch&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Clean up overlay || &amp;lt;code&amp;gt;rm -rf $ov&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Tutorials/Apptainer-FakerootAndOverlays&amp;diff=2681</id>
		<title>Tutorials/Apptainer-FakerootAndOverlays</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Tutorials/Apptainer-FakerootAndOverlays&amp;diff=2681"/>
		<updated>2026-03-12T09:59:42Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: Created page with &amp;quot;= Apptainer Overlays: Modifying Container Images =  &amp;#039;&amp;#039;&amp;#039;Important:&amp;#039;&amp;#039;&amp;#039; Before you begin, make sure the following are in place:  * You are running on a &amp;#039;&amp;#039;&amp;#039;compute node&amp;#039;&amp;#039;&amp;#039;, not a login node. Request an interactive session first (e.g. via &amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt; or your scheduler). * Your &amp;lt;code&amp;gt;.sif&amp;lt;/code&amp;gt; image files should be stored on &amp;#039;&amp;#039;&amp;#039;Lustre&amp;#039;&amp;#039;&amp;#039; (e.g. in your scratch space), not in your home directory. SIF files can be large and will eat through your home quota fast. * Set you...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Apptainer Overlays: Modifying Container Images =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Important:&#039;&#039;&#039; Before you begin, make sure the following are in place:&lt;br /&gt;
&lt;br /&gt;
* You are running on a &#039;&#039;&#039;compute node&#039;&#039;&#039;, not a login node. Request an interactive session first (e.g. via &amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt; or your scheduler).&lt;br /&gt;
* Your &amp;lt;code&amp;gt;.sif&amp;lt;/code&amp;gt; image files should be stored on &#039;&#039;&#039;Lustre&#039;&#039;&#039; (e.g. in your scratch space), not in your home directory. SIF files can be large and will eat through your home quota fast.&lt;br /&gt;
* Set your Apptainer cache to Lustre as well. Add this to your session (or your &amp;lt;code&amp;gt;.bashrc&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
export APPTAINER_CACHEDIR=$myScratch/apptainer_cache&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
&lt;br /&gt;
Load the required modules:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
module reset&lt;br /&gt;
module load utilities Apptainer&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Pulling the Base Image ==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s pull an Ubuntu 24.04 image from Docker Hub:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer pull ./ubuntu_24.04.sif docker://ubuntu:24.04&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will download and convert the image into a SIF file in your current directory.&lt;br /&gt;
&lt;br /&gt;
== The Problem: SIF Images Are Read-Only ==&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s try to update the package list inside the container:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer exec ubuntu_24.04.sif apt update&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will fail. You will see errors about not being able to write to package lists and lock files. This is because SIF files are &#039;&#039;&#039;read-only&#039;&#039;&#039; by design — you cannot modify them directly.&lt;br /&gt;
&lt;br /&gt;
So how do we install software into a container? This is where &#039;&#039;&#039;overlays&#039;&#039;&#039; and &#039;&#039;&#039;fakeroot&#039;&#039;&#039; come in.&lt;br /&gt;
&lt;br /&gt;
== What is &amp;lt;code&amp;gt;--fakeroot&amp;lt;/code&amp;gt;? ==&lt;br /&gt;
&lt;br /&gt;
On an HPC system you do not have root (administrator) privileges. But many operations inside a container — like installing packages with &amp;lt;code&amp;gt;apt&amp;lt;/code&amp;gt; — expect to be run as root.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;--fakeroot&amp;lt;/code&amp;gt; flag (or &amp;lt;code&amp;gt;-f&amp;lt;/code&amp;gt;) tells Apptainer to make it &#039;&#039;look like&#039;&#039; you are running as root inside the container, even though you are not actually root on the host system. This is enough to trick package managers like &amp;lt;code&amp;gt;apt&amp;lt;/code&amp;gt; into working.&lt;br /&gt;
&lt;br /&gt;
== What is an Overlay? ==&lt;br /&gt;
&lt;br /&gt;
An overlay is a writable layer that sits on top of a read-only SIF image. Think of it like putting a sheet of tracing paper over a printed page — you can write on the tracing paper without changing the original page underneath.&lt;br /&gt;
&lt;br /&gt;
Any changes you make (installed packages, new files, config changes) are stored in the overlay, leaving the original SIF image untouched.&lt;br /&gt;
&lt;br /&gt;
== Creating and Using an Overlay ==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s create a temporary directory to use as our overlay:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ov=$(mktemp -d)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This creates a temporary directory somewhere under &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; and stores the path in the variable &amp;lt;code&amp;gt;$ov&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s try that &amp;lt;code&amp;gt;apt update&amp;lt;/code&amp;gt; again, this time with &amp;lt;code&amp;gt;--fakeroot&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--overlay&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer exec --fakeroot --overlay $ov ubuntu_24.04.sif apt update&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This time it should work. Apptainer is running you as fake root, and any writes are going into the overlay directory instead of trying to modify the read-only SIF.&lt;br /&gt;
&lt;br /&gt;
== Installing Software via the Overlay ==&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s install &amp;lt;code&amp;gt;neofetch&amp;lt;/code&amp;gt; (a tool that displays system information) into the container through the overlay:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer exec --fakeroot --overlay $ov ubuntu_24.04.sif apt install -y neofetch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-y&amp;lt;/code&amp;gt; flag tells &amp;lt;code&amp;gt;apt&amp;lt;/code&amp;gt; to answer &amp;quot;yes&amp;quot; to all prompts automatically.&lt;br /&gt;
&lt;br /&gt;
Once this completes, neofetch is installed — but only in the overlay. The original &amp;lt;code&amp;gt;ubuntu_24.04.sif&amp;lt;/code&amp;gt; is still untouched.&lt;br /&gt;
&lt;br /&gt;
== Building a New Image from the Original + Overlay ==&lt;br /&gt;
&lt;br /&gt;
Right now your changes only exist in that temporary overlay directory. If you were to delete it or reboot, those changes would be gone. To make your modifications permanent, you can build a new SIF image that bakes in the overlay changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer build --fakeroot ubuntu_neofetch.sif --overlay $ov ubuntu_24.04.sif&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This takes the original &amp;lt;code&amp;gt;ubuntu_24.04.sif&amp;lt;/code&amp;gt;, applies everything in the overlay on top of it, and produces a brand new file: &amp;lt;code&amp;gt;ubuntu_neofetch.sif&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Testing the New Image ==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s verify that neofetch is available in our new image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer exec ubuntu_neofetch.sif neofetch&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see the familiar Ubuntu logo and system information output. Neofetch is now permanently part of this new image — no overlay or fakeroot needed to run it.&lt;br /&gt;
&lt;br /&gt;
== Cleaning Up ==&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to remove the temporary overlay directory when you&#039;re done:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
rm -rf $ov&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Step !! Command&lt;br /&gt;
|-&lt;br /&gt;
| Pull base image || &amp;lt;code&amp;gt;apptainer pull ./ubuntu_24.04.sif docker://ubuntu:24.04&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Create overlay directory || &amp;lt;code&amp;gt;ov=$(mktemp -d)&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Update packages (with overlay + fakeroot) || &amp;lt;code&amp;gt;apptainer exec --fakeroot --overlay $ov ubuntu_24.04.sif apt update&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Install software || &amp;lt;code&amp;gt;apptainer exec --fakeroot --overlay $ov ubuntu_24.04.sif apt install -y neofetch&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Build new image from original + overlay || &amp;lt;code&amp;gt;apptainer build --fakeroot ubuntu_neofetch.sif --overlay $ov ubuntu_24.04.sif&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Test the new image || &amp;lt;code&amp;gt;apptainer exec ubuntu_neofetch.sif neofetch&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Clean up overlay || &amp;lt;code&amp;gt;rm -rf $ov&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Tutorials&amp;diff=2680</id>
		<title>Tutorials</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Tutorials&amp;diff=2680"/>
		<updated>2026-03-12T09:58:49Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Tutorials ==&lt;br /&gt;
&lt;br /&gt;
=== Modules ===&lt;br /&gt;
[[Create Your Own Modules]]&lt;br /&gt;
&lt;br /&gt;
=== Apptainer ===&lt;br /&gt;
&lt;br /&gt;
* [[Tutorials/Apptainer-PullingImages|Pulling Images]]&lt;br /&gt;
* Fakeroot and overlays&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Tutorials&amp;diff=2679</id>
		<title>Tutorials</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Tutorials&amp;diff=2679"/>
		<updated>2026-03-12T09:14:20Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: /* Apptainer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Tutorials ==&lt;br /&gt;
&lt;br /&gt;
=== Modules ===&lt;br /&gt;
[[Create Your Own Modules]]&lt;br /&gt;
&lt;br /&gt;
=== Apptainer ===&lt;br /&gt;
&lt;br /&gt;
* [[Tutorials/Apptainer-PullingImages|Pulling Images]]&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Tutorials&amp;diff=2678</id>
		<title>Tutorials</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Tutorials&amp;diff=2678"/>
		<updated>2026-03-12T09:13:07Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: /* Apptainer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Tutorials ==&lt;br /&gt;
&lt;br /&gt;
=== Modules ===&lt;br /&gt;
[[Create Your Own Modules]]&lt;br /&gt;
&lt;br /&gt;
=== Apptainer ===&lt;br /&gt;
&lt;br /&gt;
* [[Apptainer-PullingImages|Pulling Images]]&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Tutorials/Apptainer-PullingImages&amp;diff=2677</id>
		<title>Tutorials/Apptainer-PullingImages</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Tutorials/Apptainer-PullingImages&amp;diff=2677"/>
		<updated>2026-03-12T09:11:44Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Pulling Apptainer Images =&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
&lt;br /&gt;
First, grab an interactive session in a  compute node.&lt;br /&gt;
&lt;br /&gt;
Then make sure your module environment is clean and Apptainer is loaded:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
module reset&lt;br /&gt;
module load utilities Apptainer&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Also, please make sure to store image and in your lustre folders. &lt;br /&gt;
&lt;br /&gt;
== Your First Pull ==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s start by pulling a simple &amp;quot;hello world&amp;quot; container image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer pull ./hello-world.sif shub://vsoch/hello-world&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That is a lot happening in one line, so let&#039;s break it down piece by piece:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Part !! What it means&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;apptainer pull&amp;lt;/code&amp;gt; || The Apptainer command to download a container image.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;./hello-world.sif&amp;lt;/code&amp;gt; || The output filename. This is where Apptainer will save the downloaded image. The &amp;lt;code&amp;gt;.sif&amp;lt;/code&amp;gt; extension stands for &#039;&#039;&#039;Singularity Image Format&#039;&#039;&#039; — Apptainer&#039;s own container format. The &amp;lt;code&amp;gt;./&amp;lt;/code&amp;gt; means &amp;quot;save it in my current directory&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;shub://vsoch/hello-world&amp;lt;/code&amp;gt; || The source to pull from. &amp;lt;code&amp;gt;shub://&amp;lt;/code&amp;gt; tells Apptainer to look at [https://singularity-hub.org Singularity Hub], a public registry for container images. &amp;lt;code&amp;gt;vsoch/hello-world&amp;lt;/code&amp;gt; is the user and image name, much like a path on GitHub.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Once the command finishes, you will have a file called &amp;lt;code&amp;gt;hello-world.sif&amp;lt;/code&amp;gt; in your current directory. You can verify this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ls -lh hello-world.sif&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This &amp;lt;code&amp;gt;.sif&amp;lt;/code&amp;gt; file is your container — a single, portable file that contains an entire operating system and software environment. You can copy it, move it, or share it just like any other file.&lt;br /&gt;
&lt;br /&gt;
== Running the Container ==&lt;br /&gt;
&lt;br /&gt;
The simplest way to use a container is with &amp;lt;code&amp;gt;apptainer run&amp;lt;/code&amp;gt;. This executes whatever default action the container was built to perform:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer run ./hello-world.sif&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see a friendly output from the container. That is it — you just ran software inside a container.&lt;br /&gt;
&lt;br /&gt;
== Opening a Shell Inside the Container ==&lt;br /&gt;
&lt;br /&gt;
Instead of running the container&#039;s default action, you can open an interactive shell inside it. This lets you look around and explore the container&#039;s environment as if you had logged into a different machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer shell ./hello-world.sif&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice your prompt changes (usually to &amp;lt;code&amp;gt;Apptainer&amp;gt;&amp;lt;/code&amp;gt;), indicating that you are now &amp;quot;inside&amp;quot; the container. Type &amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt; when you want to leave.&lt;br /&gt;
&lt;br /&gt;
=== The Container is Not Fully Isolated (by Default) ===&lt;br /&gt;
&lt;br /&gt;
Here is something important that surprises many beginners: by default, Apptainer does &#039;&#039;&#039;not&#039;&#039;&#039; fully isolate the container from the host system. Your home directory and parts of the host filesystem are still visible inside the container.&lt;br /&gt;
&lt;br /&gt;
Try this while inside the shell:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer shell ./hello-world.sif&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, from inside the container:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Apptainer&amp;gt; mkdir ~/test-from-container&lt;br /&gt;
Apptainer&amp;gt; ls ~/test-from-container&lt;br /&gt;
Apptainer&amp;gt; exit&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, back on the host:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ls ~/test-from-container&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The directory is there — on your &#039;&#039;&#039;real&#039;&#039;&#039; filesystem. The container was able to create it because your home directory was mounted inside the container by default. This is by design: it makes it easy to work with your own files, but it means the container is not completely separate from the host.&lt;br /&gt;
&lt;br /&gt;
=== Full Isolation with &amp;lt;code&amp;gt;--containall&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
If you want the container to be fully isolated from the host system — no access to your home directory, no shared environment variables, no host filesystems — use the &amp;lt;code&amp;gt;--containall&amp;lt;/code&amp;gt; flag (or its short form &amp;lt;code&amp;gt;-C&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer shell --containall ./hello-world.sif&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now try the same thing from inside:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Apptainer&amp;gt; mkdir ~/test-isolated&lt;br /&gt;
Apptainer&amp;gt; exit&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Back on the host:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ls ~/test-isolated&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This time, the directory does &#039;&#039;&#039;not&#039;&#039;&#039; exist on your host. The container was completely isolated — anything it created lived only inside the container&#039;s temporary environment and was discarded when you exited.&lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;--containall&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;-C&amp;lt;/code&amp;gt;) when you want a clean, reproducible environment that does not interfere with (or depend on) the host system.&lt;br /&gt;
&lt;br /&gt;
== Running a Specific Command with &amp;lt;code&amp;gt;exec&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Sometimes you do not want a full interactive shell — you just want to run a single command inside the container and get the output. That is what &amp;lt;code&amp;gt;apptainer exec&amp;lt;/code&amp;gt; is for.&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s check which operating system is inside this container:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer exec ./hello-world.sif cat /etc/lsb-release&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see output similar to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
DISTRIB_ID=Ubuntu&lt;br /&gt;
DISTRIB_RELEASE=14.04&lt;br /&gt;
DISTRIB_CODENAME=trusty&lt;br /&gt;
DISTRIB_DESCRIPTION=&amp;quot;Ubuntu 14.04.6 LTS&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The container is running &#039;&#039;&#039;Ubuntu 14.04&#039;&#039;&#039; — regardless of what operating system your host machine is running. This is the power of containers: you can run software built for a completely different OS environment without any conflicts.&lt;br /&gt;
&lt;br /&gt;
The pattern for &amp;lt;code&amp;gt;exec&amp;lt;/code&amp;gt; is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;apptainer exec &#039;&#039;[options]&#039;&#039; &#039;&#039;container.sif&#039;&#039; &#039;&#039;command&#039;&#039; &#039;&#039;[arguments]&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
You now know the three main ways to interact with a pulled Apptainer container:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;apptainer run container.sif&amp;lt;/code&amp;gt; || Runs the container&#039;s default action&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;apptainer shell container.sif&amp;lt;/code&amp;gt; || Opens an interactive shell inside the container&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;apptainer exec container.sif &#039;&#039;command&#039;&#039;&amp;lt;/code&amp;gt; || Runs a single specific command inside the container&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
And one important flag to remember:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Flag !! What it does&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;--containall&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;-C&amp;lt;/code&amp;gt;) || Fully isolates the container from the host (no shared home directory, no host environment)&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Tutorials/Apptainer-PullingImages&amp;diff=2676</id>
		<title>Tutorials/Apptainer-PullingImages</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Tutorials/Apptainer-PullingImages&amp;diff=2676"/>
		<updated>2026-03-12T09:09:41Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: Add message about storing image in lustre&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Pulling Apptainer Images =&lt;br /&gt;
&lt;br /&gt;
== Getting Started ==&lt;br /&gt;
&lt;br /&gt;
First, make sure your module environment is clean and Apptainer is loaded:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
module reset&lt;br /&gt;
module load utilities Apptainer&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;Also, please make sure to store image and in your lustre folders. &lt;br /&gt;
&lt;br /&gt;
== Your First Pull ==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s start by pulling a simple &amp;quot;hello world&amp;quot; container image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer pull ./hello-world.sif shub://vsoch/hello-world&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That is a lot happening in one line, so let&#039;s break it down piece by piece:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Part !! What it means&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;apptainer pull&amp;lt;/code&amp;gt; || The Apptainer command to download a container image.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;./hello-world.sif&amp;lt;/code&amp;gt; || The output filename. This is where Apptainer will save the downloaded image. The &amp;lt;code&amp;gt;.sif&amp;lt;/code&amp;gt; extension stands for &#039;&#039;&#039;Singularity Image Format&#039;&#039;&#039; — Apptainer&#039;s own container format. The &amp;lt;code&amp;gt;./&amp;lt;/code&amp;gt; means &amp;quot;save it in my current directory&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;shub://vsoch/hello-world&amp;lt;/code&amp;gt; || The source to pull from. &amp;lt;code&amp;gt;shub://&amp;lt;/code&amp;gt; tells Apptainer to look at [https://singularity-hub.org Singularity Hub], a public registry for container images. &amp;lt;code&amp;gt;vsoch/hello-world&amp;lt;/code&amp;gt; is the user and image name, much like a path on GitHub.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Once the command finishes, you will have a file called &amp;lt;code&amp;gt;hello-world.sif&amp;lt;/code&amp;gt; in your current directory. You can verify this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ls -lh hello-world.sif&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This &amp;lt;code&amp;gt;.sif&amp;lt;/code&amp;gt; file is your container — a single, portable file that contains an entire operating system and software environment. You can copy it, move it, or share it just like any other file.&lt;br /&gt;
&lt;br /&gt;
== Running the Container ==&lt;br /&gt;
&lt;br /&gt;
The simplest way to use a container is with &amp;lt;code&amp;gt;apptainer run&amp;lt;/code&amp;gt;. This executes whatever default action the container was built to perform:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer run ./hello-world.sif&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see a friendly output from the container. That is it — you just ran software inside a container.&lt;br /&gt;
&lt;br /&gt;
== Opening a Shell Inside the Container ==&lt;br /&gt;
&lt;br /&gt;
Instead of running the container&#039;s default action, you can open an interactive shell inside it. This lets you look around and explore the container&#039;s environment as if you had logged into a different machine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer shell ./hello-world.sif&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will notice your prompt changes (usually to &amp;lt;code&amp;gt;Apptainer&amp;gt;&amp;lt;/code&amp;gt;), indicating that you are now &amp;quot;inside&amp;quot; the container. Type &amp;lt;code&amp;gt;exit&amp;lt;/code&amp;gt; when you want to leave.&lt;br /&gt;
&lt;br /&gt;
=== The Container is Not Fully Isolated (by Default) ===&lt;br /&gt;
&lt;br /&gt;
Here is something important that surprises many beginners: by default, Apptainer does &#039;&#039;&#039;not&#039;&#039;&#039; fully isolate the container from the host system. Your home directory and parts of the host filesystem are still visible inside the container.&lt;br /&gt;
&lt;br /&gt;
Try this while inside the shell:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer shell ./hello-world.sif&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, from inside the container:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Apptainer&amp;gt; mkdir ~/test-from-container&lt;br /&gt;
Apptainer&amp;gt; ls ~/test-from-container&lt;br /&gt;
Apptainer&amp;gt; exit&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, back on the host:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ls ~/test-from-container&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The directory is there — on your &#039;&#039;&#039;real&#039;&#039;&#039; filesystem. The container was able to create it because your home directory was mounted inside the container by default. This is by design: it makes it easy to work with your own files, but it means the container is not completely separate from the host.&lt;br /&gt;
&lt;br /&gt;
=== Full Isolation with &amp;lt;code&amp;gt;--containall&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
If you want the container to be fully isolated from the host system — no access to your home directory, no shared environment variables, no host filesystems — use the &amp;lt;code&amp;gt;--containall&amp;lt;/code&amp;gt; flag (or its short form &amp;lt;code&amp;gt;-C&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer shell --containall ./hello-world.sif&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now try the same thing from inside:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Apptainer&amp;gt; mkdir ~/test-isolated&lt;br /&gt;
Apptainer&amp;gt; exit&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Back on the host:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ls ~/test-isolated&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This time, the directory does &#039;&#039;&#039;not&#039;&#039;&#039; exist on your host. The container was completely isolated — anything it created lived only inside the container&#039;s temporary environment and was discarded when you exited.&lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;--containall&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;-C&amp;lt;/code&amp;gt;) when you want a clean, reproducible environment that does not interfere with (or depend on) the host system.&lt;br /&gt;
&lt;br /&gt;
== Running a Specific Command with &amp;lt;code&amp;gt;exec&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Sometimes you do not want a full interactive shell — you just want to run a single command inside the container and get the output. That is what &amp;lt;code&amp;gt;apptainer exec&amp;lt;/code&amp;gt; is for.&lt;br /&gt;
&lt;br /&gt;
For example, let&#039;s check which operating system is inside this container:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
apptainer exec ./hello-world.sif cat /etc/lsb-release&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should see output similar to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
DISTRIB_ID=Ubuntu&lt;br /&gt;
DISTRIB_RELEASE=14.04&lt;br /&gt;
DISTRIB_CODENAME=trusty&lt;br /&gt;
DISTRIB_DESCRIPTION=&amp;quot;Ubuntu 14.04.6 LTS&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The container is running &#039;&#039;&#039;Ubuntu 14.04&#039;&#039;&#039; — regardless of what operating system your host machine is running. This is the power of containers: you can run software built for a completely different OS environment without any conflicts.&lt;br /&gt;
&lt;br /&gt;
The pattern for &amp;lt;code&amp;gt;exec&amp;lt;/code&amp;gt; is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;apptainer exec &#039;&#039;[options]&#039;&#039; &#039;&#039;container.sif&#039;&#039; &#039;&#039;command&#039;&#039; &#039;&#039;[arguments]&#039;&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Summary ==&lt;br /&gt;
&lt;br /&gt;
You now know the three main ways to interact with a pulled Apptainer container:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command !! What it does&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;apptainer run container.sif&amp;lt;/code&amp;gt; || Runs the container&#039;s default action&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;apptainer shell container.sif&amp;lt;/code&amp;gt; || Opens an interactive shell inside the container&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;apptainer exec container.sif &#039;&#039;command&#039;&#039;&amp;lt;/code&amp;gt; || Runs a single specific command inside the container&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
And one important flag to remember:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Flag !! What it does&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;--containall&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;-C&amp;lt;/code&amp;gt;) || Fully isolates the container from the host (no shared home directory, no host environment)&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Main_Page/Tutorials/Apptainer&amp;diff=2675</id>
		<title>Main Page/Tutorials/Apptainer</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Main_Page/Tutorials/Apptainer&amp;diff=2675"/>
		<updated>2026-03-11T13:55:51Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: Created page with &amp;quot;This page contains a list of tutorials related to the usage of apptainer in Anunna.&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains a list of tutorials related to the usage of apptainer in Anunna.&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Main_Page/Tutorials&amp;diff=2674</id>
		<title>Main Page/Tutorials</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Main_Page/Tutorials&amp;diff=2674"/>
		<updated>2026-03-11T13:55:02Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: Created page with &amp;quot; =Tutorials=   This page contains an index of various tutorials specific to the Anunna supercomputer.&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
=Tutorials= &lt;br /&gt;
&lt;br /&gt;
This page contains an index of various tutorials specific to the Anunna supercomputer.&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Apptainer&amp;diff=2673</id>
		<title>Apptainer</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Apptainer&amp;diff=2673"/>
		<updated>2026-03-11T13:46:58Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Apptainer is a container platform. It allows you to create and run containers that package up pieces of software in a way that is portable and reproducible. You can build a container using Apptainer on your laptop, and then run it on many of the largest HPC clusters in the world, local university or company clusters, a single server, in the cloud, or on a workstation down the hall. Your container is a single file, and you don’t have to worry about how to install all the software you need on each different operating system.&lt;br /&gt;
&lt;br /&gt;
Apptainer is a fork of singularity and, thus, also supports singularity commands and workflows.&lt;br /&gt;
&lt;br /&gt;
==Apptainer on Anunna==&lt;br /&gt;
&lt;br /&gt;
Since Apptainer is not dependent on specific compilers and toolchains, it is now place inside the &#039;&#039;&#039;utilities&#039;&#039;&#039; bucket.  Inside this bucket, there are two options:&lt;br /&gt;
&lt;br /&gt;
* Apptainer&lt;br /&gt;
* Apptainer-compat&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The regular &#039;&#039;&#039;Apptainer&#039;&#039;&#039; module loads the version compiled in Anunna. This is more suitable to containers built with more recent operating systems. For most projects this will be enough. &lt;br /&gt;
&lt;br /&gt;
However, some projects still use some very old Linux versions and through errors related to missing versions of GLIBC when running in Anunna. That is where &#039;&#039;&#039;Apptainer-compat&#039;&#039;&#039; comes in, this is a package distributed by the Fedora Project EPEL (Extra Packages for Enterprise Linux) repositories. This package is built with a broad range of versions of GLIBC in mind, so will likely work with older images like ubuntu 22.04 or older. &lt;br /&gt;
&lt;br /&gt;
One can load apptainer by running the following commands&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;module load utilities&lt;br /&gt;
module load Apptainer&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Initial Setup ====&lt;br /&gt;
Apptainer will cache SIF container images generated from remote sources, and any OCI/docker layers used to create them. The cache is created at &amp;lt;code&amp;gt;$HOME/.apptainer/cache&amp;lt;/code&amp;gt; by default. The location of the cache can be changed by setting the &amp;lt;code&amp;gt;APPTAINER_CACHEDIR&amp;lt;/code&amp;gt; environment variable.&lt;br /&gt;
&lt;br /&gt;
Since there is a limited amount of space available at &amp;lt;code&amp;gt;$HOME&amp;lt;/code&amp;gt;, the Apptainer cache can quickly fill your quota. So it is recommended that you set the variable &amp;lt;code&amp;gt;APPTAINER_CACHEDIR&amp;lt;/code&amp;gt; to a location ion lustre by edition your &amp;lt;code&amp;gt;$HOME/.bash_aliases&amp;lt;/code&amp;gt; file. An example is provided at [[Aliases and local variables]]&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Jupyter&amp;diff=2642</id>
		<title>Jupyter</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Jupyter&amp;diff=2642"/>
		<updated>2026-02-25T18:10:23Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: New jupyter page in OOD&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;JupyterLab is the latest web-based interactive development environment for notebooks, code, and data. Its flexible interface allows users to configure and arrange workflows in data science, scientific computing, computational journalism, and machine learning. A modular design invites extensions to expand and enrich functionality.&lt;br /&gt;
&lt;br /&gt;
Traditionally, jupyter has been offered at Anunna via [https://notebook.anunna.wur.nl notebook.anunna.wur.nl], though OOD makes it possible to deploy Jupyter based off the environment modules from Anunna. Adding greater stability and flexibility. Jupyter is listed in the featured apps speed-dial and upon clicking on it, the user is presented with a form where they can select their preferences and allocate resources for their session&lt;br /&gt;
[[File:Jupyter-form-20260225.png|thumb|695x695px|Resource Allocation form for Jupyter Session]]&lt;br /&gt;
&lt;br /&gt;
=== Resource Allocation Form ===&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Python version:&#039;&#039;&#039; version of python the default kernel will be running&lt;br /&gt;
* &#039;&#039;&#039;Session Type:&#039;&#039;&#039; traditional notebooks interface or the newer lab interface. It is also possible to change the interface from within the active Jupyter session.&lt;br /&gt;
* &#039;&#039;&#039;Hours:&#039;&#039;&#039; Number of hours allocated to the session, max 4 hours&lt;br /&gt;
* &#039;&#039;&#039;Number of CPUs:&#039;&#039;&#039; Number of CPU cores allocated for the session &lt;br /&gt;
* &#039;&#039;&#039;Amount of Memory:&#039;&#039;&#039; RAM allocated for the session&lt;br /&gt;
* &#039;&#039;&#039;Number of GPUs:&#039;&#039;&#039; 0 denotes no GPU is used, a non-zero number will switch the partition from main to the gpu partition&lt;br /&gt;
* &#039;&#039;&#039;Comment:&#039;&#039;&#039;  label or project number that will show up in billing.&lt;br /&gt;
* &#039;&#039;&#039;Slurm Options:&#039;&#039;&#039; slurm flags that may override settings above&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Connecting to an active session ====&lt;br /&gt;
After the resources and preferences have been defined, the user can simply click on the launch button. Which will submit a job at Anunna and take them to the My Interactive Sessions page where they can connect to their session. &lt;br /&gt;
&lt;br /&gt;
Once the session is ready a &amp;quot;Connect to Jupyter &amp;quot; button will appear which will allow the user to (re)connect to the corresponding active session.&lt;br /&gt;
&lt;br /&gt;
The card also has a red &amp;quot;Cancel&amp;quot; button where the user may terminate their session.&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=File:Jupyter-form-20260225.png&amp;diff=2641</id>
		<title>File:Jupyter-form-20260225.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=File:Jupyter-form-20260225.png&amp;diff=2641"/>
		<updated>2026-02-25T18:01:19Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OOD jupyter form&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Shell_Access&amp;diff=2640</id>
		<title>Shell Access</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Shell_Access&amp;diff=2640"/>
		<updated>2026-02-25T14:25:35Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Anunna Shell Access is a web based bash shell terminal emulator available at the Anunna apps portal. &lt;br /&gt;
&lt;br /&gt;
This application provides quick access to a bash session in one of the login nodes. &lt;br /&gt;
&lt;br /&gt;
User&#039;s are able to select a theme for their terminal session on the top right corner of the screen. &lt;br /&gt;
&lt;br /&gt;
When a session times out, just refresh your browser tab and it should reconnect. &lt;br /&gt;
&lt;br /&gt;
Since this runs in a browser, users should mind that some bash keyboard shortcuts may not work properly, e.g. ctrl + w&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Shell_Access&amp;diff=2639</id>
		<title>Shell Access</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Shell_Access&amp;diff=2639"/>
		<updated>2026-02-25T14:23:56Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: Created page with &amp;quot;Anunna Shell Access is a web based bash shell terminal emulator available at the Anunna apps portal.   This application provides quick access to a bash session in one of the login nodes.   User&amp;#039;s are able to select a theme for their terminal session on the top right corner of the screen.   When a session times out, just refresh your browser tab and it should reconnect.   Since this runs in a browser, users should mind that some keyboard shortcuts may not work properly, e...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Anunna Shell Access is a web based bash shell terminal emulator available at the Anunna apps portal. &lt;br /&gt;
&lt;br /&gt;
This application provides quick access to a bash session in one of the login nodes. &lt;br /&gt;
&lt;br /&gt;
User&#039;s are able to select a theme for their terminal session on the top right corner of the screen. &lt;br /&gt;
&lt;br /&gt;
When a session times out, just refresh your browser tab and it should reconnect. &lt;br /&gt;
&lt;br /&gt;
Since this runs in a browser, users should mind that some keyboard shortcuts may not work properly, e.g. ctrl + w&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Main_Page&amp;diff=2638</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Main_Page&amp;diff=2638"/>
		<updated>2026-02-25T14:16:18Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Anunna is a [http://en.wikipedia.org/wiki/High-performance_computing High Performance Computer] (HPC) infrastructure hosted by [https://www.wur.nl/en/show/supercomputer-anunna-opens-up-more-opportunities-for-data-storage-and-artificial-intelligence-applications.htm Wageningen University &amp;amp; Research Centre]. It is open for use for all WUR research groups as well as other organizations, including companies, that have collaborative projects with WUR. &lt;br /&gt;
&lt;br /&gt;
= About =&lt;br /&gt;
&lt;br /&gt;
* [[History of the Cluster|Historical information on the startup of Anunna]]&lt;br /&gt;
&lt;br /&gt;
== Access Policy ==&lt;br /&gt;
[[Access_Policy | Main Article: Access Policy]]&lt;br /&gt;
&lt;br /&gt;
Access needs to be granted actively (by creation of an account on the cluster by FB-IT). Use of resources is limited by the scheduler. Note that the use of Anunna is not free of charge. &lt;br /&gt;
&lt;br /&gt;
= Our Courses =&lt;br /&gt;
The Anunna team organizes HPC courses three times a year to strengthen basic &amp;amp; more advanced skills and enable users to make the most effective use of our facility.&lt;br /&gt;
&lt;br /&gt;
== [[Linux Basic]] ==&lt;br /&gt;
&lt;br /&gt;
== [[HPC Basic]] ==&lt;br /&gt;
&lt;br /&gt;
== [[HPC Advanced]] ==&lt;br /&gt;
&lt;br /&gt;
== [[2026 Course dates]] ==&lt;br /&gt;
&lt;br /&gt;
= Using Anunna =&lt;br /&gt;
* [[Tariffs | Costs associated with resource usage]]&lt;br /&gt;
&lt;br /&gt;
== Gaining access to Anunna==&lt;br /&gt;
Access to the cluster and file transfer are traditionally done via [http://en.wikipedia.org/wiki/Secure_Shell SSH and SFTP].&lt;br /&gt;
* [[log_in_to_B4F_cluster | Logging into cluster using ssh]]&lt;br /&gt;
* [[file_transfer | File transfer options]]&lt;br /&gt;
* [[Services | Alternative access methods, and extra features and services on Anunna]]&lt;br /&gt;
* [[Filesystems | Data storage methods on Anunna]]&lt;br /&gt;
&lt;br /&gt;
== Using Anunna for courses (mainly jupyter notebooks) ==&lt;br /&gt;
* [[steps_for_courses | Steps involved to run a course on Anunna]]&lt;br /&gt;
 &lt;br /&gt;
= Events =&lt;br /&gt;
&lt;br /&gt;
* [[Courses]] that have happened and are happening&lt;br /&gt;
* [[Downtime]] that will affect all users&lt;br /&gt;
* [[Meetings]] that may affect the policies of Anunna&lt;br /&gt;
&lt;br /&gt;
= Software =&lt;br /&gt;
* [[Modules]]&lt;br /&gt;
* [[Apptainer]]&lt;br /&gt;
* [[Python]]&lt;br /&gt;
* [[R]] &lt;br /&gt;
* [[Julia]]&lt;br /&gt;
&lt;br /&gt;
== Browser apps ==&lt;br /&gt;
This page provides an overview of the GUI-based applications available Anunna, including background information and practical guidance on how to access and use interactive desktops and graphical tools directly from your web browser.&lt;br /&gt;
&lt;br /&gt;
* [[General overview|General Overview]]&lt;br /&gt;
* [[Anunna Shell Access]]&lt;br /&gt;
* [[Using the File browser|File Browser]]&lt;br /&gt;
* [[Jupyter|Featured Apps]]&lt;br /&gt;
* [[Jupyter]]&lt;br /&gt;
* [[RStudio|R Studio]]&lt;br /&gt;
* [[Linux desktop|Linux Desktop]]&lt;br /&gt;
* [[Requesting new software|Requesting New Software]]&lt;br /&gt;
&lt;br /&gt;
== Command-line Software ==&lt;br /&gt;
&lt;br /&gt;
==== Cluster Scheduler ====&lt;br /&gt;
Anunna uses Slurm as job scheduler.&lt;br /&gt;
* [[Using_Slurm | Submit jobs with Slurm]]&lt;br /&gt;
* [[node_usage_graph | Be aware of how much work the cluster is under right now with &#039;node_usage_graph&#039;]]&lt;br /&gt;
* [[SLURM_Compare | Rosetta Stone of Workload Managers]]&lt;br /&gt;
&lt;br /&gt;
==== [[Globally installed software]] ====&lt;br /&gt;
&lt;br /&gt;
==== [[ABGC_modules |ABGC specific modules]] ====&lt;br /&gt;
&lt;br /&gt;
==== Installation of software by users ====&lt;br /&gt;
* [[Domain_specific_software_on_B4Fcluster_installation_by_users | Installing domain specific software: installation by users]]&lt;br /&gt;
* [[Setting local variables]]&lt;br /&gt;
* [[Installing_R_packages_locally | Installing R packages locally]]&lt;br /&gt;
* [[Setting_up_Python_virtualenv | Setting up and using a virtual environment for Python3 ]]&lt;br /&gt;
* [[Virtual_environment_Python_3.4_or_higher | Setting up and using a virtual environment for Python3.4 or higher ]]&lt;br /&gt;
* [[Installing WRF and WPS]]&lt;br /&gt;
* [[Running scripts on a fixed timeschedule (cron)]]&lt;br /&gt;
&lt;br /&gt;
= Useful Notes = &lt;br /&gt;
&lt;br /&gt;
== Being in control of Environment parameters ==&lt;br /&gt;
&lt;br /&gt;
* [[Using_environment_modules | Using environment modules]]&lt;br /&gt;
* [[Aliases and local variables]]&lt;br /&gt;
* [[Setting local variables]]&lt;br /&gt;
* [[Setting_TMPDIR | Set a custom temporary directory location]]&lt;br /&gt;
* [[Installing_R_packages_locally | Installing R packages locally]]&lt;br /&gt;
* [[Setting_up_Python_virtualenv | Setting up and using a virtual environment for Python3 ]]&lt;br /&gt;
* [[Locale_settings]] (how numbers and dates are displayed)&lt;br /&gt;
&lt;br /&gt;
== Controlling costs ==&lt;br /&gt;
&lt;br /&gt;
* [[SACCT | using SACCT to see your costs]]&lt;br /&gt;
* [[get_my_bill | using the &amp;quot;get_my_bill&amp;quot; script to estimate costs]]&lt;br /&gt;
&lt;br /&gt;
== Management ==&lt;br /&gt;
Product Owner of Anunna is Alexander van Ittersum (Wageningen UR,FB-IT, C&amp;amp;PS). [[User: prins089 | Fons Prinsen (Wageningen UR, FB-IT, C&amp;amp;PS)]] is responsible for [[Maintenance_and_Management | Maintenance and Management]] of the cluster.&lt;br /&gt;
&lt;br /&gt;
* [[Roadmap | Ambitions regarding innovation, support and administration of Anunna ]]&lt;br /&gt;
&lt;br /&gt;
= Miscellaneous =&lt;br /&gt;
* [[Bioinformatics_tips_tricks_workflows |Bioinformatics tips, tricks, and workflows]]&lt;br /&gt;
* [[Parallel_R_code_on_SLURM | Running parallel R code on SLURM]]&lt;br /&gt;
* [[Convert_between_MediaWiki_and_other_formats | Convert between MediaWiki format and other formats]]&lt;br /&gt;
* [[Manual GitLab | GitLab: Create projects and add scripts]]&lt;br /&gt;
* [[Monitoring_executions | Monitoring job execution]]&lt;br /&gt;
* [[Shared_folders | Working with shared folders in the Lustre file system]]&lt;br /&gt;
* [[Old_binaries | Running older binaries on the updated OS]]&lt;br /&gt;
* [[locale_settings | How to change language settings for yourself]]&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
* [[Maintenance_and_Management | Maintenance and Management]]&lt;br /&gt;
* [[About_ABGC | About ABGC]]&lt;br /&gt;
* [[Computer_cluster | High Performance Computing @ABGC]]&lt;br /&gt;
* [[Lustre_PFS_layout | Lustre Parallel File System layout]]&lt;br /&gt;
&lt;br /&gt;
= External links =&lt;br /&gt;
{| width=&amp;quot;90%&amp;quot;&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot;&lt;br /&gt;
| width=&amp;quot;30%&amp;quot; |&lt;br /&gt;
* [https://www.wur.nl/en/Value-Creation-Cooperation/Facilities/Wageningen-Shared-Research-Facilities/Our-facilities/Show/High-Performance-Computing-Cluster-HPC-Anunna.htm SRF offers a HPC facilty]&lt;br /&gt;
| width=&amp;quot;30%&amp;quot; |&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Scientific_Linux Scientific Linux]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Help:Cheatsheet Help with editing Wiki pages]&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=File_Browser&amp;diff=2637</id>
		<title>File Browser</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=File_Browser&amp;diff=2637"/>
		<updated>2026-02-25T14:12:08Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: Basic file browser information&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Open Ondemand provides a web based file browser to Anunna, which provides a convenient and easy interface for managing fiiles. &lt;br /&gt;
&lt;br /&gt;
By default the file browser points to the user&#039;s  home directory, but shortcuts to lustre and archive are provided in the left side bar. Alterntively users can use the change directory button and type a location they would like to see displayed&lt;br /&gt;
&lt;br /&gt;
* Upload files&lt;br /&gt;
* Download files&lt;br /&gt;
* Create files and directories&lt;br /&gt;
* Delete files and directories&lt;br /&gt;
* Move files and directories&lt;br /&gt;
* Edit files&lt;br /&gt;
&lt;br /&gt;
These features, including editing feature can be acessed by using the dot menu next to the file name. The editor is very basic and only suitable for editing one file at a time. &lt;br /&gt;
&lt;br /&gt;
Note that, despite having the option to upload and download files, this file browser is not suitable for files larges than a couple of gigabytes.&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=Main_Page&amp;diff=2636</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=Main_Page&amp;diff=2636"/>
		<updated>2026-02-25T13:30:50Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: /* Browser apps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Anunna is a [http://en.wikipedia.org/wiki/High-performance_computing High Performance Computer] (HPC) infrastructure hosted by [https://www.wur.nl/en/show/supercomputer-anunna-opens-up-more-opportunities-for-data-storage-and-artificial-intelligence-applications.htm Wageningen University &amp;amp; Research Centre]. It is open for use for all WUR research groups as well as other organizations, including companies, that have collaborative projects with WUR. &lt;br /&gt;
&lt;br /&gt;
= About =&lt;br /&gt;
&lt;br /&gt;
* [[History of the Cluster|Historical information on the startup of Anunna]]&lt;br /&gt;
&lt;br /&gt;
== Access Policy ==&lt;br /&gt;
[[Access_Policy | Main Article: Access Policy]]&lt;br /&gt;
&lt;br /&gt;
Access needs to be granted actively (by creation of an account on the cluster by FB-IT). Use of resources is limited by the scheduler. Note that the use of Anunna is not free of charge. &lt;br /&gt;
&lt;br /&gt;
= Our Courses =&lt;br /&gt;
The Anunna team organizes HPC courses three times a year to strengthen basic &amp;amp; more advanced skills and enable users to make the most effective use of our facility.&lt;br /&gt;
&lt;br /&gt;
== [[Linux Basic]] ==&lt;br /&gt;
&lt;br /&gt;
== [[HPC Basic]] ==&lt;br /&gt;
&lt;br /&gt;
== [[HPC Advanced]] ==&lt;br /&gt;
&lt;br /&gt;
== [[2026 Course dates]] ==&lt;br /&gt;
&lt;br /&gt;
= Using Anunna =&lt;br /&gt;
* [[Tariffs | Costs associated with resource usage]]&lt;br /&gt;
&lt;br /&gt;
== Gaining access to Anunna==&lt;br /&gt;
Access to the cluster and file transfer are traditionally done via [http://en.wikipedia.org/wiki/Secure_Shell SSH and SFTP].&lt;br /&gt;
* [[log_in_to_B4F_cluster | Logging into cluster using ssh]]&lt;br /&gt;
* [[file_transfer | File transfer options]]&lt;br /&gt;
* [[Services | Alternative access methods, and extra features and services on Anunna]]&lt;br /&gt;
* [[Filesystems | Data storage methods on Anunna]]&lt;br /&gt;
&lt;br /&gt;
== Using Anunna for courses (mainly jupyter notebooks) ==&lt;br /&gt;
* [[steps_for_courses | Steps involved to run a course on Anunna]]&lt;br /&gt;
 &lt;br /&gt;
= Events =&lt;br /&gt;
&lt;br /&gt;
* [[Courses]] that have happened and are happening&lt;br /&gt;
* [[Downtime]] that will affect all users&lt;br /&gt;
* [[Meetings]] that may affect the policies of Anunna&lt;br /&gt;
&lt;br /&gt;
= Software =&lt;br /&gt;
* [[Modules]]&lt;br /&gt;
* [[Apptainer]]&lt;br /&gt;
* [[Python]]&lt;br /&gt;
* [[R]] &lt;br /&gt;
* [[Julia]]&lt;br /&gt;
&lt;br /&gt;
== Browser apps ==&lt;br /&gt;
This page provides an overview of the GUI-based applications available Anunna, including background information and practical guidance on how to access and use interactive desktops and graphical tools directly from your web browser.&lt;br /&gt;
&lt;br /&gt;
* [[General overview|General Overview]]&lt;br /&gt;
* [[Using the Shell|Anunna Shell Access]]&lt;br /&gt;
* [[Using the File browser|File Browser]]&lt;br /&gt;
* [[Jupyter|Featured Apps]]&lt;br /&gt;
* [[Jupyter]]&lt;br /&gt;
* [[RStudio|R Studio]]&lt;br /&gt;
* [[Linux desktop|Linux Desktop]]&lt;br /&gt;
* [[Requesting new software|Requesting New Software]]&lt;br /&gt;
&lt;br /&gt;
== Command-line Software ==&lt;br /&gt;
&lt;br /&gt;
==== Cluster Scheduler ====&lt;br /&gt;
Anunna uses Slurm as job scheduler.&lt;br /&gt;
* [[Using_Slurm | Submit jobs with Slurm]]&lt;br /&gt;
* [[node_usage_graph | Be aware of how much work the cluster is under right now with &#039;node_usage_graph&#039;]]&lt;br /&gt;
* [[SLURM_Compare | Rosetta Stone of Workload Managers]]&lt;br /&gt;
&lt;br /&gt;
==== [[Globally installed software]] ====&lt;br /&gt;
&lt;br /&gt;
==== [[ABGC_modules |ABGC specific modules]] ====&lt;br /&gt;
&lt;br /&gt;
==== Installation of software by users ====&lt;br /&gt;
* [[Domain_specific_software_on_B4Fcluster_installation_by_users | Installing domain specific software: installation by users]]&lt;br /&gt;
* [[Setting local variables]]&lt;br /&gt;
* [[Installing_R_packages_locally | Installing R packages locally]]&lt;br /&gt;
* [[Setting_up_Python_virtualenv | Setting up and using a virtual environment for Python3 ]]&lt;br /&gt;
* [[Virtual_environment_Python_3.4_or_higher | Setting up and using a virtual environment for Python3.4 or higher ]]&lt;br /&gt;
* [[Installing WRF and WPS]]&lt;br /&gt;
* [[Running scripts on a fixed timeschedule (cron)]]&lt;br /&gt;
&lt;br /&gt;
= Useful Notes = &lt;br /&gt;
&lt;br /&gt;
== Being in control of Environment parameters ==&lt;br /&gt;
&lt;br /&gt;
* [[Using_environment_modules | Using environment modules]]&lt;br /&gt;
* [[Aliases and local variables]]&lt;br /&gt;
* [[Setting local variables]]&lt;br /&gt;
* [[Setting_TMPDIR | Set a custom temporary directory location]]&lt;br /&gt;
* [[Installing_R_packages_locally | Installing R packages locally]]&lt;br /&gt;
* [[Setting_up_Python_virtualenv | Setting up and using a virtual environment for Python3 ]]&lt;br /&gt;
* [[Locale_settings]] (how numbers and dates are displayed)&lt;br /&gt;
&lt;br /&gt;
== Controlling costs ==&lt;br /&gt;
&lt;br /&gt;
* [[SACCT | using SACCT to see your costs]]&lt;br /&gt;
* [[get_my_bill | using the &amp;quot;get_my_bill&amp;quot; script to estimate costs]]&lt;br /&gt;
&lt;br /&gt;
== Management ==&lt;br /&gt;
Product Owner of Anunna is Alexander van Ittersum (Wageningen UR,FB-IT, C&amp;amp;PS). [[User: prins089 | Fons Prinsen (Wageningen UR, FB-IT, C&amp;amp;PS)]] is responsible for [[Maintenance_and_Management | Maintenance and Management]] of the cluster.&lt;br /&gt;
&lt;br /&gt;
* [[Roadmap | Ambitions regarding innovation, support and administration of Anunna ]]&lt;br /&gt;
&lt;br /&gt;
= Miscellaneous =&lt;br /&gt;
* [[Bioinformatics_tips_tricks_workflows |Bioinformatics tips, tricks, and workflows]]&lt;br /&gt;
* [[Parallel_R_code_on_SLURM | Running parallel R code on SLURM]]&lt;br /&gt;
* [[Convert_between_MediaWiki_and_other_formats | Convert between MediaWiki format and other formats]]&lt;br /&gt;
* [[Manual GitLab | GitLab: Create projects and add scripts]]&lt;br /&gt;
* [[Monitoring_executions | Monitoring job execution]]&lt;br /&gt;
* [[Shared_folders | Working with shared folders in the Lustre file system]]&lt;br /&gt;
* [[Old_binaries | Running older binaries on the updated OS]]&lt;br /&gt;
* [[locale_settings | How to change language settings for yourself]]&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
* [[Maintenance_and_Management | Maintenance and Management]]&lt;br /&gt;
* [[About_ABGC | About ABGC]]&lt;br /&gt;
* [[Computer_cluster | High Performance Computing @ABGC]]&lt;br /&gt;
* [[Lustre_PFS_layout | Lustre Parallel File System layout]]&lt;br /&gt;
&lt;br /&gt;
= External links =&lt;br /&gt;
{| width=&amp;quot;90%&amp;quot;&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot;&lt;br /&gt;
| width=&amp;quot;30%&amp;quot; |&lt;br /&gt;
* [https://www.wur.nl/en/Value-Creation-Cooperation/Facilities/Wageningen-Shared-Research-Facilities/Our-facilities/Show/High-Performance-Computing-Cluster-HPC-Anunna.htm SRF offers a HPC facilty]&lt;br /&gt;
| width=&amp;quot;30%&amp;quot; |&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Scientific_Linux Scientific Linux]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Help:Cheatsheet Help with editing Wiki pages]&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=RStudio&amp;diff=2635</id>
		<title>RStudio</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=RStudio&amp;diff=2635"/>
		<updated>2026-02-25T12:17:12Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: Rstudio&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;RStudio integrated development environment (IDE&#039;&#039;&#039;) is a set of tools built to help you be more productive with R and Python. &lt;br /&gt;
[[File:RStudio-form-20260225.png|thumb|595x595px|Resource Allocation Form]]&lt;br /&gt;
RStudio is built with the aid of EasyBuild and makes use of the relevant R modules available at Anunna&lt;br /&gt;
&lt;br /&gt;
Rstudio can be found both in the All Applications Menu at the navigation bar, and as a button in the Featured Apps speed dial. By clicking in either option, the user will be taken to a form where they will be able to allocate resources for their RStudio session. &lt;br /&gt;
&lt;br /&gt;
=== Resource Allocation form ===&lt;br /&gt;
The resource allocation form allows the use to select the following options&lt;br /&gt;
&lt;br /&gt;
* R version&lt;br /&gt;
* Partition: main by default but the GPU partition is available&lt;br /&gt;
* Number of Hours: Max 4 hours&lt;br /&gt;
* Number of CPUs: CPU cores available&lt;br /&gt;
* Memory : Amount of RAM available&lt;br /&gt;
* Number of GPUs: Zero by default,  this need to be switched to, at least 1&lt;br /&gt;
** Note that the GPU partition must be selected&lt;br /&gt;
* Comment:  Project number that will show up at your bill&lt;br /&gt;
* Slurm options: Slurm flag overrides. &lt;br /&gt;
&lt;br /&gt;
=== Connecting to an active session ===&lt;br /&gt;
Once the form has been filled, the use can then click on the Launch button. This cause the screen to switch to the interactive sessions page where a new session will be listed. &lt;br /&gt;
&lt;br /&gt;
Once the session is ready a &amp;quot;Connect to RStudio Server&amp;quot; button will appear which will allow the user to (re)connect to the corresponding active session. &lt;br /&gt;
&lt;br /&gt;
The card also has a red &amp;quot;Cancel&amp;quot; button where the user may terminate their session.&lt;br /&gt;
[[File:RStudio-connect-20260225.png|center|thumb|509x509px|RStudio active session card at My Interactive Sessions]]&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=File:RStudio-connect-20260225.png&amp;diff=2634</id>
		<title>File:RStudio-connect-20260225.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=File:RStudio-connect-20260225.png&amp;diff=2634"/>
		<updated>2026-02-25T12:15:04Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;RStudio connection card&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
	<entry>
		<id>https://wiki.anunna.wur.nl/index.php?title=File:RStudio-form-20260225.png&amp;diff=2633</id>
		<title>File:RStudio-form-20260225.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.anunna.wur.nl/index.php?title=File:RStudio-form-20260225.png&amp;diff=2633"/>
		<updated>2026-02-25T11:59:48Z</updated>

		<summary type="html">&lt;p&gt;Honfi001: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Rstudio resource allocation form&lt;/div&gt;</summary>
		<author><name>Honfi001</name></author>
	</entry>
</feed>