diff --git a/fabfile.py b/fabfile.py index c171bb8cf57c4ceb0581e9da64c25a04bc49717f..2ef6ff397e4d371a8f474c36f6493341b981082a 100644 --- a/fabfile.py +++ b/fabfile.py @@ -35,6 +35,8 @@ def cloc(not_match, *args, **kwargs): @task @hosts('rschoene@141.76.65.177') def dl(name, rdir = '~/git/racr-mquat/'): + """ Download a single file from the remote host. + Arguments: name, [absolute-remote-directory] """ #run('uname -a') target = os.path.join(rdir, name) print target diff --git a/ilp_measurement.py b/ilp_measurement.py index 6a99f85ea7391be9b196b84111c715d92ed5ac58..f9d55c563f00b6719cfff504af40202a5b2012d0 100644 --- a/ilp_measurement.py +++ b/ilp_measurement.py @@ -104,15 +104,24 @@ def dstat_log(directory): return 'profiling/{}/dstat.log'.format(directory) def dirname(d): return os.path.split(os.path.dirname(d))[-1] +@task +def prepare_dstat(f): + newFile = f.replace('.log', '.csv') + schema = ['time'] + [cpu+t for t in ("usr","sys","idl","wai","hiq","siq") for cpu in ("total","cpu0","cpu1","cpu2","cpu3")] + \ + ["1m","5m","15m","used","buff","cach","free","read","writ"] + with open(newFile, 'w') as fd: + fd.write(",".join(schema)) + local_quiet('grep -Ev ^\\" {0} >> {1}'.format(f,newFile)) + @task(name = 'sol') -def sol(number = 1, solver = 'glpsol', pathname = '*', skip_conflate = False): +def sol(number = 1, solver = 'glpsol', pathname = '*', skip_conflate = False, timeout = 40): """ Run solver n times (default: once) """ - do_sol(solver, int(number), pathname, skip_conflate) + do_sol(solver, int(number), pathname, skip_conflate, int(timeout)) -params = { 'glpsol' : ['glpsol --tmlim 40 --lp {lp} -w {sol}', 'INTEGER OPTIMAL SOLUTION FOUND', 'Time used:[\s]*(.*?) secs', '(\d+) rows, (\d+) columns, (\d+) non-zeros'], +params = { 'glpsol' : ['glpsol --tmlim {timeout} --lp {lp} -w {sol}', 'INTEGER OPTIMAL SOLUTION FOUND', 'Time used:[\s]*(.*?) secs', '(\d+) rows, (\d+) columns, (\d+) non-zeros'], 'gurobi' : ['gurobi_cl ResultFile={sol} {lp}', 'Optimal solution found', 'in (.*?) seconds', 'Optimize a model with (\d+) rows, (\d+) columns and (\d+) nonzeros']} -def do_sol(solver, number, pathname, skip_conflate): +def do_sol(solver, number, pathname, skip_conflate, timeout): assertTrue = utils.assertTrueContinue old_cd = os.getcwd() dirs = glob('profiling/{0}/'.format(pathname)) @@ -142,7 +151,7 @@ def do_sol(solver, number, pathname, skip_conflate): if not ilp.endswith('.lp'): continue start = timeit.default_timer() - out = local_quiet(params[solver][0].format(lp = ilp, sol = ilp.replace('lp','sol'))) + out = local_quiet(params[solver][0].format(lp = ilp, sol = ilp.replace('lp','sol'), timeout = timeout)) stop = timeit.default_timer() today = datetime.today() if re.search(params[solver][1], out):