Commit c4795b22 authored by Antoine Kaufmann's avatar Antoine Kaufmann
Browse files

experiments: add --proxy-type switch for --auto-dist

Can now select between sockets (default) or rdma.
parent d58221bd
...@@ -93,6 +93,9 @@ g_dist.add_argument('--dist', dest='runtime', action='store_const', ...@@ -93,6 +93,9 @@ g_dist.add_argument('--dist', dest='runtime', action='store_const',
g_dist.add_argument('--auto-dist', action='store_const', const=True, g_dist.add_argument('--auto-dist', action='store_const', const=True,
default=False, default=False,
help='Automatically distribute non-distributed experiments') help='Automatically distribute non-distributed experiments')
g_dist.add_argument('--proxy-type', metavar='TYPE', type=str,
default='sockets',
help='Proxy type to use (sockets,rdma) for auto distribution')
args = parser.parse_args() args = parser.parse_args()
...@@ -171,7 +174,7 @@ if not args.pickled: ...@@ -171,7 +174,7 @@ if not args.pickled:
for e in experiments: for e in experiments:
if args.auto_dist and not isinstance(e, exp.DistributedExperiment): if args.auto_dist and not isinstance(e, exp.DistributedExperiment):
e = runtime.auto_dist(e, executors) e = runtime.auto_dist(e, executors, args.proxy_type)
# apply filter if any specified # apply filter if any specified
if (args.filter) and (len(args.filter) > 0): if (args.filter) and (len(args.filter) > 0):
match = False match = False
......
...@@ -58,7 +58,7 @@ class DistributedSimpleRuntime(Runtime): ...@@ -58,7 +58,7 @@ class DistributedSimpleRuntime(Runtime):
for run in self.runnable: for run in self.runnable:
asyncio.run(self.do_run(run)) asyncio.run(self.do_run(run))
def auto_dist(e, execs): def auto_dist(e, execs, proxy_type='sockets'):
""" Converts an Experiment into a DistributedExperiment. Assigns network to """ Converts an Experiment into a DistributedExperiment. Assigns network to
executor zero, and then round-robin assignment of hosts to executors, executor zero, and then round-robin assignment of hosts to executors,
while also assigning all nics for a host to the same executor. while also assigning all nics for a host to the same executor.
...@@ -69,6 +69,15 @@ def auto_dist(e, execs): ...@@ -69,6 +69,15 @@ def auto_dist(e, execs):
elif len(execs) > 2: elif len(execs) > 2:
print('Warning: currently auto_dist only uses the first two hosts') print('Warning: currently auto_dist only uses the first two hosts')
if proxy_type == 'sockets':
proxy_listener_c = proxy.SocketsNetProxyListener
proxy_connecter_c = proxy.SocketsNetProxyConnecter
elif proxy_type == 'rdma':
proxy_listener_c = proxy.RDMANetProxyListener
proxy_connecter_c = proxy.RDMANetProxyConnecter
else:
raise RuntimeError('Unknown proxy type specified')
# Create the distributed experiment # Create the distributed experiment
de = exp.DistributedExperiment(e.name, 2) de = exp.DistributedExperiment(e.name, 2)
de.timeout = e.timeout de.timeout = e.timeout
...@@ -77,7 +86,7 @@ def auto_dist(e, execs): ...@@ -77,7 +86,7 @@ def auto_dist(e, execs):
de.metadata = e.metadata.copy() de.metadata = e.metadata.copy()
# create listening proxy on host 0 # create listening proxy on host 0
lp = proxy.RDMANetProxyListener() lp = proxy_listener_c()
lp.name = 'listener' lp.name = 'listener'
de.add_proxy(lp) de.add_proxy(lp)
de.assign_sim_host(lp, 0) de.assign_sim_host(lp, 0)
...@@ -88,7 +97,7 @@ def auto_dist(e, execs): ...@@ -88,7 +97,7 @@ def auto_dist(e, execs):
de.assign_sim_host(net, 0) de.assign_sim_host(net, 0)
# create connecting proxy on host 1 # create connecting proxy on host 1
cp = proxy.RDMANetProxyConnecter(lp) cp = proxy_connecter_c(lp)
cp.name = 'connecter' cp.name = 'connecter'
de.add_proxy(cp) de.add_proxy(cp)
de.assign_sim_host(cp, 1) de.assign_sim_host(cp, 1)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment