Repository navigation
Compilation step hanging forever on HPC #5347
|
When trying to run my Firedrake script (developed and working correctly on my laptop) on an HPC, I encounter an issue where creating the #!/bin/sh
#SBATCH --account maths
#SBATCH --time=10:00:00
#SBATCH --ntasks=40
#SBATCH --mem=64G
#SBATCH --job-name="test_firedrake"
#SBATCH --mail-user=...
#SBATCH --mail-type=ALL
#SBATCH --output=firedrake_%j.out
#SBATCH --error=firedrake_%j.err
# set apptainer cache dirs
mkdir -p /scratch/TrueCP6/apptainer_cache
mkdir -p /scratch/TrueCP6/apptainer_tmp
export APPTAINER_CACHEDIR=/scratch/TrueCP6/apptainer_cache
export APPTAINER_TMPDIR=/scratch/TrueCP6/apptainer_tmp
# store firedrake cache on scratch - also tried /tmp/
export APPTAINERENV_XDG_CACHE_HOME=/scratch/TrueCP6/firedrake_cache
export APPTAINERENV_PYOP2_CACHE_DIR=/scratch/TrueCP6/firedrake_cache/pyop2
# An effort to warm the firedrake cache on a single core - terminates automatically after one solve
# This works correctly
srun --ntasks=1 --unbuffered apptainer exec --bind /scratch/TrueCP6 ~/firedrake.sif python3 -u Thesis/main.py --compile-only
# All initial setup runs practically instantly
# Hangs forever (at least hours) when creating `LinearVariationalSolver`
srun --ntasks=40 --unbuffered apptainer exec --bind /scratch/TrueCP6 ~/firedrake.sif python3 -u Thesis/main.pyI am aware that this could be caused by conflicting file locks, but setting the cache location to the /tmp/ dir on the relevant node did not seem to help. Any help would be appreciated. |
Replies: 2 comments 2 replies
|
We'll need a bit more information to be able to debug what's going on. Please can you try the following things?
|
|
Thank you for the response. For clarification I got the infinite hanging for any number of ranks >1. I figured out that I should have been calling MPI inside the container, not outside. Calling it outside boots up 40 main ranks that don't know each other exist. The lock contention on compiled files is what I believe was causing the infinite hanging. This script is a working version of the above: #!/bin/sh
#SBATCH --account maths
#SBATCH --time=10:00:00
#SBATCH --nodes=1 --ntasks=40
#SBATCH --mem=64G
#SBATCH --job-name="test_firedrake"
#SBATCH --mail-user=...
#SBATCH --mail-type=ALL
#SBATCH --output=firedrake_%j.out
#SBATCH --error=firedrake_%j.err
# 1. Setup Apptainer environment
mkdir -p /scratch/TrueCP6/apptainer_cache
mkdir -p /scratch/TrueCP6/apptainer_tmp
export APPTAINER_CACHEDIR=/scratch/TrueCP6/apptainer_cache
export APPTAINER_TMPDIR=/scratch/TrueCP6/apptainer_tmp
# 2. Create a unique, node-local cache directory on the host's /tmp/
HOST_CACHE_DIR=/tmp/firedrake_cache_${SLURM_JOB_ID}
mkdir -p $HOST_CACHE_DIR
# 3. Direct Apptainer to use this new local cache
export APPTAINERENV_XDG_CACHE_HOME=$HOST_CACHE_DIR
export APPTAINERENV_PYOP2_CACHE_DIR=${HOST_CACHE_DIR}/pyop2
# 4. Single-core cache warming (not necessary)
# apptainer exec \
# --bind /scratch/TrueCP6 \
# --bind $HOST_CACHE_DIR \
# ~/firedrake.sif python3 -u Thesis/main.py --compile-only
# 5. Use the container's native `mpiexec`
apptainer exec \
--bind /scratch/TrueCP6 \
--bind $HOST_CACHE_DIR \
~/firedrake.sif mpiexec -n 40 python3 -u Thesis/main.py |
Thank you for the response. For clarification I got the infinite hanging for any number of ranks >1.
I figured out that I should have been calling MPI inside the container, not outside. Calling it outside boots up 40 main ranks that don't know each other exist. The lock contention on compiled files is what I believe was causing the infinite hanging.
This script is a working version of the above: