diff --git a/README.md b/README.md index c634618..efad23b 100644 --- a/README.md +++ b/README.md @@ -3,15 +3,8 @@ Hacky solution to integrate AMDGPU power/clock control into `tuned` profiles with Ansible. -Extends existing profiles, such as: - -- `balanced` -- `desktop` -- `latency-performance` -- `network-latency` -- `powersave`, and so on - -Creating three variations of each, using the [AMDGPU hwmon interfaces](https://docs.kernel.org/gpu/amdgpu/thermal.html): +Provides three variations of the `tuned` profiles found in `/usr/lib/tuned` +using the [AMDGPU hwmon interfaces](https://docs.kernel.org/gpu/amdgpu/thermal.html): - `default`: the out-of-the-box configuration - `overclock`: the optimized card configuration. Includes all of the clock/voltage/power settings @@ -71,6 +64,5 @@ These are the variables you'll want to change/consider. | gpu_clock_max | Sets the max (dynamic) GPU clock (in `MHz`) for the non-default `amdgpu` profiles | | gpumem_clock_static | Sets the _static_ memory clock for the GPU (in `MHz`). This is *not* the _effective_ data rate. _That_ would be a multiple of _this_ depending on the type of VRAM.

To avoid flickering this is *not* allowed to change with load, only between `default` and `overclock`/`peak` profiles. | | gpu_mv_offset | GPU core voltage offset. Takes +/- some integer in millivolts. Can be used to both over _and_ under volt. eg: `-50` _(undervolt `50mV` or `0.05V`)_ | -| base_profiles | List of base tuned profiles to clone in the new AMDGPU profiles. Defaults based on `Fedora` | | gpu_power_multi_def | Float between `0.0` and `1.0`; controls power limit relative to the board _capability_. For _'default'_-named power profiles. | | gpu_power_multi_oc | Similar to `gpu_power_multi_def`, for _'overclock'_-named power profiles. | diff --git a/playbook.yml b/playbook.yml index ca760bd..ee027b6 100644 --- a/playbook.yml +++ b/playbook.yml @@ -1,16 +1,7 @@ --- -- hosts: localhost - name: "Configure 'tuned' with AMD GPU control" +- name: "Configure 'tuned' with AMD GPU control" + hosts: localhost roles: # role prepares/modifies 'tuned' with AMD GPU power/clock parameters # creates a new tuned profile made for each permutation of (base) 'tuned' profile + AMD powerplay profile - role: tuned_amdgpu - # list of source tuned profiles available on Fedora (TODO: should dynamically discover) - base_profiles: - - balanced - - desktop - - latency-performance - - network-latency - - network-throughput - - powersave - - virtual-host diff --git a/roles/tuned_amdgpu/tasks/main.yml b/roles/tuned_amdgpu/tasks/main.yml index 81f450b..fa1fc5c 100644 --- a/roles/tuned_amdgpu/tasks/main.yml +++ b/roles/tuned_amdgpu/tasks/main.yml @@ -27,6 +27,24 @@ state: present become: true +- name: Find bundled 'tuned' profiles + ansible.builtin.find: + paths: + - /usr/lib/tuned/ # this may change/benefit from var/defaults; packaging should generally prefer this path + patterns: + - 'tuned.conf' + recurse: true + register: tuned_bundled_configs + +- name: Set fact with included profile names + ansible.builtin.set_fact: + base_profiles: "{{ base_profiles | default([]) + profile_name }}" + loop: "{{ tuned_bundled_configs.files }}" + loop_control: + label: "{{ profile_name }}" + vars: + profile_name: "{{ [item.path | dirname | basename] }}" + - name: Ensure dynamic tuning is disabled ansible.builtin.lineinfile: path: /etc/tuned/tuned-main.conf