Skip to content

Commit

Permalink
Merge pull request #12 from DarkAssassin23/master
Browse files Browse the repository at this point in the history
Added support for more distros
  • Loading branch information
geerlingguy authored Sep 6, 2023
2 parents 073e7a1 + 7691c68 commit 1263eff
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 13 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ Currently supported OSes:
- Ubuntu (20.04+)
- Raspberry Pi OS (11+)
- Debian (11+)
- Rocky Linux (9+)
- AlmaLinux (9+)
- CentOS Stream(9+)
- RHEL (9+)
- Fedora (38+)
- Arch Linux
- Manjaro

Other OSes may need a few tweaks to work correctly. You can also run the playbook inside Docker (see the note under 'Benchmarking - Single Node'), but performance will be artificially limited.

Expand All @@ -33,6 +40,10 @@ Each host should be reachable via SSH using the username set in `ansible_user`.

Tweak other settings inside `config.yml` as desired (the most important being `hpl_root`—this is where the compiled MPI, ATLAS, and HPL benchmarking code will live).

> **Note**:
> The names of the nodes inside `hosts.ini` must match the hostname of their corresponding node; otherwise, the benchmark will hang when you try to run it in a cluster.
> For example, if you have `node-01.local` in your `hosts.ini` your host's hostname should be `node-01` and not something else like `raspberry-pi`.
Then run the benchmarking playbook inside this directory:

```
Expand Down
12 changes: 12 additions & 0 deletions dependencies/arch-based.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- name: Update pacman cache.

Check warning on line 1 in dependencies/arch-based.yml

View workflow job for this annotation

GitHub Actions / Lint

1:1 [document-start] missing document start "---"
community.general.pacman:
update_cache: true
become: true

- name: Install dependencies.
ansible.builtin.package:
name:
- base-devel
- gcc-fortran
state: present
become: true

Check failure on line 12 in dependencies/arch-based.yml

View workflow job for this annotation

GitHub Actions / Lint

12:15 [new-line-at-end-of-file] no new line character at the end of file
14 changes: 14 additions & 0 deletions dependencies/debian-based.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
- name: Update apt cache.

Check warning on line 1 in dependencies/debian-based.yml

View workflow job for this annotation

GitHub Actions / Lint

1:1 [document-start] missing document start "---"
ansible.builtin.apt:
update_cache: true
cache_valid_time: 600
become: true

- name: Install dependencies.
ansible.builtin.package:
name:
- build-essential
- gfortran
- automake
state: present
become: true

Check failure on line 14 in dependencies/debian-based.yml

View workflow job for this annotation

GitHub Actions / Lint

14:15 [new-line-at-end-of-file] no new line character at the end of file
15 changes: 15 additions & 0 deletions dependencies/rhel-based.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
- name: Update dnf cache.

Check warning on line 1 in dependencies/rhel-based.yml

View workflow job for this annotation

GitHub Actions / Lint

1:1 [document-start] missing document start "---"
ansible.builtin.dnf:
update_cache: true
become: true

- name: Install dependencies.
ansible.builtin.package:
name:
- '@Development Tools'
- gcc-gfortran
# Fedora, at least Fedora Server, doesn't install this

Check failure on line 11 in dependencies/rhel-based.yml

View workflow job for this annotation

GitHub Actions / Lint

11:61 [trailing-spaces] trailing spaces
# with the Development Tools group for some reason
- gcc-g++
state: present
become: true

Check failure on line 15 in dependencies/rhel-based.yml

View workflow job for this annotation

GitHub Actions / Lint

15:15 [new-line-at-end-of-file] no new line character at the end of file
30 changes: 30 additions & 0 deletions firewall/configure-firewall.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
- name: Creating new custom firewall zone.

Check warning on line 1 in firewall/configure-firewall.yml

View workflow job for this annotation

GitHub Actions / Lint

1:1 [document-start] missing document start "---"
ansible.posix.firewalld:
zone: top500
permanent: true
state: present
become: true

- name: Setting custom firewall zone to accept connections.
ansible.posix.firewalld:
zone: top500
target: ACCEPT
state: enabled
permanent: true
become: true

- name: Adding nodes as trusted sources in the firewall.
ansible.posix.firewalld:
source: "{{ item }}"
zone: top500
state: enabled
permanent: true
loop: "{{ host_ips }}"
when: item != ansible_default_ipv4.address
become: true

- name: Restarting firewall for changes to take effect.
ansible.builtin.service:
name: firewalld
state: restarted
become: true

Check failure on line 30 in firewall/configure-firewall.yml

View workflow job for this annotation

GitHub Actions / Lint

30:15 [new-line-at-end-of-file] no new line character at the end of file
20 changes: 20 additions & 0 deletions firewall/reset-firewall.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Remove our custom firewall zone since we don't need it anymore
- name: Reverting firewall back to its original state.

Check warning on line 2 in firewall/reset-firewall.yml

View workflow job for this annotation

GitHub Actions / Lint

2:1 [document-start] missing document start "---"
ansible.posix.firewalld:
zone: top500
state: absent
permanent: true
become: true

- name: Restarting firewall for changes to take effect.
ansible.builtin.service:
name: firewalld
state: restarted
become: true

# When removing a custom firewall zone, a .xml.old file will sometimes remain
- name: Cleaning up firewall rules.
ansible.builtin.file:
path: /etc/firewalld/zones/top500.xml.old
state: absent
become: true

Check failure on line 20 in firewall/reset-firewall.yml

View workflow job for this annotation

GitHub Actions / Lint

20:15 [new-line-at-end-of-file] no new line character at the end of file
27 changes: 14 additions & 13 deletions main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,14 @@
vars_files: ['config.yml']

tasks:
- name: Update apt cache.
ansible.builtin.apt:
update_cache: true
cache_valid_time: 600
- include_tasks: dependencies/rhel-based.yml
when: ansible_os_family == 'RedHat'

- include_tasks: dependencies/debian-based.yml
when: ansible_os_family == 'Debian'
become: true

- name: Install dependencies.
ansible.builtin.package:
name:
- build-essential
- gfortran
- automake
state: present
become: true
- include_tasks: dependencies/arch-based.yml
when: ansible_os_family == 'Archlinux'

- name: Create required temporary directories.
ansible.builtin.file:
Expand Down Expand Up @@ -210,12 +203,20 @@
dest: "{{ hpl_root }}/tmp/hpl-2.3/bin/rpi/HPL.dat"
mode: 0644

# If this is not done, the nodes will fail to connect to each other
# causing the playbook to hang at 'Run the benchmark.'
- include_tasks: firewall/configure-firewall.yml
when: ansible_os_family == "RedHat"

- name: Run the benchmark.
ansible.builtin.command: mpirun -f cluster-hosts ./xhpl
args:
chdir: "{{ hpl_root }}/tmp/hpl-2.3/bin/rpi"
register: mpirun_output
run_once: true

- include_tasks: firewall/reset-firewall.yml
when: ansible_os_family == "RedHat"

- name: Output the results.
debug: var=mpirun_output.stdout

0 comments on commit 1263eff

Please sign in to comment.