Skip to content

Commit

Permalink
Add jinja2 block around memory options (#831)
Browse files Browse the repository at this point in the history
* Add jinja2 block around memory options

This is to enable overriding --mem with --mem-per-gpu or other
cluster-specific options.

* Add the scoped option

See https://jinja.palletsprojects.com/en/3.0.x/templates/#block-nesting-and-scope
  • Loading branch information
cbkerr committed Mar 18, 2024
1 parent f0837ea commit 525ec4c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions flow/templates/slurm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
#!/bin/bash
#SBATCH --job-name="{{ id }}"
{% set memory_requested = operations | calc_memory(parallel) %}
{% block memory scoped %}
{% if memory_requested %}
#SBATCH --mem={{ memory_requested|format_memory }}
{% endif %}
{% endblock memory %}
{% if partition %}
#SBATCH --partition={{ partition }}
{% endif %}
Expand Down

0 comments on commit 525ec4c

Please sign in to comment.