Example #1
0
def run_trainer(path, params, pop_id):
    name = "trainer_" + params['name']
    command = "python3 -u phillip/train.py --load " + path
    command += " --dump " + ("lo" if args.local else "ib0")
    command += " --send %d" % args.send

    if args.init:
        command += " --init"

    if pop_id >= 0:
        name += "_%d" % pop_id
        command += " --pop_id %d" % pop_id
        if args.pop_size:
            command += " --pop_size %d" % min(args.pop_size,
                                              params['pop_size'])

    trainer_id = launch(
        args,
        name,
        command,
        gpu=not args.cpu,
        qos='tenenbaum' if args.tenenbaum else None,
        mem=16,
        pids=pids,
    )

    if trainer_id:
        trainer_ids.append(trainer_id)
Example #2
0
def run_agents(path, params, pop_id):
    actors = args.agents or params.get('agents', 1)

    print("Using %d actors" % actors)
    actors_per_enemy = actors // len(agents)

    common_command = "python3 -u phillip/run.py --load " + path
    if args.disk:
        common_command += " --disk 1"
    else:
        common_command += " --dump 1"

    if run_trainer_b:
        if args.local:
            common_command += " --trainer_ip 127.0.0.1"

    if args.local:
        common_command += " --dual_core 0"

    common_command += " --dolphin --exe dolphin-emu-headless"
    common_command += " --zmq 1 --pipe_count 1"
    common_command += " --random_swap"
    # common_command += " --help"
    common_command += " --enemy_dump 1 --enemy_reload 1"

    base_name = "actor_" + params['name']
    if pop_id >= 0:
        base_name += "_%d" % pop_id
        common_command += " --pop_id %d" % pop_id

    for i, enemy_command in enumerate(enemy_commands):
        name = base_name + "_%d" % i

        full_command = common_command + enemy_command

        launch(
            args,
            name,
            full_command,
            log=args.log_agents,
            qos='use-everything' if args.use_everything else None,
            array=actors_per_enemy,
            depends=trainer_depends,
            pids=pids,
        )
Example #3
0
    trainer_ids = []

    for pop_id in pop_ids:
        train_name = common_name
        if pop_id >= 0:
            train_name += "_%d" % pop_id

        command = train_command
        command += " --pop_id %d" % pop_id

        trainer_id = launch(
            args,
            train_name,
            command,
            gpu=not args.cpu,
            qos='tenenbaum' if args.tenenbaum else None,
            mem=16,
            cpus=4,
            pids=pids,
        )

        if trainer_id:
            trainer_ids.append(trainer_id)

    trainer_depends = ':'.join(trainer_ids)


class AgentNamer:
    def __init__(self, name):
        self.name = name
        self.counter = 0