def main(addrs): parser = profile.add_args() parser.add_argument('genomes', nargs='+') args = parser.parse_args() prof_name, prof = profile.get_from_args(args) cli = RenderClient(addrs['tasks_loprio'], addrs['responses']) gen = iter_genomes(prof, 'out/%s' % prof_name, args.genomes) try: for task in gen: rq = cli.put(task) print ' >', task.id spawn(get_result, cli, task, rq) except KeyboardInterrupt: print 'Interrupt received, flushing' while cli.taskmap: for k, v in cli.taskmap.items(): if not v.getters: cli.taskmap.pop(k) print 'Still waiting on %d tasks...' % len(cli.taskmap) gevent.sleep(3)
def main(addrs): parser = profile.add_args() parser.add_argument("genomes", nargs="+") args = parser.parse_args() prof_name, prof = profile.get_from_args(args) cli = RenderClient(addrs["tasks_loprio"], addrs["responses"]) gen = iter_genomes(prof, "out/%s" % prof_name, args.genomes) try: for task in gen: rq = cli.put(task) print " >", task.id spawn(get_result, cli, task, rq) except KeyboardInterrupt: print "Interrupt received, flushing" while cli.taskmap: for k, v in cli.taskmap.items(): if not v.getters: cli.taskmap.pop(k) print "Still waiting on %d tasks..." % len(cli.taskmap) gevent.sleep(3)
def main(addrs): parser = profile.add_args() parser.add_argument('genomes', nargs='+') args = parser.parse_args() prof_name, prof = profile.get_from_args(args) cli = RenderClient(addrs['tasks_loprio'], addrs['responses']) gen = iter_genomes(prof, 'out/%s' % prof_name, args.genomes) try: for task in gen: rq = cli.put(task) print ' >', task.id spawn(get_result, cli, task, rq) gevent.sleep(0) except KeyboardInterrupt: print 'Interrupt received, flushing' while cli.taskmap: for k, v in cli.taskmap.items(): if not v.getters: cli.taskmap.pop(k) print 'Still waiting on %d tasks...' % len(cli.taskmap) gevent.sleep(3)
parser.add_argument('flame', metavar='ID', type=str, help="Filename or flame ID of genome to render") parser.add_argument('-g', action='store_true', dest='gfx', help="Show output in OpenGL window") parser.add_argument('-n', metavar='NAME', type=str, dest='name', help="Prefix to use when saving files (default is basename of input)") parser.add_argument('--suffix', metavar='NAME', type=str, dest='suffix', help="Suffix to use when saving files (default '')", default='') parser.add_argument('-o', metavar='DIR', type=str, dest='dir', help="Output directory", default='.') parser.add_argument('--resume', action='store_true', dest='resume', help="Don't overwrite output files that are newer than the input") parser.add_argument('--pause', action='store_true', help="Don't close the preview window after rendering is finished") parser.add_argument('-d', '--genomedb', metavar='PATH', type=str, help="Path to genome database (file or directory, default '.')", default='.') parser.add_argument('--subdir', action='store_true', help="Use basename as subdirectory of out dir, instead of prefix") parser.add_argument('--raw', metavar='PATH', type=str, dest='rawfn', help="Target file for raw buffer, to enable previews.") parser.add_argument('--half', action='store_true', help='Use half-loops when converting nodes to animations') parser.add_argument('--print', action='store_true', help="Print the blended animation and exit.") profile.add_args(parser) args = parser.parse_args() pname, prof = profile.get_from_args(args) main(args, prof)
exiting = True map(job_queue.put, [None] * len(worker_group)) worker_group.join() if __name__ == "__main__": parser = argparse.ArgumentParser( description='Render fractal flames on multiple GPUs.') cmd_parser = parser.add_subparsers() dispatch_parser = cmd_parser.add_parser( 'dispatch', help='Dispatch tasks to workers.') dispatch_parser.add_argument('flames', metavar='ID', type=str, nargs='+', #fromfile_prefix_chars='@', help='Flames to render (prefix playlist with @)') dispatch_parser.add_argument('--worker', metavar='ADDRESS', nargs='*', help='Worker address (in the form "host/device_id")') dispatch_parser.add_argument('-d', '--genomedb', metavar='PATH', type=str, help="Path to genome database (file or directory, default '.')", default='.') profile.add_args(dispatch_parser) dispatch_parser.set_defaults(func=dispatch) worker_parser = cmd_parser.add_parser( 'work', help='Perform a task (controlled by a dispatcher).') worker_parser.add_argument('--device', metavar='NUM', type=int, help='GPU device number to use, 0-indexed.') worker_parser.set_defaults(func=work) args = parser.parse_args() args.func(args)
type=str, dest='rawfn', help="Target file for raw buffer, to enable previews.") parser.add_argument( '--half', action='store_true', help='Use half-loops when converting nodes to animations') parser.add_argument('--print', action='store_true', help="Print the blended animation and exit.") parser.add_argument('--list-devices', action='store_true', help="List devices and exit.") parser.add_argument( '--device', metavar='NUM', type=int, help="GPU device number to use (may differ from nvidia-smi).") parser.add_argument('--keep', action='store_true', help="Keep compiled kernels to help with profiling") profile.add_args(parser) args = parser.parse_args() if args.list_devices: list_devices() else: pname, prof = profile.get_from_args(args) main(args, prof)
def _get_profile(self, args=None): args = args or [] return profile.get_from_args(profile.add_args().parse_args(args))