File size: 8,232 Bytes
89ce8a0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9f0b0b1
89ce8a0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# Paris Hackathon: JURECA Environment Setup

**TLDR:** The **team lead** runs `hackathon_setup.sh` once. **Every other teammate** runs `teammate.sh` after the lead finishes. On future logins, activate the project rather than repeating initial setup.

This guide explains how to set up and use your team's shared environment on JURECA.

> **Project ID:** `training2666`. All commands below use this ID. If the organizers assign a different project, use that ID instead. The downloaded setup scripts must use the same ID.

## Setup scripts

- [`hackathon_setup.sh`](https://huggingface.co/datasets/SprintML/hackathon/resolve/main/hackathon_setup.sh): run **once by the team lead**, before anyone else sets up.
- [`teammate.sh`](https://huggingface.co/datasets/SprintML/hackathon/resolve/main/teammate.sh): run **individually by every other team member**, after the team lead finishes.

**Setup order:** Team lead first → all other teammates afterward. Sign in to JURECA with your **own Jülich account**. Do not run both scripts from the same account.

## 1. Team lead: initial setup

### Download the scripts

```bash
mkdir -p ~/hackathon-scripts
cd ~/hackathon-scripts

wget https://huggingface.co/datasets/SprintML/hackathon/resolve/main/hackathon_setup.sh -O hackathon_setup.sh
wget https://huggingface.co/datasets/SprintML/hackathon/resolve/main/teammate.sh -O teammate.sh
```

You **do not** need to create your scratch folder manually. The setup script creates it.

### Configure `hackathon_setup.sh`

Edit the configuration section, using actual Jülich usernames:

```bash
TEAM_LEAD="<your-juelich-username>"
TEAMMATE_1="<teammate-1-username>"
TEAMMATE_2="<teammate-2-username>"
TEAMMATE_3=""  # Leave unused entries empty
TEAM_FOLDER="<your-team-name>"
```

- `TEAM_LEAD` is the team lead's Jülich username.
- `TEAMMATE_1` through `TEAMMATE_3` are the other members' usernames. Leave unused slots as `""`.
- `TEAM_FOLDER` is the shared folder name. Tell all teammates the exact value.
- At least one teammate must be configured.

### Run the script

```bash
source hackathon_setup.sh
```

**Wait until the script finishes successfully before asking teammates to continue.** It activates the project, creates the scratch folder, configures access permissions, downloads datasets, creates task-specific `.venv` environments, and configures shared uv/Hugging Face cache locations.

The shared folder is:

```text
/p/scratch/training2666/<team-lead-username>/<team-name>/
```

## 2. Other teammates: join the shared environment

**Only start after the team lead has completed Section 1.** Each teammate follows these steps from their own JURECA account.

### Download `teammate.sh`

```bash
mkdir -p ~/hackathon-scripts
cd ~/hackathon-scripts
wget https://huggingface.co/datasets/SprintML/hackathon/resolve/main/teammate.sh -O teammate.sh
```

### Configure `teammate.sh`

```bash
TEAM_LEAD="<team-lead-username>"
TEAM_FOLDER="<team-name>"
```

These values must match the team lead's configuration. `TEAM_LEAD` is **not** your own username unless you are the lead.

### Run the script

```bash
source teammate.sh
```

This activates the project, configures shared cache paths, checks shared-folder access, installs `uv` if needed, and writes the shell configuration to `~/.bashrc`.

**Do not redownload datasets or recreate environments.** The team lead has already prepared the shared task folders.

## 3. Work on a task

Change into a task directory, replacing the placeholders with the real names:

```bash
cd /p/scratch/training2666/<team-lead>/<team-folder>/<dataset-name>
```

Activate its Python environment and run your code:

```bash
source .venv/bin/activate
python main.py
```

If the task is configured as a uv project, you may instead use:

```bash
uv run python main.py
```

Replace `main.py` with the actual script name. Be aware that `uv run` may attempt to synchronize dependencies; coordinate changes to shared environments with teammates.

### Expected folder layout

```text
/p/scratch/training2666/
└── <team-lead-username>/
    └── <team-folder>/
        ├── unlearning/
        │   ├── .venv/
        │   ├── requirements.txt
        │   └── output/
        ├── model_equality/
        │   ├── .venv/
        │   ├── requirements.txt
        │   └── output/
        ├── Hackathon_Watermark_Localisation_Task/
        │   ├── .venv/
        │   ├── requirements.txt
        │   └── output/
        ├── .uv/
        └── .cache/
```

The specific files present may vary by task and dataset.

## 4. Every new login/session

Activate the project:

```bash
jutil env activate -p training2666
```

If the cache variables are not available in the current shell:

```bash
source ~/.bashrc
```

Then enter your task directory and activate its `.venv` as needed. **Do not rerun the initial setup scripts at every login.**

## 5. Submit GPU jobs

Create `main.sh` in the relevant task directory:

```bash
#!/bin/bash
#SBATCH --account=training2666
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --gres=gpu:1
#SBATCH --reservation=cispahack
#SBATCH --cpus-per-task=8
#SBATCH --partition=dc-gpu
#SBATCH --output=output/%j.out
#SBATCH --error=output/%j.err

# Change to your task directory
cd /p/scratch/training2666/<team-lead>/<team-folder>/<dataset-name> || exit 1

# Activate the shared task environment
source .venv/bin/activate

# Run your program
srun python code.py

echo "done!"
```

Replace placeholders and `code.py` with the correct values. **The account, reservation, partition, and GPU request must match the resources assigned by the organizers.**

Create `output/` **before** submitting the job, since Slurm needs the log directory to exist:

```bash
mkdir -p output
sbatch main.sh
```

Check queued/running jobs:

```bash
squeue -u "$USER"
```

Logs are written to `output/<job-id>.out` and `output/<job-id>.err`.

## 6. Adding a teammate after initial setup

If someone joins later, **the team lead grants access**. Existing teammates do not need to rerun their scripts.

From the **team lead's account**, with the correct usernames:

```bash
TEAM_LEAD="<team-lead-username>"
NEW_MEMBER="<new-member-username>"
TEAM_LEAD_DIR="/p/scratch/training2666/$TEAM_LEAD"

# Grant access to existing files and directories
setfacl -R -m "u:$NEW_MEMBER:rwx" "$TEAM_LEAD_DIR"

# Grant default access on new files and subdirectories
find "$TEAM_LEAD_DIR" -type d \
    -exec setfacl -d -m "u:$NEW_MEMBER:rwx" {} +
```

These commands provide broad read/write/execute access within the lead's scratch tree. Run them **only** when that level of access is intended. The new member then follows **Section 2** and runs `source teammate.sh` from their own account.

## 7. Rules for shared work

- Do not delete shared folders or datasets.
- Do not modify ACL permissions unless you are the team lead managing team access.
- Do not recreate `.venv` environments without coordinating with the team.
- Avoid unnecessary or conflicting package changes in shared environments.
- Keep work within your assigned team folder and task directories.
- Put outputs and logs in the relevant task's `output/` folder.

## 8. Troubleshooting

### Cannot access the team folder

Confirm that `TEAM_LEAD` and `TEAM_FOLDER` are correct and that the lead completed setup. If you joined later, ask the lead to follow **Section 6**.

### `uv: command not found`

```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
source ~/.local/bin/env
```

### Python environment is not active

Enter the task directory and run:

```bash
source .venv/bin/activate
```

If `.venv` does not exist, ask the team lead to check whether initial setup succeeded.

### Project is not active

```bash
jutil env activate -p training2666
```

### A dataset or environment is missing

Ask the team lead to inspect the initial setup output. Do not overwrite existing shared environments without coordinating with the team.

---

**Quick recap:** The **team lead** runs `hackathon_setup.sh` once. **Every other teammate** runs `teammate.sh` after the lead finishes. On future logins, activate the project rather than repeating initial setup.