def main():
    
    #input_file = '/home/sharath/Desktop/pyss-read-only/src/5K_sample'
    input_file = '/home/sharath/Desktop/pyss-read-only/src/Tyrone_log'
    num_processors1 = 800
    input_file = open(input_file)
    
    scheduler = LogScheduler(num_processors1)
    #scheduler = EasyBackfillScheduler(num_processors1)

    try:
        print "...." 
        runMetaScheduler(
                num_processors = num_processors1, 
                jobs = _job_inputs_to_jobs(parse_lines(input_file), num_processors1),
                scheduler = scheduler 
            )

        #print "Num of Processors: ", options.num_processors
        #print "Input file: ", options.input_file
        #print "Scheduler:", type(scheduler)
        #print 'Total scheduled jobs:', scheduler.totalScheduledJobs
    finally:
        if input_file is not sys.stdin:
            input_file.close()
    def __init__(self):
	self.start_time = time.time()
	#input_file = '/home/siddharthsahu/Documents/scheduling/scheduling-virtualenv/prediction/prediction_time/files/tyrone_new_log'
	input_file = '/home/siddharthsahu/Documents/scheduling/scheduling-virtualenv/prediction/history_log_creation/history_log.swf'
	self.num_processors = 800
	l = 1
	input_file = open(input_file)
        if l == 1:
	    #scheduler = EasyBackfillScheduler(num_processors1)
	    self.scheduler = LogScheduler(self.num_processors)
        else:
            print "No such scheduler"
            return
	try:
	  #print "...." 
          jobs = _job_inputs_to_jobs(parse_lines(input_file), self.num_processors)
	  self.metaScheduler = MetaScheduler(jobs, self.num_processors, self.scheduler)
          #runMetaScheduler(num_processors, jobs, scheduler, metaScheduler)
          #print "Num of Processors: ", num_processors1
          #print "Input file: ", input_file
          #print "Scheduler:", type(scheduler)
          #print 'Total scheduled jobs:', scheduler.totalScheduledJobs
        finally:
          if input_file is not sys.stdin:
              input_file.close()  
Example #3
0
    def test_basic_easyPredictionBackfill(self):
	    specoptions = {"num_processors":2,"scheduler":{"predictor":{"name":"predictor_from_think_time"},"corrector":{"name":"reqtime"}}}
	    
	    scheduler = EasyPredictionBackfillScheduler(specoptions)
            simulator = run_simulator(
		    no_stats = True,
		    scheduler=scheduler,
		    num_processors=2,
		    jobs = _job_inputs_to_jobs(parse_lines(open(INPUT_FILE_DIR + "/estimation_starvation.swf")),2))
	    
	    if simulator_finish_time(simulator) != 16:
		    raise Exception("Wrong finish time")
	    if get_id_last_job(simulator) != 2:
		    raise Exception("Wrong last job")
	    
	    scheduler = EasyPredictionBackfillScheduler(specoptions)
            simulator = run_simulator(
		    no_stats = True,
		    scheduler=scheduler,
		    num_processors=2,
		    jobs = _job_inputs_to_jobs(parse_lines(open(INPUT_FILE_DIR + "/estimation_tsafrir_exemple.swf")),2))
	    simulator.scheduler.cpu_snapshot._restore_old_slices()
	    if get_jobs_at(simulator, 0) != set([1]) :
		    raise Exception("Wrong scheduling!")
	    
	    scheduler = EasyPredictionBackfillScheduler(specoptions)
            simulator = run_simulator(
		    no_stats = True,
		    scheduler=scheduler,
		    num_processors=2,
		    jobs = _job_inputs_to_jobs(parse_lines(open(INPUT_FILE_DIR + "/overestimation_exemple.swf")),2))
	    
	    if simulator_finish_time(simulator) != 6:
		    raise Exception("Wrong finish time")
	    
	    specoptions["scheduler"]["predictor"]["name"] = "predictor_reqtime"
	    scheduler = EasyPredictionBackfillScheduler(specoptions)
            simulator = run_simulator(
		    no_stats = True,
		    scheduler=scheduler,
		    num_processors=2,
		    jobs = _job_inputs_to_jobs(parse_lines(open(INPUT_FILE_DIR + "/overestimation_exemple.swf")),2))
	    
	    if simulator_finish_time(simulator) != 8:
		    raise Exception("Wrong finish time")
