Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
give this example default values for the arguments so that it can be run from eclipse
[simgrid.git] / examples / java / masterslave / Masterslave.java
1 /*
2  * Copyright 2006-2012. The SimGrid Team. All rights reserved. 
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. 
6  */
7
8 package masterslave;
9
10 import java.io.File;
11
12 import org.simgrid.msg.Msg;
13 import org.simgrid.msg.NativeException;
14
15 public class Masterslave {
16    public static final int TASK_COMP_SIZE = 10000000;
17    public static final int TASK_COMM_SIZE = 10000000;
18    /* This only contains the launcher. If you do nothing more than than you can run 
19     *   java simgrid.msg.Msg
20     * which also contains such a launcher
21     */
22    
23     public static void main(String[] args) throws NativeException {       
24             /* initialize the MSG simulation. Must be done before anything else (even logging). */
25             Msg.init(args);
26             
27             String platf  = args.length > 1 ? args[0] : "examples/java/platform.xml";
28             String deploy =  args.length > 1 ? args[1] : "examples/java/masterslave/masterslaveDeployment.xml";
29         
30             System.out.println("Platform: "+platf+"; Deployment:"+deploy+"; Current directory: "+new File(".").getAbsolutePath());
31             
32                 /* construct the platform and deploy the application */
33                 Msg.createEnvironment(platf);
34                 Msg.deployApplication(deploy);
35                 /*  execute the simulation. */
36         Msg.run();
37     }
38 }