Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid
[simgrid.git] / examples / java / cloud / masterworker / Main.java
1 /* Copyright (c) 2012-2017. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 package cloud.masterworker;
7
8 import org.simgrid.msg.Msg;
9 import org.simgrid.msg.Host;
10 import org.simgrid.msg.MsgException;
11
12 class Main {
13   public static final double TASK_COMP_SIZE = 10;
14   public static final double TASK_COMM_SIZE = 10;
15   public static final int NHOSTS = 6;
16
17   private Main() {
18     throw new IllegalAccessError("Utility class");
19   }
20
21   public static void main(String[] args) throws MsgException {
22     Msg.init(args); 
23
24     if (args.length < 1) {
25       Msg.info("Usage   : Main platform_file");
26       Msg.info("Usage  : Main ../platforms/platform.xml");
27       System.exit(1);
28     }
29
30     /* Construct the platform */
31     Msg.createEnvironment(args[0]);
32     Host[] hosts = Host.all();
33     if (hosts.length < NHOSTS+1) {
34       Msg.info("I need at least "+ (NHOSTS+1) +"  hosts in the platform file, but " + args[0] + " contains only "
35                + hosts.length + " hosts");
36       System.exit(42);
37     }
38     new Master(hosts[0],"Master",hosts).start();
39     
40     /* Execute the simulation */
41     Msg.run();
42   }
43 }