Example #4
0
def main():
    options = parse_options()

    if options.input_file == "-":
        input_file = sys.stdin
    else:
        input_file = open(options.input_file)

    if options.scheduler == "MultiDimenDoubleEasyScheduler" or options.scheduler == "1":
        scheduler = MultiDimenDoubleEasyScheduler(options.num_processors,
                                                  options.num_memory)

    elif options.scheduler == "MultiDimensionResourceBalanceScheduler" or options.scheduler == "2":
        scheduler = MultiDimensionResourceBalanceScheduler(
            options.num_processors, options.num_memory)

    elif options.scheduler == "MultiDimensionResourceBalanceReverseImprovedScheduler" or options.scheduler == "3":
        scheduler = MultiDimensionResourceBalanceReverseImprovedScheduler(
            options.num_processors, options.num_memory)

    elif options.scheduler == "MultiDimensionResourceBalanceTimeScheduler" or options.scheduler == "4":
        scheduler = MultiDimensionResourceBalanceTimeScheduler(
            options.num_processors, options.num_memory)
    else:
        print "No such scheduler"
        return

    try:
        print "...."
        run_simulator(num_processors=options.num_processors,
                      num_memory=options.num_memory,
                      jobs=_job_inputs_to_jobs(parse_lines(input_file),
                                               options.num_processors,
                                               options.num_memory),
                      scheduler=scheduler)

        print "Num of Processors: ", options.num_processors
        print "Input file: ", options.input_file
        print "Scheduler:", type(scheduler)

    finally:
        if input_file is not sys.stdin:
            input_file.close()
def main1():
    print"inside forked process client"
    l = 1
    input_file = '/home/sharath/Desktop/tyrone.swf'
    num_processors1 = 800
    input_file = open(input_file)

    if l == 1:
       scheduler = EasyBackfillScheduler(num_processors1)
         
    else:
        
        return 
    try:
        #print "...." 
        runMetaScheduler(
                num_processors = num_processors1, 
                jobs = _job_inputs_to_jobs(parse_lines(input_file), num_processors1),
                scheduler = scheduler 
            )
    finally:
        if input_file is not sys.stdin:
            input_file.close()
Example #6
0
def parse_and_run_simulator(options):

	if options["input_file"] is None:
		parser.error("missing input file")


	if options["input_file"] == "-":
		input_file = sys.stdin
	else:
		input_file = open(options["input_file"])

	if options["num_processors"] is None:
		input_file = open(options["input_file"])
		for line in input_file:
			if(line.lstrip().startswith(';')):
				if(line.lstrip().startswith('; MaxProcs:')):
					options["num_processors"] = int(line.strip()[11:])
					break
				else:
					continue
			else:
				break

	if options["num_processors"] is None:
		parser.error("missing num processors")

	if options["stats"] is None:
		options["stats"] = False

	if sys.stdout.isatty():# You're running in a real terminal
		options["scheduler"]["progressbar"] = True
	else:# You're being piped or redirected
		options["scheduler"]["progressbar"] = False

	if options["scheduler"] is None:
		parser.error("missing scheduler")

	if options["scheduler"]["name"] is None:
		parser.error("missing scheduler name")



	my_module = options["scheduler"]["name"]
	my_class = module_to_class(my_module)

	#load module(or file)
	package = __import__ ('schedulers', fromlist=[my_module])
	if my_module not in package.__dict__:
		print "No such scheduler (module file not found)."
		return
	if my_class not in package.__dict__[my_module].__dict__:
		print "No such scheduler (class within the module file not found)."
		return
	#load the class
	scheduler_non_instancied = package.__dict__[my_module].__dict__[my_class]

	if my_module in ('maui_scheduler', 'l2r_maui_scheduler', 'online_l2r_maui_scheduler'):
		scheduler = scheduler_non_instancied(options, \
			# weights_list=options["weights"], \
			weights_backfill=options["weights"])
	else:
		scheduler = scheduler_non_instancied(options)

	# scheduler = scheduler_non_instancied(options\
	# 	, weights_list=options["weights"], weights_backfill=options["weights"])


	#if hasattr(scheduler_non_instancied, 'I_NEED_A_PREDICTOR'):

	try:
		# print "...."

		starttime = datetime.today()
		sim = run_simulator(
			num_processors = options["num_processors"],
			jobs = _job_inputs_to_jobs(parse_lines(input_file), options["num_processors"]),
			scheduler = scheduler,
			output_swf = options["output_swf"] if "output_swf" in options else None,
			input_file = options["input_file"],
			no_stats = not(options["stats"]),
			options = options
			)
		end_time = datetime.today() - starttime

		options["terminated_jobs"] = sim.get_terminated_jobs()

		print "\b" * 50

		if options.get("verbose", False):
			print "\n"
			print "Num of Processors: ", options["num_processors"]
			print "Input file: ", options["input_file"]
			print "Scheduler:", type(scheduler)
			print "Elapsed Time:", end_time

	finally:
		if input_file is not sys.stdin:
			input_file.close()

	return end_time
