HPC Integration#
EngiAI integrates with high-performance computing (HPC) clusters for running computationally intensive tasks via SLURM.
Prerequisites#
Access to an HPC cluster with SLURM (e.g., ETH Euler)
SSH key authentication configured
Proper environment modules on the cluster
Configuration#
Personal/development deployment: direct SSH#
Set up your HPC credentials in .env:
HPC_HOST_ALIAS=euler
HPC_HOSTNAME=euler.ethz.ch
HPC_USERNAME=your_username
And configure your SSH access:
# In ~/.ssh/config
Host euler
HostName euler.ethz.ch
User your-username
IdentityFile ~/.ssh/id_ed25519
Test the connection:
ssh euler
Remote Python Environment Setup#
The HPC agent submits SLURM jobs that run training from a clone of EngiOpt (cd $HOME/EngiOpt) inside a Python virtual environment. You need both the clone and the venv on the cluster. This is a one-time setup.
Recommended: setup script#
Copy the repo’s scripts/setup_engiopt_remote.sh to the cluster and run it after SSHing in. It loads the modules, clones EngiOpt at the pinned commit into $HOME/EngiOpt, creates the venv at ~/venvs/engiai, and installs the pinned engibench + engiopt:
ssh euler
# from the engineer-assistant checkout, copy the script over, e.g.:
# scp scripts/setup_engiopt_remote.sh euler:~/
./setup_engiopt_remote.sh
The script is idempotent (re-running re-checks the pin and reuses the venv); pass --force to wipe and recreate both. Defaults can be overridden via environment variables (ENGIOPT_DIR, VENV_DIR, SLURM_PYTHON_MODULE, …) — run with --help for the full list.
Manual setup#
If you prefer to do it by hand:
ssh euler
module load stack/2024-06 gcc/12.2.0 python_cuda/3.11.6 cuda/12.1.1
git clone https://github.com/IDEALLab/EngiOpt.git ~/EngiOpt
git -C ~/EngiOpt checkout fb8fb12cfd0945bea0d335f06f8147af700e3ba0
python -m venv ~/venvs/engiai
source ~/venvs/engiai/bin/activate
pip install "engibench[all] @ git+https://github.com/IDEALLab/EngiBench.git@221605876556e23bb97ae3c73d58c74fa7338473"
pip install -e ~/EngiOpt
Note
The commit hashes above must match the versions pinned in pyproject.toml. The script reads the same pins; check pyproject.toml if either is outdated.
The EngiOpt path (~/EngiOpt) and venv path (~/venvs/engiai) are configurable in the Settings UI under SLURM Configuration > EngiOpt Path and Virtual Environment Path.
You must always load the modules before activating the venv, since it depends on the module-provided Python:
module load stack/2024-06 gcc/12.2.0 python_cuda/3.11.6 cuda/12.1.1
source ~/venvs/engiai/bin/activate
Using the HPC Agent#
The HPC agent is accessed through natural language via the Streamlit UI or Supervisor Agent. Simply describe what you want to do:
Submitting Jobs#
"Submit a training job to Euler with seed 1 and 100 epochs"
"Run the cGAN training on HPC for beams2d"
The agent will:
Generate a SLURM script with appropriate resources
Submit the job via SSH
Report the job ID
Monitoring Jobs#
"Check the status of my running jobs"
"Monitor job 12345 until it completes"
Retrieving Results#
"Download the output from job 12345"
"Get the training results from HPC"
Available HPC Tools#
The HPC agent has access to these tools:
Tool |
Description |
|---|---|
|
Verify SSH connectivity to the cluster |
|
Submit a SLURM job script |
|
Check job status |
|
Poll until job finishes |
|
Cancel a running job |
|
Retrieve output files via SFTP |
|
List all active jobs |
SLURM Configuration#
Default SLURM parameters can be set in .env:
SLURM_TIME=00:45:00
SLURM_NTASKS=1
SLURM_CPUS_PER_TASK=4
SLURM_MEM_PER_CPU=7GB
SLURM_GPUS=rtx_4090:1
These can also be configured via the Settings UI.
ML Training Pipeline#
The HPC agent supports end-to-end ML training workflows:
Generate training script — Creates a SLURM script for EngiOpt model training
Submit to cluster — Uploads and submits the job
Monitor execution — Tracks job progress until completion
Evaluate results — Downloads the trained model and computes metrics
Example:
"Train a cGAN model for beams2d on Euler with seed 1 and 100 epochs,
then evaluate it against the dataset baseline"
SSH in Docker#
Direct-SSH development mounts keys from SSH_HOST_DIR (default: ~/.ssh). A
shared lab deployment must use the managed broker above and point
SSH_HOST_DIR at an empty directory. See the
Docker Deployment Guide for direct SSH agent details.
Troubleshooting#
Connection Issues#
Verify SSH access:
ssh eulerCheck SSH key permissions:
chmod 600 ~/.ssh/id_ed25519For Docker: ensure SSH agent is running with
ssh-add -l
Job Failures#
Check job output:
cat slurm-<jobid>.outVerify modules are available:
module availCheck resource requests match cluster limits