Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweaks from scikit-learn-speed needs #24

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion vbench/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def _copy_benchmark_scripts_and_deps(self):
deps.extend(self.dependencies)

for dep in deps:
cmd = 'cp %s %s' % (dep, self.target_dir)
cmd = 'cp -R %s %s' % (dep, self.target_dir)
print cmd
proc = subprocess.Popen(cmd, shell=True)
proc.wait()
Expand Down
14 changes: 10 additions & 4 deletions vbench/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ class BenchmarkRunner(object):
overwrite : boolean
dependencies : list or None
should be list of modules visible in cwd
time : boolean
whether to measure how much running the benchmarks takes
"""

def __init__(self, benchmarks, repo_path, repo_url,
Expand All @@ -33,7 +35,8 @@ def __init__(self, benchmarks, repo_path, repo_url,
run_option='eod', start_date=None, overwrite=False,
module_dependencies=None,
always_clean=False,
use_blacklist=True):
use_blacklist=True,
time=True):

self.benchmarks = benchmarks
self.checksums = [b.checksum for b in benchmarks]
Expand All @@ -50,14 +53,15 @@ def __init__(self, benchmarks, repo_path, repo_url,
self.use_blacklist = use_blacklist

self.blacklist = set(self.db.get_rev_blacklist())

self.time = time
# where to copy the repo
self.tmp_dir = tmp_dir
self.bench_repo = BenchRepo(repo_url, self.tmp_dir, build_cmd,
preparation_cmd,
always_clean=always_clean,
dependencies=module_dependencies)
self._register_benchmarks()
self._python = os.environ.get('VBENCH_PYTHON', 'python')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even better: default to sys.executable here.


def run(self):
revisions = self._get_revisions_to_run()
Expand Down Expand Up @@ -134,8 +138,10 @@ def _run_revision(self, rev):
pickle.dump(need_to_run, open(pickle_path, 'w'))

# run the process
cmd = 'python vb_run_benchmarks.py %s %s' % (pickle_path, results_path)
print cmd
cmd = '%s vb_run_benchmarks.py %s %s' % (self._python, pickle_path,
results_path)
if self.time:
cmd = 'time ' + cmd
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=True,
Expand Down
5 changes: 4 additions & 1 deletion vbench/scripts/vb_run_benchmarks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys
import traceback
import cPickle as pickle

if len(sys.argv) != 3:
Expand All @@ -12,8 +13,10 @@
for bmk in benchmarks:
try:
res = bmk.run()
results[bmk.checksum] = res
except Exception:
print >> sys.stderr, 'Exception in benchmark %s:' % bmk.name
traceback.print_exc()
continue
results[bmk.checksum] = res

benchmarks = pickle.dump(results, open(out_path, 'w'))