1 /* Copyright (c) 2006-2014, 2016. The SimGrid Team.
2 * All rights reserved. */
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. */
9 /** This example demonstrates the use of the asynchrounous communications
11 * Task.isend() and Task.irecv() are used to start the communications in non-blocking mode.
13 * The sends are then blocked onto with Comm.waitCompletion(), that locks until the given
14 * communication terminates.
16 * The receives are packed into an array, and the sender blocks until all of them terminate
17 * with Comm.waitAll().
21 import org.simgrid.msg.Msg;
22 import org.simgrid.msg.Host;
23 import org.simgrid.msg.MsgException;
27 throw new IllegalAccessError("Utility class");
30 public static void main(String[] args) throws MsgException {
33 String platform = "../platforms/small_platform.xml";
34 if (args.length >= 1) {
35 platform = args[0]; // Override the default value if passed on the command line
38 /* construct the platform and deploy the application */
39 Msg.createEnvironment(platform);
40 Host[] hosts = Host.all();
41 new Sender(hosts[0],"Sender").start();
42 for (int i=1; i < hosts.length; i++){
43 new Receiver(hosts[i], "Receiver").start();
45 /* execute the simulation. */