예제 #1
0
def scan_nested_simulation(root_simulation,nest_simulation):
	names=tree_load_flat_list(root_simulation)
	commands=[]
	for i in range(0,len(names)):
		dest_name=os.path.join(names[i],os.path.basename(nest_simulation))
		copy_scan_dir(dest_name,nest_simulation)

		program_list=[]
		flat_list=[]
		scan_item_load(os.path.join(dest_name,"scan_items.inp"))
		tree_load_program(program_list,dest_name)
		print "call=",names[i],dest_name
		tree_gen(flat_list,program_list,names[i],dest_name)


		server_find_simulations_to_run(commands,dest_name)

	return commands
예제 #2
0
	def simulate(self,run_simulation,generate_simulations):

		base_dir=os.getcwd()
		run=True

		if len(self.liststore_combobox) == 0:
			message = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK)
			message.set_markup(_("You have not selected any parameters to scan through.  Use the add button."))
			message.run()
			message.destroy()
			return


		if self.sim_name=="":
			message = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK)
			message.set_markup(_("No sim dir name"))
			message.run()
			message.destroy()
			return

		self.make_sim_dir()
		if generate_simulations==True:
			scan_clean_dir(self.sim_dir)


		for i in range(0,len(self.liststore_combobox)):
			found=False
			for ii in range(0,len(self.liststore_op_type)):
				if self.liststore_combobox[i][2]==self.liststore_op_type[ii][0]:
					found=True
			if found==False:
				run=False

				md = gtk.MessageDialog(None, 
				0, gtk.MESSAGE_ERROR, 
				gtk.BUTTONS_CLOSE, self.liststore_combobox[i][2]+"Not valid")
				md.run()
				md.destroy()
				break



		if run==True:
			print "Running"
			program_list=[]
			for i in range(0,len(self.liststore_combobox)):
				program_list.append([self.liststore_combobox[i][0],self.liststore_combobox[i][1],self.liststore_combobox[i][2],self.liststore_combobox[i][3]])

			print program_list

			if generate_simulations==True:
				flat_simulation_list=[]
				tree_gen(flat_simulation_list,program_list,base_dir,self.sim_dir)
				print "flat list",flat_simulation_list
				tree_save_flat_list(self.sim_dir,flat_simulation_list)

			commands=[]
			server_find_simulations_to_run(commands,self.sim_dir)

			if run_simulation==True:
				self.send_commands_to_server(commands)

		self.save_combo()
		os.chdir(base_dir)
		gc.collect()
예제 #3
0
def command_args(argc,argv):
	if argc>=2:
		if argv[1]=="--help":
			print "Usage: opvdm [option] src_file dest_file"
			print ""
			print "Options:"
			print "\t--version\tdisplays the current version"
			print "\t--help\t\tdisplays the help"
			print "\t--export\texport a simulation to a gz file"
			print "\t--import\timport a simulation from a .opvdm file"
			print "\t--patch\tpatch an .opvdm file with an older .opvdm file"
			print "\t\t\tusage --import abc.opvdm ./path/to/output/ "
			print "\t--clone\t\tgenerate a clean simulation in the current directory"
			print "\t--clean\t\tcleans the current simulation directory deleting .dat files and scan dirs"
			print "\t--dump-tab (output file)\t\tdumps simulation parameters as jpg"
			print "\t--import-scandirs\t\tOnly imports the scan directories"
			print "\t--clean-scandirs\t\tDeletes the content of all scan dirs"
			print "\t--scan-plot\t\truns an oplot file"
			print "\t\t\tusage --scan-plot /path/to/oplot/file.oplot "
			print "\t--run-scan\t\truns a scan"
			print "\t\t\tusage --run-scan /path/containing/base/files/ /path/to/scan/dir/ "

			print ""
			print "Additional information about opvdm is available at http://www.opvdm.com."
			print ""
			print "Report bugs to: [email protected]"
			sys.exit(0)
		if argv[1]=="--version":
			print ver()
			sys.exit(0)
		if argv[1]=="--import-scandirs":
			import_scan_dirs(os.getcwd(),argv[2])
			exit(0)
		if argv[1]=="--export":
			export_as(argv[2])
			sys.exit(0)
		if argv[1]=="--dump-tab":
			export_as(argv[2])
			sys.exit(0)
		if argv[1]=="--import":
			import_archive(argv[2],os.path.join(os.getcwd(),"sim.opvdm"),False)
			sys.exit(0)
		if argv[1]=="--patch":
			import_archive(argv[2],argv[3],True)
			sys.exit(0)
		if argv[1]=="--clone":
			opvdm_clone()
			sys.exit(0)
		if argv[1]=="--clone-src":
			opvdm_copy_src(argv[2])
			sys.exit(0)

		if argv[1]=="--file_info":
			data=plot_data()
			data.dump_file()
			sys.exit(0)
		if argv[1]=="--clean":
			clean_sim_dir()
			sys.exit(0)
		if argv[1]=="--clean-scandirs":
			clean_scan_dirs(os.getcwd())
			sys.exit(0)

		if argv[1]=="--server":
			obj=udp_server()
			obj.start()

		if argv[1]=="--client":
			client=udp_client()
			client.init()

		if argv[1]=="--make-man":
			make_man()
			sys.exit(0)

		if argv[1]=="--run-scan":
			scan_dir_path=argv[3]	#program file
			program_list=[]
			base_dir=argv[2]				#base dir
			exe_command   =  get_exe_command()
			scan_item_load(os.path.join(scan_dir_path,"scan_items.inp"))
			tree_load_program(program_list,scan_dir_path)

			watch_dir=os.path.join(os.getcwd(),scan_dir_path)
			#print program_list,pwd,scan_dir_path
			#sys.exit(0)
			#print pwd,scan_dir_path
			#print os.getcwd(),os.path.join(scan_dir_path)
			#tree_gen(program_list,os.getcwd(),os.path.join(os.getcwd(),"suns"))
			flat_list=[]
			tree_gen(flat_list,program_list,base_dir,scan_dir_path)
			commands=[]
			server_find_simulations_to_run(commands,scan_dir_path)
			myserver=server()
			myserver.init(watch_dir)
			myserver.clear_cache()
			for i in range(0, len(commands)):
				myserver.add_job(commands[i])
				print "Adding job"+commands[i]
			myserver.simple_run(exe_command)

			sys.exit(0)
		if argv[1]=="--scan-plot":
			plot_token=plot_state()
			oplot_file=argv[2]
			if plot_load_info(plot_token,oplot_file)==True:
				print "file0=",plot_token.file0,"<"
				plot_files, plot_labels, save_file = scan_gen_plot_data(plot_token,os.path.dirname(oplot_file))
				print "written data to",save_file
			else:
				print "Problem loading oplot file"
			sys.exit(0)