Skip to content

Commit

Permalink
added temperature check
Browse files Browse the repository at this point in the history
  • Loading branch information
DiamonDinoia committed Aug 28, 2024
1 parent aded209 commit 2dc0412
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions perftest/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@ def build_args(args):
# clone the repository
run_command('git', ['clone', 'https://github.com/DiamonDinoia/finufft.git'])

def get_cpu_temperature():
try:
# Run the sensors command
output, _ = run_command('sensors', [])
# Parse the output to find the CPU temperature
for line in output.split('\n'):
if 'Core 0' in line:
# Extract the temperature value
temp_str = line.split()[2]
return temp_str
except subprocess.CalledProcessError as e:
print('Error executing sensors command:', e)
return None

all_data = pd.DataFrame()

args = {
Expand Down Expand Up @@ -148,6 +162,9 @@ def plot_stacked_bar_chart(pivot_data, speedup_data, args, figname):
args['--' + 'type'] = type
for upsampfac in upsamp:
args['--upsampfac'] = upsampfac
while (cpu_temp := float(get_cpu_temperature())) > 42.0:
print(f'CPU temperature is {cpu_temp}°C, waiting for it to cool down...')
sleep(30)
if param.thread == 1:
out, _ = run_command('taskset', ['-c', '0', 'build/perftest/perftest'] + build_args(args))
else:
Expand Down

0 comments on commit 2dc0412

Please sign in to comment.