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 import org.simgrid.msg.Comm;
10 import org.simgrid.msg.Host;
11 import org.simgrid.msg.Msg;
12 import org.simgrid.msg.MsgException;
13 import org.simgrid.msg.Process;
14 import org.simgrid.msg.Task;
16 public class Sender extends Process {
17 public Sender (Host host, String name){
21 public void main(String[] args) throws MsgException {
22 double taskComputeSize =0;
23 double taskCommunicateSize = 5000000;
24 Host[] hosts = Host.all();
25 int receiverCount = hosts.length - 1;
27 Msg.info("I have "+ receiverCount + " receivers to contact");
29 Comm[] communicators = new Comm[receiverCount];
30 for (int i = 1; i <= receiverCount; i++) {
31 Task task = new Task("Task_" + i, taskComputeSize, taskCommunicateSize);
32 Msg.info("Start the Sending '" + task.getName()+ "' to '" + hosts[i].getName() + "'");
33 communicators[i-1] = task.isend(hosts[i].getName());
36 Msg.info("All tasks have been (asynchronously) dispatched. Let's wait for their completion.");
37 Comm.waitAll(communicators);
39 Msg.info("Goodbye now!");