Ejemplo n.º 1
0
def unit_test():
	for i in range(0, 20):
		job = Job(nmaps=64, lmap=140, lmapapprox=60, nreds=1, lred=15, submit=i*150)
		job.approxAlgoMapVal = options.approx # Approximate 50% of the maps
		if random.random() < 0.5:
			job.priority = Job.Priority.VERY_HIGH
		jobId = simulator.addJob(job)
	
	for jobID in simulator.jobsQueue:
		myjob = simulator.jobs[jobID]
		print myjob.jobId, myjob.priority, myjob.submit

	sys.exit(0)
Ejemplo n.º 2
0
	def read(self, inFile):
		#lineno=0
		with open(inFile, "r") as f:
			for line in f:
				line = line.replace('\n', '')
				line = line.strip()
				if not line.startswith('#') and len(line) > 0:
					# Job(nmaps=64, lmap=140, lmapapprox=60, nreds=1, lred=15, submit=i*150, approx)
					splits = line.split()
					nmaps0 =      int(splits[0])
					lmap0 =       int(splits[1])
					lmapapprox0 = int(splits[2])
					nreds0 =      int(splits[3])
					lred0 =       int(splits[4])
					#lredapprox0 = int(splits[4]) # TODO cheng
					submit0 =     int(splits[5])
					approx0 =   float(splits[6])
					# Create job
					job = Job(nmaps=nmaps0, lmap=lmap0, lmapapprox=lmapapprox0, nreds=nreds0, lred=lred0, submit=submit0)
					job.approxAlgoMapVal = approx0 
					self.jobQueue.append(job)
					#lineno+=1
		#return lineno
		return self.jobQueue
Ejemplo n.º 3
0
				job.priority=getProbBySchedule(weights, job.nreds)
			else:
				job.priority=getProbabilisticSJF(job.nreds, options.sjf)
			simulator.addJob(job)
		'''
		manager.initManager(options.infile)
		if options.sjf > 0.0:
			manager.applySJFPriority(options.sjf)
		manager.copyToSimulator(simulator);
		'''
	else:
		# Submit jobs
		for i in range(0, options.jobs):
			# Create the job
			job = Job(nmaps=64, lmap=140, lmapapprox=60, nreds=1, lred=15, submit=0)
			job.approxAlgoMapVal = options.approx # Approximate X% of the maps
			job.approxDropMapVal = options.drop   # Drop X% of the maps
			job.gauss = options.gauss # +/-%
			# Probabilistic shortest job first policy 
			job.priority = getProbabilisticSJF(job.nreds, options.sjf)
			jobId = simulator.addJob(job)
	
	# Start running simulator
	simulator.run()
	
	# Summary
	print 'Nodes:   %d'  %      len(simulator.nodes)
	print 'Energy:  %.1fWh'  % (simulator.getEnergy())
	print 'Perf:    %.1fs %d jobs' % (simulator.getPerformance(), len(simulator.jobs))
	print 'Quality: %.1f%%' % (simulator.getQuality())