Files
mlpack/fastlib/trunk/script/fx-rpc-run
T

50 lines
1.1 KiB
Python
Executable File

#!/usr/bin/env python
USAGE = """fx-rpc-run: Runs a parallel program using fastexec.
Syntax is similar to both fx-rpc and fx-run. It goes:
fx-rpc-run tag 1,2,4,8 peers.txt ./program --arg1=a,b,c
* tag is the fastexec tag or label
* 1,2,4,8 runs with different numbers of machines
* peers.txt is the IP addresses of machines
* ./program is the executable file
* --arg1=a,b,c means run with arg1=a, arg1=b, arg1=c
"""
import pm
import util
import fxsys
import sys
import os
if len(sys.argv) < 4:
print USAGE
sys.exit(1)
label = sys.argv[1]
n = sys.argv[2]
peers = os.path.abspath(sys.argv[3])
exename = os.path.abspath(sys.argv[4])
arguments = sys.argv[5:]
paramset = pm.paramset_from_args(arguments)
paramset = pm.Combine(
paramset,
pm.Bind(pm.FxRpcCluster(peers), n.split(",")),
pm.Bind(pm.Binfile(), exename),
pm.Bind(pm.Output("fx/output"), fxsys.OUTPUT_FNAME))
print "*** List of runs that will be performed"
paramset.print_all()
print
print "*** Executing (results go in ./fx)"
fxsys.execute_paramset_here(exename, label, paramset)
print
print "*** Finished (results in ./fx)"