asptest.java

来自「collective processing environment for mo」· Java 代码 · 共 58 行

JAVA
58
字号

import com.ibm.dthreads.DThread;
import com.ibm.dthreads.DistributedExecutionManager;
import com.ibm.dthreads.SPMDDistributedExecutionManager;
import com.ibm.dthreads.DThreadExecutionContext;

public class ASPTest {

public static void main(String args[]) 
{
	   long start,end;
	   start=System.currentTimeMillis();
	if(args.length<3)
	{
		System.out.println("Command Usage : ");
		System.out.println("java ASPTest prog_name no_of_threads no_of_vertices");
		System.out.println("Please Refer README.htm");
		System.exit(0); 
	}
	int totalthreads=Integer.parseInt(args[1]);
	int noofvertices=Integer.parseInt(args[2]);
	   boolean debugMode=true;

        //For Global array version of ASP
	   Object arraydthread=null;
	   if(args[0].equals("global"))
	   {
	   arraydthread = new FloydGlobal(noofvertices);
	   }


	   //For Broadcast version of ASP
	   if(args[0].equals("bcast"))
	   {
	   arraydthread = new FloydBroadcast(noofvertices);
	   }


	   //For DRunnable version of ASP
	   if(args[0].equals("runnable"))
		{ 
		ASPRunnable dthreadObject = new ASPRunnable(noofvertices);
		arraydthread=new DThread(dthreadObject);
		}
	   DistributedExecutionManager dmanager = new SPMDDistributedExecutionManager(0);
	   DThreadExecutionContext context = new DThreadExecutionContext(totalthreads);
     
         //set the mode of execution..If the user want to have it in debug mode then all the debug messages will be there in log files       
         context.setMode(args);
 	   context.setexperimentName("Floyd");
	   dmanager.execute((DThread)arraydthread,context);
	   end=System.currentTimeMillis();
	   System.out.println("TIME TAKEN IS "+(end-start)+" milliSeconds");
}
}


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?