def run_second(self, root): info('run_second()') db = StorageFilesystem(root, compress=True) cc = Context(db=db) # cc.comp_dynamic(f2, job_id='f') cc.batch_command('clean;make recurse=1')
def run_first(self, root): db = StorageFilesystem(root, compress=True) cc = Context(db=db) # cc.comp(g, job_id='g') cc.comp(h, job_id='h') cc.batch_command('make')
def run_first(self, root): print('run_first()') db = StorageFilesystem(root, compress=True) cc = Context(db=db) # cc.comp_dynamic(e1, job_id='e') cc.batch_command('make recurse=1; ls')
def run_second(self, root): print('run_second()') db = StorageFilesystem(root, compress=True) cc = Context(db=db) # cc.comp_dynamic(e2, job_id='e') cc.batch_command('details e;clean;ls;make recurse=1')
def main(): print('This is an example of how to use the "progress" function.') from compmake import Context c = Context() c.comp(mylongfunction) # Run command passed on command line or otherwise run console. cmds = sys.argv[1:] if cmds: c.batch_command(' '.join(cmds)) else: print('Use "make recurse=1" or "parmake recurse=1" to make all.') c.compmake_console()
def main(): from compmake import Context c = Context() for param1 in [1, 2, 3]: for param2 in [10, 11, 12]: res1 = c.comp(func1, param1) res2 = c.comp(func2, res1, param2) c.comp(draw, res2) # Run command passed on command line or otherwise run console. cmds = sys.argv[1:] if cmds: c.batch_command(' '.join(cmds)) else: print('Use "make recurse=1" or "parmake recurse=1" to make all.') c.compmake_console()
print('draw(%s)' % res2) if __name__ == '__main__': from compmake import Context context = Context() # A typical pattern: you want to try # many combinations of parameters for param1 in [1,2,3]: for param2 in [10,11,12]: # Simply use "y = comp(f, x)" whenever # you would have used "y = f(x)". res1 = context.comp(funcA, param1) # You can use return values as well. res2 = context.comp(funcB, res1, param2) context.comp(draw, res2) # Now, a few options to run this: # 1) Call this file using the compmake program: # $ python example.py # and then run "make" at the prompt. # 2) Give the command on the command line: # $ python example.py "make" import sys if len(sys.argv) == 1: print('Presenting an interactive console') context.compmake_console() else: print('Running the computation in batch mode') cmd = " ".join(sys.argv[1:]) context.batch_command(cmd)
from compmake import Context c = Context() branch = 10 print('We will now define a hierarchy of %d x %d x %d = %d jobs.' % (branch, branch, branch, branch * branch * branch)) print('Each can fail randomly with probability %f.' % failure_prob) # args = sys.argv[1:] # if args: # branch = int(args.pop(0)) for i in range(branch): ijobs = [] for j in range(branch): kjobs = [] for k in range(branch): kjobs.append(c.comp(third, job_id='%d-%d-%d' % (i, j, k))) ijobs.append(c.comp(second, kjobs, job_id='%d-%d' % (i, j))) c.comp(first, ijobs, job_id='%d' % i) # Run command passed on command line or otherwise run console. import sys cmds = sys.argv[1:] if cmds: c.batch_command(' '.join(cmds)) else: print('Use "make recurse=1" or "parmake" to make all.') c.compmake_console()
def f(x): print('processing %s' % x) if __name__ == '__main__': from compmake import Context c = Context() for p in [42, 43, 44]: c.comp(f, x=p) c.batch_command('clean;parmake')
if __name__ == '__main__': from compmake import Context context = Context() # A typical pattern: you want to try # many combinations of parameters for param1 in [1, 2, 3]: for param2 in [10, 11, 12]: # Simply use "y = comp(f, x)" whenever # you would have used "y = f(x)". res1 = context.comp(funcA, param1) # You can use return values as well. res2 = context.comp(funcB, res1, param2) context.comp(draw, res2) # Now, a few options to run this: # 1) Call this file using the compmake program: # $ python example.py # and then run "make" at the prompt. # 2) Give the command on the command line: # $ python example.py "make" import sys if len(sys.argv) == 1: print('Presenting an interactive console') context.compmake_console() else: print('Running the computation in batch mode') cmd = " ".join(sys.argv[1:]) context.batch_command(cmd)
def f(x): print('f(x=%r)' % x) return x * 2 def schedule(context, params): print('schedule(context, params=%s)' % params.__repr__()) for p in [42, 43, 44]: context.comp(f, x=p) if __name__ == '__main__': from compmake import Context c = Context() c.comp_dynamic(schedule, params=[42, 43, 44]) c.batch_command('clean;parmake echo=1 recurse=1')
from images_read_write import rgb_write from instancing import reduce_list_as_tree from process import average, process_one import os from process import process_cat if __name__ == '__main__': # Get the full path to the dataset dataset = '101_ObjectCategories' output = 'out' from compmake import Context context = Context() cats = list_categories(dataset) for category, path in cats.items(): out = os.path.join(output, '%s.jpg' % category) context.comp(process_cat, path, out, job_id=category) import sys cmds = sys.argv[1:] if cmds: context.batch_command(" ".join(cmds)) else: context.compmake_console()