Example #7
0
def main():
    options = parse_options()

    if options.input_file == "-":
        input_file = sys.stdin
    else:
        input_file = open(options.input_file)

    if options.scheduler == "FcfsScheduler" or options.scheduler == "1":
        scheduler = FcfsScheduler(options.num_processors)

    elif options.scheduler == "ConservativeScheduler" or options.scheduler == "2":
        scheduler = ConservativeScheduler(options.num_processors)

    elif options.scheduler == "DoubleConservativeScheduler" or options.scheduler == "3":
        scheduler = DoubleConservativeScheduler(options.num_processors)

    elif options.scheduler == "EasyBackfillScheduler" or options.scheduler == "4":
        scheduler = EasyBackfillScheduler(options.num_processors)

    elif options.scheduler == "DoubleEasyBackfillScheduler" or options.scheduler == "5":
        scheduler = DoubleEasyBackfillScheduler(options.num_processors)

    elif options.scheduler == "GreedyEasyBackfillScheduler" or options.scheduler == "6":
        scheduler = GreedyEasyBackfillScheduler(options.num_processors)

    elif options.scheduler == "EasyPlusPlusScheduler" or options.scheduler == "7":
        scheduler = EasyPlusPlusScheduler(options.num_processors)

    elif options.scheduler == "ShrinkingEasyScheduler" or options.scheduler == "8":
        scheduler = ShrinkingEasyScheduler(options.num_processors)

    elif options.scheduler == "LookAheadEasyBackFillScheduler" or options.scheduler == "9":
        scheduler = LookAheadEasyBackFillScheduler(options.num_processors)

    elif options.scheduler == "EasySJBFScheduler" or options.scheduler == "10":
        scheduler = EasySJBFScheduler(options.num_processors)

    elif options.scheduler == "HeadDoubleEasyScheduler" or options.scheduler == "11":
        scheduler = HeadDoubleEasyScheduler(options.num_processors)

    elif options.scheduler == "TailDoubleEasyScheduler" or options.scheduler == "12":
        scheduler = TailDoubleEasyScheduler(options.num_processors)

    elif options.scheduler == "OrigProbabilisticEasyScheduler" or options.scheduler == "13":
        scheduler = OrigProbabilisticEasyScheduler(options.num_processors)

    elif options.scheduler == "ReverseEasyScheduler" or options.scheduler == "14":
        scheduler = ReverseEasyScheduler(options.num_processors)

    elif options.scheduler == "PerfectEasyBackfillScheduler" or options.scheduler == "15":
        scheduler = PerfectEasyBackfillScheduler(options.num_processors)

    elif options.scheduler == "DoublePerfectEasyBackfillScheduler" or options.scheduler == "16":
        scheduler = DoublePerfectEasyBackfillScheduler(options.num_processors)

    elif options.scheduler == "AlphaEasyScheduler" or options.scheduler == "18":
        scheduler = AlphaEasyScheduler(options.num_processors)

    elif options.scheduler == "CommonDistEasyPlusPlusScheduler" or options.scheduler == "28":
        scheduler = CommonDistEasyPlusPlusScheduler(options.num_processors)

    else:
        print "No such scheduler"
        return

    try:
        print "...."
        run_simulator(num_processors=options.num_processors,
                      jobs=_job_inputs_to_jobs(parse_lines(input_file),
                                               options.num_processors),
                      scheduler=scheduler)

        print "Num of Processors: ", options.num_processors
        print "Input file: ", options.input_file
        print "Scheduler:", type(scheduler)

    finally:
        if input_file is not sys.stdin:
            input_file.close()
