Skip to main content

Cantera

Cantera is a suite of object-oriented software tools for problems involving chemical kinetics, thermodynamics, and/or transport processes.

Pour plus d'information

Exécution de Cantera

ModuleVersion
Cantera3.2.0

Exemple de Script slurm de Job Cantera

Here is a sample SLURM script for job submission:

#!/bin/bash -x
#SBATCH --account=<id-projet>
#SBATCH --partition=std
#SBATCH --job-name=cantera
#SBATCH --output=slurm-%x.%N.%j.out
#SBATCH --error=slurm-%x.%N.%j.err
#SBATCH --nodes=1
#SBATCH --time=0-01:00:00

# Print SLURM environment variables
env | grep -i slurm

# Change to the submission directory
cd "$SLURM_SUBMIT_DIR"

# Create a temporary directory for the job
WORKDIR="$SCRATCHDIR/job.$SLURM_JOB_ID.$USER"
mkdir -p "$WORKDIR"

module purge
module load cantera/3.2.0

ulimit -s unlimited

# Copy submission files to the working directory
cp "$SLURM_SUBMIT_DIR"/*.yaml "$WORKDIR"
cp "$SLURM_SUBMIT_DIR"/*.py "$WORKDIR"

# Change to the working directory
cd "$WORKDIR"

# Log start time
echo "Start calculation: $(date)" >> "$SLURM_SUBMIT_DIR/slurm-${SLURM_JOB_ID}.log"

# Run with mpirun or srun according to cluster policy
srun python script.py > script_output.log 2>&1

# Log end time
echo "End calculation: $(date)" >> "$SLURM_SUBMIT_DIR/slurm-${SLURM_JOB_ID}.log"

# Create an output directory
OUTDIR="$SLURM_SUBMIT_DIR/outdir.$SLURM_JOB_ID"
mkdir -p "$OUTDIR"

# Move all working files to the output directory
cp "$WORKDIR"/* "$OUTDIR"

# Optional: Uncomment the line below to delete the working directory
# rm -rf "$WORKDIR"

Using Jupyter for Debugging Python Code and Parameter Adjustment

Interactive Node Reservation

To reserve an interactive node, use:

salloc -A $SLURM_ACCOUNT -N1 -p std -t 1:00:00 srun --pty bash \
-c 'module purge; module load cantera/3.2.0; \
jupyter lab --no-browser --port=8888 --ip=0.0.0.0'

SSH Tunnel Setup

Open an SSH tunnel from your local machine with:

ssh -fNL 8888:noeud:8888 -p <port> login@193.54.9.82

Open Jupyter in Your Browser

After setting up the SSH tunnel, open Jupyter in your web browser by navigating to:

http://localhost:8888/lab?
note

For more details on using Jupyter on eXplor, visit: Jupyter Documentation