-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[KVStore] New kvstore used by DGL-KE (dmlc#1263)
* new kvstore * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * update * test warning * update * update * udpate * update * update * update * update * small fix * small fix * get group count * update * update * make file * update * use addr * get id * partition book * update * partition * barrier * update * loop count * update * update * update * update * update * update * update * update * update * add mxnet demo * update ip * update * update * update * random * update * update * update * update * update * update * fix lint * fix lint * fix lint
- Loading branch information
Showing
16 changed files
with
815 additions
and
574 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
0 127.0.0.1 50050 | ||
1 127.0.0.1 50051 | ||
2 127.0.0.1 50052 | ||
3 127.0.0.1 50053 | ||
0 172.31.6.94 30050 2 | ||
1 172.31.4.10 30050 2 | ||
2 172.31.11.99 30050 2 | ||
3 172.31.2.252 30050 2 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,57 @@ | ||
# This is a simple MXNet server demo shows how to use DGL distributed kvstore. | ||
import dgl | ||
import os | ||
import argparse | ||
import time | ||
|
||
import dgl | ||
from dgl.contrib import KVServer | ||
|
||
import mxnet as mx | ||
|
||
ndata_g2l = [] | ||
edata_g2l = [] | ||
g2l = [] | ||
g2l.append(mx.nd.array([0,1,0,0,0,0,0,0], dtype='int64')) | ||
g2l.append(mx.nd.array([0,0,0,1,0,0,0,0], dtype='int64')) | ||
g2l.append(mx.nd.array([0,0,0,0,0,1,0,0], dtype='int64')) | ||
g2l.append(mx.nd.array([0,0,0,0,0,0,0,1], dtype='int64')) | ||
|
||
data = [] | ||
data.append(mx.nd.array([[4.,4.,4.],[4.,4.,4.]])) | ||
data.append(mx.nd.array([[3.,3.,3.],[3.,3.,3.]])) | ||
data.append(mx.nd.array([[2.,2.,2.],[2.,2.,2.]])) | ||
data.append(mx.nd.array([[1.,1.,1.],[1.,1.,1.]])) | ||
|
||
|
||
ndata_g2l.append({'ndata':mx.nd.array([0,1,0,0,0,0,0,0], dtype='int64')}) | ||
ndata_g2l.append({'ndata':mx.nd.array([0,0,0,1,0,0,0,0], dtype='int64')}) | ||
ndata_g2l.append({'ndata':mx.nd.array([0,0,0,0,0,1,0,0], dtype='int64')}) | ||
ndata_g2l.append({'ndata':mx.nd.array([0,0,0,0,0,0,0,1], dtype='int64')}) | ||
class ArgParser(argparse.ArgumentParser): | ||
def __init__(self): | ||
super(ArgParser, self).__init__() | ||
|
||
edata_g2l.append({'edata':mx.nd.array([0,1,0,0,0,0,0,0], dtype='int64')}) | ||
edata_g2l.append({'edata':mx.nd.array([0,0,0,1,0,0,0,0], dtype='int64')}) | ||
edata_g2l.append({'edata':mx.nd.array([0,0,0,0,0,1,0,0], dtype='int64')}) | ||
edata_g2l.append({'edata':mx.nd.array([0,0,0,0,0,0,0,1], dtype='int64')}) | ||
self.add_argument('--server_id', type=int, default=0, | ||
help='Unique ID of each server.') | ||
self.add_argument('--ip_config', type=str, default='ip_config.txt', | ||
help='IP configuration file of kvstore.') | ||
self.add_argument('--num_client', type=int, default=1, | ||
help='Total number of client nodes.') | ||
|
||
DATA = [] | ||
DATA.append(mx.nd.array([[4.,4.,4.,],[4.,4.,4.,]])) | ||
DATA.append(mx.nd.array([[3.,3.,3.,],[3.,3.,3.,]])) | ||
DATA.append(mx.nd.array([[2.,2.,2.,],[2.,2.,2.,]])) | ||
DATA.append(mx.nd.array([[1.,1.,1.,],[1.,1.,1.,]])) | ||
|
||
def start_server(args): | ||
|
||
dgl.contrib.start_server( | ||
server_id=args.id, | ||
ip_config='ip_config.txt', | ||
num_client=4, | ||
ndata={'ndata':DATA[args.id]}, | ||
edata={'edata':DATA[args.id]}, | ||
ndata_g2l=ndata_g2l[args.id], | ||
edata_g2l=edata_g2l[args.id]) | ||
"""Start kvstore service | ||
""" | ||
server_namebook = dgl.contrib.read_ip_config(filename=args.ip_config) | ||
|
||
my_server = KVServer(server_id=args.server_id, server_namebook=server_namebook, num_client=args.num_client) | ||
|
||
if __name__ == '__main__': | ||
parser = argparse.ArgumentParser(description='kvstore') | ||
parser.add_argument("--id", type=int, default=0, help="node ID") | ||
args = parser.parse_args() | ||
if my_server.get_id() % my_server.get_group_count() == 0: # master server | ||
my_server.set_global2local(name='entity_embed', global2local=g2l[my_server.get_machine_id()]) | ||
my_server.init_data(name='entity_embed', data_tensor=data[my_server.get_machine_id()]) | ||
else: | ||
time.sleep(3) | ||
my_server.set_global2local(name='entity_embed') | ||
my_server.init_data(name='entity_embed') | ||
|
||
my_server.print() | ||
|
||
my_server.start() | ||
|
||
|
||
if __name__ == '__main__': | ||
args = ArgParser().parse_args() | ||
start_server(args) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
0 127.0.0.1 50050 | ||
1 127.0.0.1 50051 | ||
2 127.0.0.1 50052 | ||
3 127.0.0.1 50053 | ||
0 172.31.6.94 30050 2 | ||
1 172.31.4.10 30050 2 | ||
2 172.31.11.99 30050 2 | ||
3 172.31.2.252 30050 2 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.