Example #8
0
def main():
    options = parse_options()

    if options.input_file == "-":
        input_file = sys.stdin
    else:
        input_file = open(options.input_file)
    try:
        print "...."

        # Site 1
        Blacklight = SiteData()
        Blacklight.location = "Pittsburgh"
        Blacklight.name = "Blacklight"
        Blacklight.cores = 4096
        Blacklight.powerPerCore = 87.89  # Watts
        Blacklight.timeZoneLag = 0
        Blacklight.gflops = 9.0
        Blacklight.max_ert = 86400
        Blacklight.max_req = 1024

        # Site 2
        Darter = SiteData()
        Darter.location = "Tennessee"
        Darter.name = "Darter"
        Darter.cores = 11968
        Darter.powerPerCore = 30.588624
        Darter.timeZoneLag = -1
        Darter.gflops = 20.79
        Darter.max_ert = 86400
        Darter.max_req = 2048

        # Site 3
        Gordon = SiteData()
        Gordon.location = "San Diego"
        Gordon.name = "Gordon"
        Gordon.cores = 16160
        Gordon.powerPerCore = 22.178218
        Gordon.timeZoneLag = -3
        Gordon.gflops = 21.10
        Gordon.max_ert = 172800
        Gordon.max_req = 1024

        # Site 4
        Trestles = SiteData()
        Trestles.location = "San Diego"
        Trestles.name = "Trestles"
        Trestles.cores = 10368
        Trestles.powerPerCore = 42.6697
        Trestles.timeZoneLag = -3
        Trestles.gflops = 9.64
        Trestles.max_ert = 172800
        Trestles.max_req = 1024

        # Site 5
        Mason = SiteData()
        Mason.location = "Indiana"
        Mason.name = "Mason"
        Mason.cores = 576
        Mason.powerPerCore = 39.952891
        Mason.timeZoneLag = 0
        Mason.gflops = 7.43
        Mason.max_ert = 172800
        Mason.max_req = 128

        # Site 6
        Lonestar = SiteData()
        Lonestar.location = "Texas"
        Lonestar.name = "Lonestar"
        Lonestar.cores = 22656
        Lonestar.powerPerCore = 15.83
        Lonestar.timeZoneLag = 2
        Lonestar.gflops = 13.33
        Lonestar.max_ert = 86400
        Lonestar.max_req = 4096

        # Site 7
        Queenbee = SiteData()
        Queenbee.location = "Louisiana"
        Queenbee.name = "Queenbee"
        Queenbee.cores = 5440
        Queenbee.powerPerCore = 16.25
        Queenbee.timeZoneLag = -1
        Queenbee.gflops = 9.38
        Queenbee.max_ert = 259200
        Queenbee.max_req = 2048

        # Site 8
        Steele = SiteData()
        Steele.location = "Indiana"
        Steele.name = "Steele"
        Steele.cores = 4992
        Steele.powerPerCore = 83.75
        Steele.timeZoneLag = 0
        Steele.gflops = 13.34
        Steele.max_ert = 259200
        Steele.max_req = 1024

        SiteList = [
            Blacklight, Darter, Gordon, Trestles, Mason, Lonestar, Queenbee,
            Steele
        ]
        input = []
        siteCount = 1
        maxProcessors = 0
        sumProcessors = 0
        for site in SiteList:
            maxProcessors = max(maxProcessors, site.cores)
            sumProcessors = maxProcessors + site.cores
            input.append(
                Site(siteCount, site.location, site.name,
                     site.timeZoneLag, site.cores,
                     EasyBackfillScheduler(site.cores), site.powerPerCore,
                     site.gflops, site.max_ert, site.max_req))
            siteCount += 1

        alpha = options.alpha
        beta = options.beta
        algorithm = options.algorithm
        joblimit = options.joblimit
        ''' 
        * Algorithm 1 - MCMF
        * Algorithm 2 - INST
	* 3 - two price
        '''

        runMetaScheduler(input,
                         jobs=_job_inputs_to_jobs(parse_lines(input_file),
                                                  maxProcessors),
                         alpha=alpha,
                         beta=beta,
                         algorithm=algorithm,
                         joblimit=options.joblimit,
                         maxq=options.maxq,
                         pfile=options.pfile,
                         mperc=options.mperc,
                         pricepath=options.pricepath)

        #print "Num of Processors: ", sumProcessors
        print "Alpha=", alpha, "Beta=", beta
        print "Input file: ", options.input_file

    finally:
        if input_file is not sys.stdin:
            input_file.close()
