Monday, August 24, 2009

Test Post

This is just a test post while I figure out the proper width for my template. I could've cheated and used the same template as Philip. It's what I get for trying to be unique.

Here's some nasty Java code I wrote in the past year:


package edu.hawaii.schedulingsimulation
;

import java.util.Calendar;

import edu.hawaii.schedulingsimulation.generator.DAG;
import edu.hawaii.schedulingsimulation.generator.DAGGenerator;
import edu.hawaii.schedulingsimulation.simulator.scheduler.HLFETScheduler;
import edu.hawaii.schedulingsimulation.simulator.scheduler.ISHScheduler;
import edu.hawaii.schedulingsimulation.simulator.scheduler.MaxMinScheduler;
import edu.hawaii.schedulingsimulation.simulator.scheduler.MinMinScheduler;
import edu.hawaii.schedulingsimulation.simulator.scheduler.ModifiedCPScheduler;
import edu.hawaii.schedulingsimulation.simulator.scheduler.NaiveCPScheduler;
import edu.hawaii.schedulingsimulation.simulator.scheduler.NaiveMaxMinScheduler;
import edu.hawaii.schedulingsimulation.simulator.scheduler.Scheduler;
import edu.hawaii.schedulingsimulation.simulator.scheduler.SufferageScheduler;

/**
* Main.java
*
* Class that runs the simulation.
*
* @author George Lee
*
*/
public class Main {
  
private static Calendar cal = Calendar.getInstance();

  
/**
    * Runs the simulator.
    *
    * @param args Command line arguments (trials?).
    */
  
public static void main(string args[]) {
      
int numTrials = 100;
      
int numTasks = 50;
      
double edgeToTaskRatio = 0.1;
      
int procCost = 10;
      
double commCompRatio = 1.0;
      
int depth = 5;
      
int children = 5;
      
int parents = 5;
      
int procs = 5;
    
      
//Scheduler results.
      
DAGGenerator generator = new DAGGenerator();
      
DAG dag;
      
Scheduler scheduler;
      
double[] naiveMaxMinResult = new double[numTrials];
      
double[] maxMinResult = new double[numTrials];
      
double[] minMinResult = new double[numTrials];
      
double[] sufferageResult = new double[numTrials];
      
double[] naiveCPResult = new double[numTrials];
      
double[] hlfetResult = new double[numTrials];
      
double[] ishResult = new double[numTrials];
      
double[] modifiedCPResult = new double[numTrials];
    
      
double naiveMaxMinSpeedup = 0, maxMinSpeedup = 0, minMinSpeedup = 0, sufferageSpeedup = 0,
                      
naiveCPSpeedup = 0, hlfetSpeedup = 0, ishSpeedup = 0, modifiedCPSpeedup = 0;
    
      
if(args.length > 0) {
           numTasks
= Integer.valueOf(args[0]);
      
}
      
if(args.length > 1) {
           edgeToTaskRatio
= double.valueOf(args[1]);
      
}
      
if(args.length > 2) {
           commCompRatio
= double.valueOf(args[2]);
      
}
    
      
if(args.length > 3) {
           procs
= Integer.valueOf(args[0]);
      
}

       System.out.println
("**Number of tasks " + numTasks + "**");
      
System.out.println("**Edges to tasks ratio " + edgeToTaskRatio + "**");
      
System.out.println("**Communication to computation ratio " + commCompRatio + "**");
      
System.out.println("**Number of processors " + procs + "**");
    
      
int edges = (int)(edgeToTaskRatio*numTasks);
      
int commCost = (int)(commCompRatio*procCost);

//Some code that I omitted because I don't want to deal with converting the less than symbol
}

No comments:

Post a Comment