Merge commit 'd87691ec603db325d5b1c5db1186295a748df7cc' as 'subtree/rabit'
This commit is contained in:
22
subtree/rabit/guide/broadcast.py
Executable file
22
subtree/rabit/guide/broadcast.py
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/python
|
||||
"""
|
||||
demo python script of rabit
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
# add path to wrapper
|
||||
# for normal run without tracker script, add following line
|
||||
# sys.path.append(os.path.dirname(__file__) + '/../wrapper')
|
||||
import rabit
|
||||
|
||||
rabit.init()
|
||||
n = 3
|
||||
rank = rabit.get_rank()
|
||||
s = None
|
||||
if rank == 0:
|
||||
s = {'hello world':100, 2:3}
|
||||
print '@node[%d] before-broadcast: s=\"%s\"' % (rank, str(s))
|
||||
s = rabit.broadcast(s, 0)
|
||||
|
||||
print '@node[%d] after-broadcast: s=\"%s\"' % (rank, str(s))
|
||||
rabit.finalize()
|
||||
Reference in New Issue
Block a user