Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cleanups in java examples (2/2)
[simgrid.git] / examples / java / cloud / Cloud.java
1 /* Copyright (c) 2012-2014, 2016. The SimGrid Team.
2  * 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 package cloud;
8
9 import org.simgrid.msg.Msg;
10 import org.simgrid.msg.Host;
11 import org.simgrid.msg.MsgException;
12
13 public class Cloud {
14   public static final double task_comp_size = 10;
15   public static final double task_comm_size = 10;
16   public static final int hostNB = 2 ; 
17   public static void main(String[] args) throws MsgException {
18     Msg.init(args); 
19
20     if (args.length < 1) {
21       Msg.info("Usage   : Cloud platform_file");
22       Msg.info("Usage  : Cloud ../platforms/platform.xml");
23       System.exit(1);
24     }
25
26     /* Construct the platform */
27     Msg.createEnvironment(args[0]);
28     Host[] hosts = Host.all();
29     if (hosts.length < hostNB+1) {
30       Msg.info("I need at least "+ (hostNB+1) +"  hosts in the platform file, but " + args[0] + " contains only "
31                + hosts.length + " hosts");
32       System.exit(42);
33     }
34     Msg.info("Start"+ hostNB +"  hosts");
35     new Master(hosts[0],"Master",hosts).start();
36     /* Execute the simulation */
37     Msg.run();
38   }
39 }