(Part 5 of series Blueprint for a Modern Research Computing Environment)
Follow me :
Unlike previous parts, this article serves as a map rather than a build tutorial. It covers directory organization, file management, permissions, installing system software with apt, environment variables, SSH, and the basics of HPC clusters and SLURM job submission — the concepts researchers need once they move beyond their local machine to remote servers.
In previous parts, you built a concrete environment on your local machine. Here, the goal is different: this is a map. As a researcher, you’ll eventually work on remote servers and university HPC (High Performance Computing) clusters. This article provides the foundational knowledge needed to navigate these environments confidently.
By the end, you’ll have:
apt.AI tools (like Claude, Grok, Gemini, or ChatGPT) give the best troubleshooting advice when they have the exact text of the tutorial. To ensure the AI understands what you are trying to build, we will give it the actual file.
1. Download the tutorial file
2. Upload it to your AI
Part5.md into the chat).3. Ask for Help Copy and paste this exact prompt into the chat along with your file:
I have attached the markdown file for the tutorial I am following. Please read it so you understand the specific environment I am trying to build.
I need help with the following:
Step [X]: [paste exact step text from the blog]
Command I ran: [paste exact command]
What happened: [paste full output/error — if the terminal was truly blank, say so explicitly]
Please help me troubleshoot and fix this error. You can use your general knowledge to solve the problem, but your solution MUST align with the architecture and tools taught in the attached file. Do not suggest alternative setups that contradict the tutorial. Once fixed, tell me what to do next in the article.
To go deeper on a step before you run a command:
I have attached the
Part5.mdfile. Look at Step [X] and explain exactly what the command does and why we are doing it before I run it.
Think of this series as the roadmap and your AI assistant as your learning companion.
Create nested directories in one command:
mkdir -p ~/project_1/data/raw
mkdir -p ~/project_1/data/processed
mkdir -p ~/project_1/scripts
mkdir -p ~/project_1/results
The -p flag creates all parent directories that don’t exist yet.
View your structure:
find ~/project_1 -type d
Beyond basic navigation, these tools are essential for file management:
rm file.txtrm -rf foldername/ (⚠️ This is permanent; there is no recycle bin)cat file.txt or less file.txt (press q to exit)du -sh ~/project_1/nano: Simple, opens files directly in the terminal; ideal for quick config edits.vim: More powerful but has a steep learning curve; useful for remote servers.Every file and folder in Linux has permissions controlling read, write, and execute access.
Run ls -l ~/project_1/ to see permissions. Change them with chmod:
chmod +x first_script.pychmod 600 ~/.ssh/id_rsaaptUse apt for system-level software, distinct from Python-level packages managed by conda or pip.
sudo apt updatesudo apt install gitsudo apt install gcc g++ gfortranEnvironment variables are configuration values bash reads at startup.
env or echo $PATHexport MY_DATA="/mnt/d/datasets"~/.bashrc and run source ~/.bashrcSSH lets you control remote machines from your terminal.
ssh-keygen -t ed25519 -C "email@example.com"ssh username@server_addressssh-copy-id username@server_address (enables password-less login)scp or rsync -avz for efficient directory synchronizationAn HPC (High Performance Computing) cluster is not one powerful computer — it’s hundreds or thousands of ordinary computers (“nodes”) wired together, shared by many researchers at once. Because it’s shared, you can’t just run your script the moment you connect. You have to ask for a slice of the cluster’s resources, wait your turn, and let it run there. This section walks through that process in the order you’ll actually encounter it.
📌 A note on schedulers: This tutorial uses SLURM, the most common scheduler at university clusters today. Some clusters instead run PBS/Torque, LSF, or a vendor-specific scheduler — e.g., Japan’s Fugaku supercomputer uses the Fujitsu Technical Computing Suite (
pjsubinstead ofsbatch,pjstatinstead ofsqueue,pjdelinstead ofscancel). The concepts below are identical across all of them, only the command names change. Checkman sbatchor your cluster’s documentation to confirm which one you have.
Before running anything, understand the three pieces you’re working with:
ssh into the cluster. It’s shared by every user connected at that moment, and it’s meant only for light tasks — editing files, writing job scripts, submitting jobs, checking results. It is not meant for running your actual code.The one rule to remember: if you’re typing a heavy command directly after ssh-ing in, without going through the scheduler, you’re on the login node — stop, and submit it as a job instead (more in 7.6).
A job script describes what you want to run and how much of the cluster it needs. Save this as job.sh:
#!/bin/bash
#SBATCH --job-name=my_job
#SBATCH --output=my_job_%j.out
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=4
#SBATCH --mem=8G
#SBATCH --time=02:00:00
conda activate env_project1
python first_script.py
Each #SBATCH line is a request to the scheduler — here, one task, 4 CPU cores, 8GB memory, and a 2-hour time limit. Go over the time or memory limit and the scheduler kills your job, so estimate generously but not wastefully.
sbatch job.shsqueue -u username--output above (e.g., my_job_12345.out)sbatch above submits a batch job — it runs unattended, and you only see the result afterward in the .out file. That’s great for long runs, but painful for debugging. For quick tests, request an interactive session instead, which drops you into a live shell on a compute node:
salloc --time=01:00:00 --cpus-per-task=4: Reserve resources and get a shell on a compute node.srun --pty bash: A similar way to start an interactive shell on an allocated node.A good habit as a beginner: test your script interactively first, confirm it runs correctly, then submit the same command as a batch job for the full run.
HPC clusters don’t install every version of every tool system-wide — instead, software is made available through modules, managed by a system called Lmod. You load only what your job needs, when it needs it:
module avail: List software available on the cluster.module load python/3.11: Load a specific version into your environment.module list: See what’s currently loaded.module spider <name>: Search all versions of a piece of software cluster-wide, including ones hidden until a prerequisite is loaded first.module purge: Unload everything — a good first line in a job script, so you start from a clean slate instead of inheriting a messy environment.module swap <old> <new>: Replace one loaded module with another (e.g., switching compiler versions) without unloading everything else.⚠️ Loading modules with conflicting dependencies (e.g., two different MPI implementations at once) is a common source of confusing build errors. If something breaks unexpectedly, module purge and reload only what you actually need.
Unlike your local machine, a cluster usually offers multiple compiler toolchains side by side — GCC, Intel, and NVIDIA HPC are common — rather than one system compiler, and you pick between them using modules (7.4). This matters for two reasons:
As a beginner, you likely won’t need to touch this directly — but if you ever see a build error mentioning a compiler mismatch, this is why. Check what’s available with module avail gcc or module avail intel.
Worth repeating on its own: running heavy computation on the login node (7.1) slows the cluster down for every other user connected to it at that moment, and most clusters treat it as a policy violation — some will automatically kill offending processes. Always route real work through sbatch, salloc, or srun.
Clusters typically split storage into a few areas, each with different rules:
$HOME: Small quota, usually backed up — for scripts and configs, not large datasets./scratch: Large, fast storage for active job I/O, but often not backed up and periodically purged (e.g., files older than 30–90 days deleted automatically)./project (naming varies): Shared, larger-quota space for a research group’s longer-term data.Check your usage against your limit with quota -s (the exact command varies by site — check your cluster’s documentation).
Once a job is submitted, a few more commands help you manage it:
squeue -u username: Check whether it’s still queued or already running.scancel <job_id>: Cancel a running or queued job.sacct -j <job_id>: View accounting details — runtime, memory used, exit status — including for jobs that already finished.What You’ve Done:
Further reading:
Next: Part 6 — Git and GitHub for Reproducible Research | Previous: Part 4 — Setting Up VS Code