File: speed_runner.py

package info (click to toggle)
rabit 0.0~git20200628.74bf00a-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 720 kB
  • sloc: cpp: 5,015; ansic: 710; python: 360; makefile: 306; sh: 136
file content (34 lines) | stat: -rw-r--r-- 1,117 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import os
import argparse
import sys

def main():
  parser = argparse.ArgumentParser(description='TODO')
  parser.add_argument('-ho', '--host_dir', required=True)
  parser.add_argument('-s', '--submit_script', required=True)
  parser.add_argument('-rex', '--rabit_exec', required=True)
  parser.add_argument('-mpi', '--mpi_exec', required=True)
  args = parser.parse_args()

  ndata = [10**4, 10**5, 10**6, 10**7]
  nrepeat = [10**4, 10**3, 10**2, 10]

  machines = [2,4,8,16,31]

  executables = [args.rabit_exec, args.mpi_exec]

  for executable in executables:
    sys.stderr.write('Executable %s' % executable)
    sys.stderr.flush()
    for i, data in enumerate(ndata):
      for machine in machines:
        host_file = os.path.join(args.host_dir, 'hosts%d' % machine)
        cmd = 'python %s %d %s %s %d %d' % (args.submit_script, machine, host_file, executable, data, nrepeat[i])
        sys.stderr.write('data=%d, repeat=%d, machine=%d\n' % (data, nrepeat[i], machine))
        sys.stderr.flush()
        os.system(cmd)
    sys.stderr.write('\n')
    sys.stderr.flush()

if __name__ == "__main__":
  main()