Example #1
0
def _parse_command_line():
    import sys

    argv = sys.argv
    if "--" not in argv:
        return

    parser = _configure_argument_parser()
    args, _ = parser.parse_known_args(argv[argv.index("--") + 1:])

    if args.cycles_resumable_num_chunks is not None:
        if args.cycles_resumable_current_chunk is not None:
            import _cycles
            _cycles.set_resumable_chunk(
                int(args.cycles_resumable_num_chunks),
                int(args.cycles_resumable_current_chunk),
            )
        elif args.cycles_resumable_start_chunk is not None and \
                args.cycles_resumable_end_chunk:
            import _cycles
            _cycles.set_resumable_chunk_range(
                int(args.cycles_resumable_num_chunks),
                int(args.cycles_resumable_start_chunk),
                int(args.cycles_resumable_end_chunk),
            )
    if args.cycles_print_stats:
        import _cycles
        _cycles.enable_print_stats()

    if args.cycles_device:
        import _cycles
        _cycles.set_device_override(args.cycles_device)
Example #2
0
def _parse_command_line():
    import sys

    argv = sys.argv
    if "--" not in argv:
        return

    parser = _configure_argument_parser()
    args, _ = parser.parse_known_args(argv[argv.index("--") + 1:])

    if args.cycles_print_stats:
        import _cycles
        _cycles.enable_print_stats()

    if args.cycles_device:
        import _cycles
        _cycles.set_device_override(args.cycles_device)