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