Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example_submission_scripts #350

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions example_hpc_submission_scripts/australia_nci_gadi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

#PBS -l walltime=1:00:00
#PBS -l mem=10gb
#PBS -l ncpus=8
#PBS -l software=vasp
#PBS -l wd

# Load module, always specify version number.
module load vasp/5.4.4

# Must include `#PBS -l storage=scratch/ab12+gdata/yz98` if the job
# needs access to `/scratch/ab12/` and `/g/data/yz98/`

mpirun vasp_std >vasp.log
18 changes: 18 additions & 0 deletions example_hpc_submission_scripts/australia_nci_gadi_gpu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

#PBS -q gpuvolta
#PBS -l walltime=10:00:00
#PBS -l ncpus=48
#PBS -l ngpus=4
#PBS -l mem=160GB
#PBS -l jobfs=1GB
#PBS -l wd

# Load module, always specify version number.
module load vasp/6.2.1

# Must include `#PBS -l storage=scratch/ab12+gdata/yz98` if the job
# needs access to `/scratch/ab12/` and `/g/data/yz98/`. Details on:
# https://opus.nci.org.au/display/Help/PBS+Directives+Explained

mpirun -np $PBS_NGPUS --map-by ppr:1:numa vasp_std-gpu >vasp.log
17 changes: 17 additions & 0 deletions example_hpc_submission_scripts/australia_pawsey_setonix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash -l
##SBATCH --nodes=1
#SBATCH --ntasks=32
#SBATCH --ntasks-per-node=32
#SBATCH --cpus-per-task=1
#SBATCH --account=pawsey0380
#SBATCH --job-name=TSR_RATTLE_struct_1871_2_Mn_8.sh
#SBATCH --time=4:00:00
#SBATCH --partition=work
#SBATCH --export=NONE
#SBATCH --mem=32GB
##SBATCH --exclusive
module load vasp/5.4.4
cd "$PBS_O_WORKDIR"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Consider using SLURM_SUBMIT_DIR and add error handling

  1. This script appears to be for a SLURM-based system (Setonix), but it's using PBS_O_WORKDIR. Consider using SLURM_SUBMIT_DIR instead, which is the SLURM equivalent.

  2. Add error handling to the cd command as suggested by Shellcheck.

Here's a suggested modification:

-cd "$PBS_O_WORKDIR"
+cd "$SLURM_SUBMIT_DIR" || { echo "Failed to change directory"; exit 1; }

This change ensures that the script exits if it fails to change to the correct directory, preventing potential issues with file access or job execution in the wrong location.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
cd "$PBS_O_WORKDIR"
cd "$SLURM_SUBMIT_DIR" || { echo "Failed to change directory"; exit 1; }
🧰 Tools
🪛 Shellcheck

[warning] 14-14: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

ulimit -s unlimited
run_cmd="srun --export=ALL -N 1 -n 32"
$run_cmd vasp_std &> vasp.log
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enhance error handling and output management

While the current command will capture both stdout and stderr in vasp.log, consider implementing more robust error handling and output management. Here are some suggestions:

  1. Separate stdout and stderr for easier debugging.
  2. Add a check for the exit status of the VASP run.
  3. Consider using a timestamp in the log filename to prevent overwriting in case of multiple runs.

Here's a suggested modification:

-$run_cmd vasp_std &> vasp.log
+log_file="vasp_$(date +%Y%m%d_%H%M%S).log"
+$run_cmd vasp_std > "$log_file" 2>&1
+exit_status=$?
+if [ $exit_status -ne 0 ]; then
+    echo "VASP run failed with exit status $exit_status. Check $log_file for details." >&2
+    exit $exit_status
+fi

This change separates stdout and stderr (but still captures both in the log file), checks the exit status of the VASP run, uses a timestamp in the log filename, and provides an informative error message if the run fails.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
$run_cmd vasp_std &> vasp.log
log_file="vasp_$(date +%Y%m%d_%H%M%S).log"
$run_cmd vasp_std > "$log_file" 2>&1
exit_status=$?
if [ $exit_status -ne 0 ]; then
echo "VASP run failed with exit status $exit_status. Check $log_file for details." >&2
exit $exit_status
fi

Loading