@@ -30,7 +30,7 @@ Containerization packages your software, libraries, and dependencies into a sing
On DAIC specifically, users often encounter issues with limited home directory space or Windows-based `/tudelft.net` mounts (see [Storage](/docs/system/storage)), which can complicate the use of `conda/mamba` and/or `pip`. Containers offer a solution by encapsulating all software and dependencies in a self-contained environment. You can, for instance, store containers on `staff-umbrella` with all required dependencies, including those installed via `pip`, and run them reliably and reproducibly without being limited by home directory size or mount compatibility.
## Containerization on DAIC: Apptainer
DAIC supports [Apptainer](https://apptainer.org/docs/user/main/introduction.html)(previously Apptainer), an open-source container platform, designed to run on High-performance computing environments. Apptainer runs container images securely on shared clusters and allows you to use Docker images directly, without needing Docker itself.
DAIC supports [Apptainer](https://apptainer.org/docs/user/main/introduction.html)(formerly known as Singularity), an open-source container platform designed for high-performance computing environments. Apptainer runs container images securely on shared clusters and allows you to use Docker images directly, without needing Docker itself.
A typical Apptainer workflow revolves around three key components:
@@ -584,6 +584,16 @@ Pull the `python:3.11-slim` image from Docker Hub and explore it:
4. List the contents of `/usr/local/lib/python3.11/`
5. Exit the container
{{% alert title="Check your work" color="info" %}}
After pulling, you should have `python_3.11-slim.sif`. Inside the container:
```shell-session
Apptainer>python --version
Python 3.11.x
Apptainer>ls /usr/local/lib/python3.11/
... site-packages ...
```
{{% /alert %}}
### Exercise 2: Run a command in a container
Using the Python image from Exercise 1:
@@ -592,6 +602,19 @@ Using the Python image from Exercise 1:
2. Use `apptainer exec` to run the script inside the container
3. Try running it with the `-C` flag - what happens to your script?
{{% alert title="Check your work" color="info" %}}
What did you see in `/tudelft.net/staff-umbrella`? These are project directories - you'll have access to at least one for your work.
{{% alert title="Check your work" color="info" %}}
You should see project directories when listing`/tudelft.net/staff-umbrella`. After `cd ~` and `pwd`, you should see your home directory path (e.g., `/home/netid01`).
{{% alert title="Check your work" color="info" %}}
`ls nlp-project` should show:
```
data notebooks outputs src
```
`cat nlp-project/README.md` should show:
```
# NLP Project
Author: <your-netid>
```
{{% /alert %}}
## Part 4: Working with files
Let's create some actual code to work with.
@@ -309,6 +321,14 @@ $ ls src
evaluate.py train.py
```
{{% alert title="Check your work" color="info" %}}
`ls src` should show both files:
```
evaluate.py train.py
```
If `train.py` is missing, you may have forgotten to copy before moving.
{{% /alert %}}
## Part 5: Viewing and editing files
### Viewing file contents
@@ -418,6 +438,10 @@ $ grep -l "import" src/*.py # Just show filenames
$find .-type d -name"data"
```
{{% alert title="Check your work" color="info" %}}
The `find . -mtime -1` command should list files you recently created. The `grep -n` command shows line numbers where "print" appears. The directory search should show `./data` (and any other data directories you created).
{{% /alert %}}
## Part 7: Transferring files
You'll often need to move data between your local computer and DAIC.
@@ -471,6 +495,14 @@ $ cat ~/linuxhome/test.txt
test data
```
{{% alert title="Check your work" color="info" %}}
After the `scp` command, you should see:
```
test.txt 100% 10 0.0KB/s 00:00
```
On DAIC, `cat ~/linuxhome/test.txt` should display "test data".
{{% /alert %}}
## Part 8: Automating with scripts
When you find yourself typing the same commands repeatedly, it's time to write a script.
@@ -600,6 +632,15 @@ $ chmod +x cleanup_logs.sh
$./cleanup_logs.sh logs/
```
{{% alert title="Check your work" color="info" %}}
Verify the script is executable:
```shell-session
$ls-l cleanup_logs.sh
-rwxr-xr-x 1 netid01 netid01 ... cleanup_logs.sh
```
The `x` in the permissions confirms it's executable. When run, it prints "Cleaning logs in logs/" and "Done!" (plus any files it removes).
{{% /alert %}}
## Part 9: Useful shortcuts and tips
### Tab completion
@@ -684,4 +725,4 @@ Now that you're comfortable with the command line:
## Quick reference
See the [Bash Cheatsheet](/reference/bash-cheatsheet/) for a compact command reference.
For more advanced shell customization, see [Shell Setup](/quickstart/shell-setup/).
DAIC uses an *environment modules* system to manage software. Instead of having every version of every library available at once (which would cause conflicts), software is organized into modules that you load when needed.
The `module` commands set up your software environment:
@@ -765,21 +765,57 @@ Practice these tasks to build muscle memory:
### Exercise 1: Basic editing
Create a new file, add three lines of text, save and quit. Then reopen it and verify your changes.
{{% alert title="Check your work" color="info" %}}
After `:wq`, verify with:
```shell-session
$cat myfile.txt
line one
line two
line three
```
If the file is empty, you may have quit without saving (`:q!` instead of `:wq`).
{{% /alert %}}
### Exercise 2: Navigation
Open a Python file and practice: go to end (`G`), go to beginning (`gg`), jump by words (`w`, `b`), go to specific line (`10G`).
{{% alert title="Check your work" color="info" %}}
Check your position with `:set number` to show line numbers. After `G`, you should be on the last line. After `gg`, you should be on line 1. After `10G`, you should be on line 10.
{{% /alert %}}
### Exercise 3: Delete and undo
Open a file, delete a line (`dd`), undo (`u`), delete a word (`dw`), undo again.
{{% alert title="Check your work" color="info" %}}
After each `u`, the deleted content should reappear. If undo doesn't work, make sure you're in Normal mode (press `Esc` first).
{{% /alert %}}
### Exercise 4: Copy and paste
Copy a line (`yy`), move to a new location, paste it (`p`). Then try with multiple lines using `V`.
{{% alert title="Check your work" color="info" %}}
After `yy` and `p`, you should see the same line duplicated. With `V`, select multiple lines (they highlight), then `y` to copy and `p` to paste them elsewhere.
{{% /alert %}}
### Exercise 5: Search and replace
Open a file and search for a word (`/word`). Then replace all occurrences of one word with another (`:%s/old/new/g`).
{{% alert title="Check your work" color="info" %}}
After `/word` and pressing Enter, the cursor jumps to the first match. Press `n` to see subsequent matches. After `:%s/old/new/g`, Vim reports how many substitutions were made (e.g., "5 substitutions on 3 lines").
{{% /alert %}}
### Exercise 6: Real task
Edit a SLURM batch script: change the time limit, add a new `#SBATCH` directive, and save.
{{% alert title="Check your work" color="info" %}}
After saving, verify your changes:
```shell-session
$grep-E"time|gres" submit.sh
#SBATCH --time=4:00:00
#SBATCH --gres=gpu:1
```
{{% /alert %}}
## Keep learning
- Run `vimtutor` for a 30-minute interactive tutorial