refactor/clean up, move to separate templates per profile
This commit is contained in:
parent
5fdc4fe6a2
commit
7c50e771e2
7 changed files with 164 additions and 58 deletions
35
roles/tuned_amdgpu/files/profile-common.sh
Normal file
35
roles/tuned_amdgpu/files/profile-common.sh
Normal file
|
@ -0,0 +1,35 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# 'common' file sourced by other scripts under tuned profile
|
||||
#
|
||||
# dynamically determine the connected GPU using the DRM subsystem
|
||||
CARD=$(/usr/bin/grep -ls ^connected /sys/class/drm/*/status | /usr/bin/grep -o 'card[0-9]' | /usr/bin/sort | /usr/bin/uniq | /usr/bin/sort -h | /usr/bin/tail -1)
|
||||
|
||||
function get_hwmon_dir() {
|
||||
CARD_DIR="/sys/class/drm/${1}/device/"
|
||||
for CANDIDATE in "${CARD_DIR}"/hwmon/hwmon*; do
|
||||
if [[ -f "${CANDIDATE}"/power1_cap ]]; then
|
||||
# found a valid hwmon dir
|
||||
echo "${CANDIDATE}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# determine the hwmon directory
|
||||
HWMON_DIR=$(get_hwmon_dir "${CARD}")
|
||||
|
||||
# read all of the power profiles, used to get the IDs for assignment later
|
||||
PROFILE_MODES=$(< /sys/class/drm/"${CARD}"/device/pp_power_profile_mode)
|
||||
|
||||
# get power capability; later used determine limits
|
||||
read -r -d '' POWER_CAP < "$HWMON_DIR"/power1_cap_max
|
||||
|
||||
# enable THP; profile enables the 'vm.compaction_proactiveness' sysctl
|
||||
# improves allocation latency
|
||||
echo 'always' | tee /sys/kernel/mm/transparent_hugepage/enabled
|
||||
|
||||
# export determinations
|
||||
export CARD
|
||||
export HWMON_DIR
|
||||
export PROFILE_MODES
|
||||
export POWER_CAP
|
Loading…
Add table
Add a link
Reference in a new issue