Skip to content
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ used to supplement or override the template defaults. Templated parameters can
also be removed by setting the value to the literal string `'omit'` - note
that this is *not the same* as the Ansible `omit` [special variable](https://docs.ansible.com/ansible/latest/reference_appendices/special_variables.html#term-omit).

`openhpc_mpi_config`: Optional. Mapping of additional parameters and values for
[mpi.conf](https://slurm.schedmd.com/mpi.conf.html). Keys are mpi.conf
parameter names and values are lists or strings as appropriate. This can be
used to supplement or override the template defaults. Templated parameters can
also be removed by setting the value to the literal string `'omit'` - note
that this is *not the same* as the Ansible `omit` [special variable](https://docs.ansible.com/ansible/latest/reference_appendices/special_variables.html#term-omit).

`openhpc_ram_multiplier`: Optional, default `0.95`. Multiplier used in the calculation: `total_memory * openhpc_ram_multiplier` when setting `RealMemory` for the partition in slurm.conf. Can be overriden on a per partition basis using `openhpc_slurm_partitions.ram_multiplier`. Has no effect if `openhpc_slurm_partitions.ram_mb` is set.

`openhpc_state_save_location`: Optional. Absolute path for Slurm controller state (`slurm.conf` parameter [StateSaveLocation](https://slurm.schedmd.com/slurm.conf.html#OPT_StateSaveLocation))
Expand Down
3 changes: 3 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ openhpc_cgroup_config: {}
openhpc_gres_template: gres.conf.j2
openhpc_cgroup_template: cgroup.conf.j2

openhpc_mpi_template: mpi.conf.j2
openhpc_mpi_config: {}

openhpc_state_save_location: /var/spool/slurm
openhpc_slurmd_spool_dir: /var/spool/slurm
openhpc_slurm_conf_path: /etc/slurm/slurm.conf
Expand Down
15 changes: 15 additions & 0 deletions tasks/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,20 @@
register: ohpc_cgroup_conf
# NB uses restart rather than reload as this is needed in some cases

- name: Template mpi.conf
template:
src: "{{ openhpc_mpi_template }}"
dest: "{{ openhpc_slurm_conf_path | dirname }}/mpi.conf"
owner: root
group: root
mode: "0644"
when:
- openhpc_enable.control | default(false)
- openhpc_mpi_config | length > 0
notify:
- Restart slurmctld service
register: ohpc_mpi_conf

# Workaround for https://bugs.rockylinux.org/view.php?id=10165
- name: Fix permissions on /etc for Munge service
ansible.builtin.file:
Expand Down Expand Up @@ -134,6 +148,7 @@
when:
- openhpc_slurm_control_host in ansible_play_hosts
- hostvars[openhpc_slurm_control_host].ohpc_slurm_conf.changed or
hostvars[openhpc_slurm_control_host].ohpc_mpi_conf.changed or
hostvars[openhpc_slurm_control_host].ohpc_cgroup_conf.changed or
hostvars[openhpc_slurm_control_host].ohpc_gres_conf.changed # noqa no-handler
notify:
Expand Down
6 changes: 6 additions & 0 deletions templates/mpi.conf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# {{ ansible_managed }}
{% for k, v in openhpc_mpi_config.items %}
{% if v != "omit" %}{# allow removing items using setting key: omit #}
{{ k }}={{ v | join(',') if (v is sequence and v is not string) else v }}
{% endif %}
{% endfor %}