summaryrefslogtreecommitdiffstats
path: root/rteval
diff options
context:
space:
mode:
authorClark Williams <williams@redhat.com>2010-07-16 14:47:45 -0500
committerClark Williams <williams@redhat.com>2010-07-16 14:47:45 -0500
commitfae41da52a50423e65f36729a56afeb4835eaf6c (patch)
tree2e077183bb228bc06bd5deaaf04107751dec1956 /rteval
parentb7a8ab623798031a25a37cedea3b04e10c571538 (diff)
downloadrteval-fae41da52a50423e65f36729a56afeb4835eaf6c.tar.gz
rteval-fae41da52a50423e65f36729a56afeb4835eaf6c.tar.xz
rteval-fae41da52a50423e65f36729a56afeb4835eaf6c.zip
added load logic to adjust load based on memory/core ratio
Added logic to loads.py, hackbench.py and kcompile.py that adjusts the number of jobs run based on the gigabytes per core ratio. If the ratio is less than 1, then only do one job per core, else do two jobs per core. Signed-off-by: Clark Williams <williams@redhat.com>
Diffstat (limited to 'rteval')
-rw-r--r--rteval/hackbench.py14
-rw-r--r--rteval/kcompile.py18
-rw-r--r--rteval/load.py1
3 files changed, 28 insertions, 5 deletions
diff --git a/rteval/hackbench.py b/rteval/hackbench.py
index 6f72b73..b0e80f6 100644
--- a/rteval/hackbench.py
+++ b/rteval/hackbench.py
@@ -47,7 +47,19 @@ class Hackbench(load.Load):
def setup(self):
'calculate arguments based on input parameters'
- mult = int(self.params.setdefault('jobspercore', 2))
+ mem = self.memsize[0]
+ if self.memsize[1] == 'KB':
+ mem = mem / (1024.0 * 1024.0)
+ elif self.memsize[1] == 'MB':
+ mem = mem / 1024.0
+ elif self.memsize[1] == 'TB':
+ mem = mem * 1024
+ ratio = float(mem) / float(self.num_cpus)
+ if ratio >= 1.0:
+ mult = int(self.params.setdefault('jobspercore', 2))
+ else:
+ self.debug("low memory system (%f GB/core)! Dropping jobs to one-per-core\n" % ratio)
+ mult = 1
self.jobs = self.num_cpus * mult
self.datasize = self.params.setdefault('datasize', '128')
self.workunit = self.params.setdefault('workunit', 'thread')
diff --git a/rteval/kcompile.py b/rteval/kcompile.py
index 622e992..7b2cbb3 100644
--- a/rteval/kcompile.py
+++ b/rteval/kcompile.py
@@ -110,10 +110,20 @@ class Kcompile(load.Load):
err = self.open_logfile("kcompile.stderr")
else:
out = err = null
- mult=1
- if self.params.has_key('jobspercore'):
- mult = int(self.params.jobspercore)
- njobs = self.num_cpus * mult
+ mult = self.params.setdefault('jobspercore', 1)
+ mem = self.memsize[0]
+ if self.memsize[1] == 'KB':
+ mem = mem / (1024.0 * 1024.0)
+ elif self.memsize[1] == 'MB':
+ mem = mem / 1024.0
+ elif self.memsize[1] == 'TB':
+ mem = mem * 1024
+ ratio = float(mem) / float(self.num_cpus)
+ if ratio > 1.0:
+ njobs = self.num_cpus * mult
+ else:
+ self.debug("low memory system (%f GB/core)! Dropping jobs to one per core\n" % ratio)
+ njobs = self.num_cpus
self.debug("starting loop (jobs: %d)" % njobs)
self.args = ["make", "-C", self.mydir,
"-j%d" % njobs,
diff --git a/rteval/load.py b/rteval/load.py
index 9355c06..4bf0dfb 100644
--- a/rteval/load.py
+++ b/rteval/load.py
@@ -40,6 +40,7 @@ class Load(threading.Thread):
self.source = params.setdefault('source', None)
self.reportdir = params.setdefault('reportdir', os.getcwd())
self.logging = params.setdefault('logging', False)
+ self.memsize = params.setdefault('memsize', (0, 'GB'))
self.params = params
self.ready = False
self.mydir = None