示例#1
0
import argparse
import time
import multiprocessing
import graphmix


def arrive_and_leave():
    for i in range(4):
        comm = graphmix.Client(graphmix.default_server_port + i)


def test(args):
    arrive_and_leave()
    comm = graphmix.Client(graphmix.default_server_port)
    query = comm.pull_graph()
    graph = comm.wait(query)
    print("CHECK OK")


def server_init(server):
    server.add_sampler(graphmix.sampler.LocalNode, batch_size=128)
    server.is_ready()
    time.sleep(1)


if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument("--config", default="../config/stand_alone.yml")
    args = parser.parse_args()
    graphmix.launcher(test, args, server_init=server_init)
示例#2
0
    server.init_cache(1, graphmix.cache.LFUOpt)
    server.add_sampler(graphmix.sampler.GraphSage,
                       batch_size=int(batch_size * label_rate),
                       depth=2,
                       width=5,
                       thread=4,
                       index=-1,
                       tag="G")
    server.add_sampler(graphmix.sampler.RandomWalk,
                       rw_head=int(batch_size / 3),
                       rw_length=2,
                       thread=4,
                       tag="R")
    server.add_sampler(graphmix.sampler.LocalNode,
                       batch_size=batch_size,
                       thread=4,
                       tag="L")
    server.is_ready()


if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument("config")
    parser.add_argument("--num_epoch", default=100, type=int)
    parser.add_argument("--hidden", default=256, type=int)
    parser.add_argument("--batch_size", default=1000, type=int)
    parser.add_argument("--rerun", default=5, type=int)
    parser.add_argument("--lr", default=1e-3, type=float)
    args = parser.parse_args()
    graphmix.launcher(worker_main, args, server_init=server_init)