def make_pin_command(self): self.sim_flags += " --general/output_dir=%s --general/num_processes=%d" % (self.sub_dir, len(self.machines)) for i in range(0,len(self.machines)): self.sim_flags += " --process_map/process%i=%s" % (i, self.machines[i]) if (self.mode == "pin"): graphite_home = spawn.get_graphite_home() PIN_PATH = "%s/intel64/bin/pinbin" % spawn.get_pin_home(graphite_home) PIN_LIB = "%s/lib/pin_sim" % (graphite_home) self.command = "%s -tool_exit_timeout 1 -mt -t %s %s -- %s" % (PIN_PATH, PIN_LIB, self.sim_flags, self.command) elif (self.mode == "standalone"): self.command = "%s %s" % (self.command, self.sim_flags) self.command += " > %s/output 2>&1" % self.sub_dir
return process_list # pmaster: # print spawn_master.py preamble def pmaster(): return colorstr('[spawn_master.py]', 'BOLD') # main -- if this is used as standalone script if __name__=="__main__": num_procs = int(sys.argv[1]) config_filename = sys.argv[2] command = " ".join(sys.argv[3:]) working_dir = os.getcwd() process_list = load_process_list_from_file(config_filename) procs = spawn_job(process_list[0:num_procs], command, working_dir, spawn.get_graphite_home()) try: sys.exit(wait_job(procs)) except KeyboardInterrupt: msg = colorstr('Keyboard interrupt. Killing simulation', 'RED') print "%s %s" % (pmaster(), msg) sys.exit(kill_job(procs))
return process_list # pmaster: # print spawn_master.py preamble def pmaster(): return colorstr('[spawn_master.py]', 'BOLD') # main -- if this is used as standalone script if __name__ == "__main__": num_procs = int(sys.argv[1]) config_filename = sys.argv[2] command = " ".join(sys.argv[3:]) working_dir = os.getcwd() process_list = load_process_list_from_file(config_filename) procs = spawn_job(process_list[0:num_procs], command, working_dir, spawn.get_graphite_home()) try: sys.exit(wait_job(procs)) except KeyboardInterrupt: msg = colorstr('Keyboard interrupt. Killing simulation', 'RED') print "%s %s" % (pmaster(), msg) sys.exit(kill_job(procs))