From 36e502b79261bd12d639a084a485a491408e2b33 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Wed, 24 Feb 2021 20:40:25 -0800 Subject: [PATCH] Check if intel_pstate exists --- utils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils.py b/utils.py index a8a87999..499ae021 100644 --- a/utils.py +++ b/utils.py @@ -31,9 +31,10 @@ def build_ujit(repo_dir): os.chdir(cwd) def set_bench_config(): - # sudo requires the flag '-S' in order to take input from stdin - subprocess.check_call("sudo -S sh -c 'echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo'", shell=True) - subprocess.check_call("sudo -S sh -c 'echo 100 > /sys/devices/system/cpu/intel_pstate/min_perf_pct'", shell=True) + if os.path.exists('/sys/devices/system/cpu/intel_pstate'): + # sudo requires the flag '-S' in order to take input from stdin + subprocess.check_call("sudo -S sh -c 'echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo'", shell=True) + subprocess.check_call("sudo -S sh -c 'echo 100 > /sys/devices/system/cpu/intel_pstate/min_perf_pct'", shell=True) def get_ruby_version(): ruby_version = subprocess.check_output(["ruby", "-v"])