Пример #1
0
def main(args=None):
    parser = argparse.ArgumentParser(
        description="Print a summary of basic SpiNNaker machine "
                    "and BMP information")
    parser.add_argument("--version", "-V", action="version",
                        version="%(prog)s {}".format(rig.__version__))

    parser.add_argument("hostname", type=str,
                        help="hostname or IP of SpiNNaker system or BMP")

    args = parser.parse_args(args)

    # Determine what type of machine this is and print information accordingly
    try:
        mc = MachineController(args.hostname)
        info = mc.get_software_version(255, 255)
        if "SpiNNaker" in info.version_string:
            for line in get_spinnaker_info(mc):
                print(line)
        elif "BMP" in info.version_string:
            bc = BMPController(args.hostname)
            for line in get_bmp_info(bc):
                print(line)
        else:
            sys.stderr.write("{}: error: unknown architecture '{}'\n".format(
                parser.prog, info.version_string))
            return 2
    except TimeoutError:
        sys.stderr.write("{}: error: command timed out\n".format(
            parser.prog))
        return 1

    return 0
Пример #2
0
def main(args=None):
    parser = argparse.ArgumentParser(
        description="Print the contents of IOBUF for a specified core")
    parser.add_argument("--version",
                        "-V",
                        action="version",
                        version="%(prog)s {}".format(rig.__version__))

    parser.add_argument("hostname",
                        type=str,
                        help="hostname or IP of SpiNNaker system")

    parser.add_argument("x", type=int, help="the X coordinate of the chip")
    parser.add_argument("y", type=int, help="the Y coordinate of the chip")
    parser.add_argument("p", type=int, help="the processor number")

    args = parser.parse_args(args)

    try:
        mc = MachineController(args.hostname)
        info = mc.get_software_version(255, 255)
        if "SpiNNaker" in info.version_string:
            sys.stdout.write(mc.get_iobuf(args.p, args.x, args.y))
        else:
            sys.stderr.write("{}: error: unknown architecture '{}'\n".format(
                parser.prog, info.version_string.strip("\x00")))
            return 2
    except TimeoutError:
        sys.stderr.write("{}: error: command timed out\n".format(parser.prog))
        return 1

    return 0
Пример #3
0
def main(args=None):
    parser = argparse.ArgumentParser(
        description="List all applications running on a SpiNNaker machine")
    parser.add_argument("--version",
                        "-V",
                        action="version",
                        version="%(prog)s {}".format(rig.__version__))

    parser.add_argument("hostname",
                        type=str,
                        help="hostname or IP of SpiNNaker system")

    parser.add_argument("x",
                        type=int,
                        nargs="?",
                        help="the X coordinate of the chip to list")
    parser.add_argument("y",
                        type=int,
                        nargs="?",
                        help="the Y coordinate of the chip to list")
    parser.add_argument("p",
                        type=int,
                        nargs="?",
                        help="the core number to list")

    parser.add_argument("--app-id",
                        "-a",
                        type=str,
                        action="append",
                        help="show only applications with an application "
                        "ID matching the supplied regex")
    parser.add_argument("--name",
                        "-n",
                        type=str,
                        action="append",
                        help="list only cores running the application "
                        "whose name matches the supplied regex")
    parser.add_argument("--state",
                        "-s",
                        type=str,
                        action="append",
                        help="list only cores in states matching the "
                        "supplied regex")

    args = parser.parse_args(args)

    if args.x is not None and args.y is None:
        parser.error("both or neither of 'x' and 'y' must be specified")

    try:
        mc = MachineController(args.hostname)
        info = mc.get_software_version(255, 255)
        if "SpiNNaker" in info.version_string:
            print("X   Y   P   State             Application      App ID")
            print("--- --- --- ----------------- ---------------- ------")
            for (x, y, core, state, runtime_exception, application, app_id) \
                    in get_process_list(mc,
                                        args.x, args.y, args.p,
                                        args.app_id, args.name, args.state):
                print("{:3d} {:3d} {:3d} "
                      "{:17s} "
                      "{:16s} "
                      "{:6d} "
                      "{:s}".format(
                          x, y, core, state.name, application, app_id,
                          runtime_exception.name if runtime_exception else ""))
        else:
            sys.stderr.write("{}: error: unknown architecture '{}'\n".format(
                parser.prog, info.version_string.strip("\x00")))
            return 2
    except TimeoutError:
        sys.stderr.write("{}: error: command timed out\n".format(parser.prog))
        return 1

    return 0