Example #9
0
def main():
    options = parse_options()

    if options.input_file == "-":
        input_file = sys.stdin
    else:
        input_file = open(options.input_file)

    if options.scheduler == "FcfsScheduler" or options.scheduler == "1":
        scheduler = FcfsScheduler(options.num_processors)

    elif options.scheduler == "ConservativeScheduler" or options.scheduler =="2":
        scheduler = ConservativeScheduler(options.num_processors)

    elif options.scheduler == "DoubleConservativeScheduler" or options.scheduler == "3":
        scheduler = DoubleConservativeScheduler(options.num_processors)

    elif options.scheduler == "EasyBackfillScheduler" or options.scheduler == "4":
        scheduler = EasyBackfillScheduler(options.num_processors)
        
    elif options.scheduler == "DoubleEasyBackfillScheduler" or options.scheduler == "5":
        scheduler = DoubleEasyBackfillScheduler(options.num_processors)

    elif options.scheduler == "GreedyEasyBackfillScheduler" or options.scheduler == "6":
        scheduler = GreedyEasyBackfillScheduler(options.num_processors)

    elif options.scheduler == "EasyPlusPlusScheduler" or options.scheduler == "7":
        scheduler = EasyPlusPlusScheduler(options.num_processors)
        
    elif options.scheduler == "ShrinkingEasyScheduler" or options.scheduler == "8":
        scheduler = ShrinkingEasyScheduler(options.num_processors)

    elif options.scheduler == "LookAheadEasyBackFillScheduler" or options.scheduler == "9":
        scheduler = LookAheadEasyBackFillScheduler(options.num_processors)

    elif options.scheduler == "EasySJBFScheduler" or options.scheduler == "10":
        scheduler = EasySJBFScheduler(options.num_processors)

    elif options.scheduler == "HeadDoubleEasyScheduler" or options.scheduler == "11":
        scheduler = HeadDoubleEasyScheduler(options.num_processors)
        
    elif options.scheduler == "TailDoubleEasyScheduler" or options.scheduler == "12":
        scheduler = TailDoubleEasyScheduler(options.num_processors)

    elif options.scheduler == "OrigProbabilisticEasyScheduler" or options.scheduler == "13":
        scheduler = OrigProbabilisticEasyScheduler(options.num_processors)    

    elif options.scheduler == "ReverseEasyScheduler" or options.scheduler == "14":
        scheduler = ReverseEasyScheduler(options.num_processors)
        
    elif options.scheduler == "PerfectEasyBackfillScheduler" or options.scheduler == "15":
        scheduler = PerfectEasyBackfillScheduler(options.num_processors)
        
    elif options.scheduler == "DoublePerfectEasyBackfillScheduler" or options.scheduler == "16":
        scheduler = DoublePerfectEasyBackfillScheduler(options.num_processors)

    elif options.scheduler == "AlphaEasyScheduler" or options.scheduler == "18":
        scheduler = AlphaEasyScheduler(options.num_processors)

    elif options.scheduler == "CommonDistEasyPlusPlusScheduler" or options.scheduler == "28":
        scheduler = CommonDistEasyPlusPlusScheduler(options.num_processors)
        

    
    else:
        print "No such scheduler"
        return 

    try:
        print "...." 
        run_simulator(
                num_processors = options.num_processors, 
                jobs = _job_inputs_to_jobs(parse_lines(input_file), options.num_processors),
                scheduler = scheduler 
            )
        
        print "Num of Processors: ", options.num_processors
        print "Input file: ", options.input_file
        print "Scheduler:", type(scheduler)

    finally:
        if input_file is not sys.stdin:
            input_file.close()