Skip to content
Snippets Groups Projects
Commit 7718dd83 authored by Georges Da Costa's avatar Georges Da Costa
Browse files

Corrects C0 leverage

parent e6a978e0
No related branches found
No related tags found
No related merge requests found
...@@ -9,26 +9,35 @@ def signal_handler(signal_number, frame): ...@@ -9,26 +9,35 @@ def signal_handler(signal_number, frame):
os.close(fd) os.close(fd)
fd = os.open("/dev/cpu_dma_latency", os.O_RDWR) fd = os.open("/dev/cpu_dma_latency", os.O_RDWR)
os.write(fd, b'\0\0\0\0') os.write(fd, b'\\0\\0\\0\\0')
signal.signal(signal.SIGINT, signal_handler) signal.signal(signal.SIGINT, signal_handler)
signal.pause() signal.pause()
""" """
terminate_script = """#!/bin/bash
ps aux | grep script_nodeepsleep.py | grep sudo | awk '{print $2}' | xargs sudo-g5k kill
"""
class Nodeepsleep: class Nodeepsleep:
'Activates or deactivates CX' 'Activates or deactivates CX'
def __init__(self, modes = {True, False}): def __init__(self, modes = {True, False}):
self.modes = modes self.modes = modes
self.binary = '/tmp/bin/script_nodeepsleep.py' self.binary = '/tmp/bin/script_nodeepsleep.py'
self.terminate = '/tmp/bin/terminate_nodeepsleep.py'
self.cur_mode = False self.cur_mode = False
def build(self, executor): def build(self, executor):
'Builds the software' 'Builds the software'
self.executor = executor self.executor = executor
with open(self.binary, 'w') as out_file: with open(self.binary, 'w') as out_file:
out_file.write(script) out_file.write(source_script)
os.chmod(self.binary, 0o777) os.chmod(self.binary, 0o777)
with open(self.terminate, 'w') as out_file:
out_file.write(terminate_script)
os.chmod(self.terminate, 0o777)
def available_states(self): def available_states(self):
'Returns all the modes' 'Returns all the modes'
return self.modes return self.modes
...@@ -40,8 +49,9 @@ class Nodeepsleep: ...@@ -40,8 +49,9 @@ class Nodeepsleep:
self.executor.hosts(self.binary+' &', root=True) self.executor.hosts(self.binary+' &', root=True)
def stop(self, output_file=None): def stop(self, output_file=None):
'Reverts to the maximum frequency' 'Stops the script'
self.executor.hosts('killall script_nodeepsleep.py', root=True) if self.curr_mode:
self.executor.hosts(self.terminate, root=True)
self.curr_mode = False self.curr_mode = False
def get_state(self): def get_state(self):
......
...@@ -5,7 +5,7 @@ with open("README.md", "r") as fh: ...@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
setuptools.setup( setuptools.setup(
name="expetator", name="expetator",
version="0.2.3", version="0.2.5",
author="Georges Da Costa", author="Georges Da Costa",
author_email="georges.da-costa@irit.fr", author_email="georges.da-costa@irit.fr",
description="A framework for monitoring HPC applications using DVFS", description="A framework for monitoring HPC applications using DVFS",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment