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

Removes the unused deterministic and sweep parameters

parent 22dbd4b4
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,7 @@ class CpuBench:
self.time_ref = time_ref
self.nb_processes = 1
def build(self, executor, deterministic):
def build(self, executor):
'Builds the cpu benchmark'
self.nb_processes = executor.nbcores // executor.nbhosts
......@@ -21,16 +21,15 @@ class CpuBench:
executor.local('gcc %s/cpu.c -o /tmp/bin/cpu' % basedir)
ref = int(executor.local('/tmp/bin/cpu --test'))
time_ref = 30
if deterministic:
if self.param_func is None:
params = {'cpu':[(ref//3, self.time_ref),
((2*ref)//3, self.time_ref),
(ref//2, self.time_ref),
(ref*2, self.time_ref)]}
else:
params = {'cpu': [ (res, self.time_ref) for res in self.param_func(ref)]}
if self.param_func is None:
params = {'cpu':[(ref//3, self.time_ref),
((2*ref)//3, self.time_ref),
(ref//2, self.time_ref),
(ref*2, self.time_ref)]}
else:
params = {'cpu':[lambda: ((10*ref)//random.randint(1, 100), self.time_ref)]}
params = {'cpu': [ (res, self.time_ref) for res in self.param_func(ref)]}
return params
def run(self, bench, params, executor):
......
......@@ -10,7 +10,7 @@ class GenericBench:
self.step = step_size
self.remote = "localhost"
def build(self, executor, deterministic):
def build(self, executor):
'Builds the wide coverage benchmark'
if len(executor.hostnames) > 1:
self.remote = executor.hostnames[-1]
......
......@@ -7,14 +7,13 @@ class GpuCpuBench:
def __init__(self):
self.names = {'gpucpu'}
def build(self, executor, deterministic):
def build(self, executor):
basedir = os.path.dirname(os.path.abspath(__file__))
'Builds the gpu benchmark'
executor.local('/usr/local/cuda-10.1/bin/nvcc -arch=sm_70 %s/m.cu -o /tmp/bin/gpu' % basedir)
if deterministic:
params = {'gpucpu':[(r/100) for r in range(75, 126, 50)]}
else:
params = {'gpucpu':[lambda: (random.randint(75, 125)/100)]}
params = {'gpucpu':[(r/100) for r in range(75, 126, 50)]}
return params
def run(self, bench, params, executor):
......
......@@ -7,15 +7,14 @@ class GpuMemBench:
def __init__(self):
self.names = {'gpumem'}
def build(self, executor, deterministic):
def build(self, executor):
'Builds the gpu benchmark'
basedir = os.path.dirname(os.path.abspath(__file__))
executor.local('/usr/local/cuda-10.1/bin/nvcc -arch=sm_70 %s/m.cu -o /tmp/bin/gpu' % basedir)
if deterministic:
params = {'gpumem':[(r/100) for r in range(10, 100, 10)]}
else:
params = {'gpumem':[lambda: (random.randint(10, 100)/100)]}
params = {'gpumem':[(r/100) for r in range(10, 100, 10)]}
return params
def run(self, bench, params, executor):
......
......@@ -13,7 +13,7 @@ class GromacsBench:
self.datasets = params
self.default_steps = default_steps
def build(self, executor, deterministic):
def build(self, executor):
'Install the gromacs benchmark'
if spawn.find_executable('mdrun_mpi') is None:
......
......@@ -9,7 +9,7 @@ The parameter is the number of memory intensive processes started'''
self.names = {'mem'}
self.param_func = param_func
def build(self, executor, deterministic):
def build(self, executor):
'Builds memory benchmark'
nb_processes = executor.nbcores // executor.nbhosts
if 'OAR_NODE_FILE' in os.environ:
......@@ -19,13 +19,12 @@ The parameter is the number of memory intensive processes started'''
executor.local('gcc -DNTIMES=2000 -O %s/mem.c -o /tmp/bin/mem' % basedir)
#params = {'mem':list(range(1,2*nbproc+1))}
#params = {'mem':list(range(1,4))}
if deterministic:
if self.param_func is None:
params = {'mem': [1, nb_processes]}
else:
params = {'mem' : self.param_func(nb_processes)}
if self.param_func is None:
params = {'mem': [1, nb_processes]}
else:
params = {'mem': [lambda: random.randint(1, nb_processes)]}
params = {'mem' : self.param_func(nb_processes)}
return params
def run(self, bench, params, executor):
......
import os
import random
def generate_four(maximum):
'Generates four balanced values which sum is maximum'
middle = random.randint(0, maximum)
left = random.randint(0, middle)
right = random.randint(middle, maximum)
return left, middle-left, right-middle, maximum-right
class MpiBench:
'Complex mpi benchmark'
def __init__(self, params=None):
self.names = {'mpi'}
self.params = {'mpi': params}
def build(self, executor, deterministic):
def build(self, executor):
'Builds the complex mpi benchmark'
basedir = os.path.dirname(os.path.abspath(__file__))
......@@ -28,12 +21,8 @@ class MpiBench:
executor.local('mpicc -DSIZE=8192 %s/mpi_generic.c -o /tmp/bin/mpi_generic' % basedir)
if self.params['mpi'] is None:
if deterministic:
self.params = {'mpi':[(16, 0, 0, 0), (0, 16, 0, 0),
(0, 0, 16, 0), (0, 0, 0, 16), (4, 4, 4, 4)]}
else:
self.params = {'mpi':[lambda: generate_four(16)]}
self.params = {'mpi':[(16, 0, 0, 0), (0, 16, 0, 0),
(0, 0, 16, 0), (0, 0, 0, 16), (4, 4, 4, 4)]}
return self.params
......
......@@ -23,7 +23,7 @@ class NpbBench:
self.names = names
self.params = options
def build(self, executor, deterministic):
def build(self, executor):
basedir = os.path.dirname(os.path.abspath(__file__))
......
......@@ -9,7 +9,7 @@ class PercentageBench:
self.duration = duration
self.values = values
def build(self, executor, deterministic):
def build(self, executor):
'Builds cloud-like benchmark'
self.nb_processes = executor.nbcores // executor.nbhosts
if 'OAR_NODE_FILE' in os.environ:
......
......@@ -6,7 +6,7 @@ class SleepBench:
self.names = {'sleep'}
self.time = default_time
def build(self, executor, deterministic):
def build(self, executor):
'returns the parameters'
return {'sleep':[self.time]}
......
......@@ -87,7 +87,7 @@ class Executor:
class Experiment:
'Store and runs a complete experiments'
params = {}
def __init__(self, name, executor, benchmarks, monitors=[], leverages=[], deterministic=False):
def __init__(self, name, executor, benchmarks, monitors=[], leverages=[]):
self.executor = executor
self.output_file = '%s_%s_%s' %(name, self.executor.hostnames[0], int(time.time()))
......@@ -100,13 +100,13 @@ class Experiment:
leverage.build(self.executor)
self.bench_suites = benchmarks
self.build_benchs(deterministic)
self.build_benchs()
def build_benchs(self, deterministic=False):
def build_benchs(self):
'Builds all the benchmarks'
os.makedirs('/tmp/bin/', exist_ok=True)
for bench_suite in self.bench_suites:
tmp_params = bench_suite.build(self.executor, deterministic)
tmp_params = bench_suite.build(self.executor)
self.params.update(tmp_params)
self.executor.sync('/tmp/bin')
......@@ -197,26 +197,14 @@ def run_experiment(name, benchmarks, leverages=[], monitors=[], sweep=False, tim
executor = Executor()
expe = Experiment(name, executor, benchmarks,
monitors=monitors, leverages=leverages, deterministic=sweep)
if sweep:
for _ in range(times):
for bench in expe.get_all_benchnames():
for param in expe.get_params(bench):
if callable(param):
param = param()
for actions in expe.get_hw_actions():
expe.start_actions(actions)
pattern = expe.monitor_bench(bench, param)
expe.stop_actions(actions, pattern)
else:
while True:
bench = random.choice(list(expe.get_all_benchnames()))
param = random.choice(expe.get_params(bench))
if callable(param):
param = param()
for actions in expe.get_hw_actions():
expe.start_actions(actions)
pattern=expe.monitor_bench(bench, param)
expe.stop_actions(actions, pattern)
monitors=monitors, leverages=leverages)
for _ in range(times):
for bench in expe.get_all_benchnames():
for param in expe.get_params(bench):
if callable(param):
param = param()
for actions in expe.get_hw_actions():
expe.start_actions(actions)
pattern = expe.monitor_bench(bench, param)
expe.stop_actions(actions, pattern)
......@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
setuptools.setup(
name="expetator",
version="0.0.5",
version="0.0.6",
author="Georges Da Costa",
author_email="georges.da-costa@irit.fr",
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