Logo AND Algorithmique Numérique Distribuée

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