1 class org.simgrid.msg.Task
2 ==========================
4 .. java:package:: org.simgrid.msg
7 .. java:type:: public class Task
9 A task is either something to compute somewhere, or something to exchange between two hosts (or both). It is defined by a computing amount and a message size.
16 .. java:field:: protected String name
26 .. java:constructor:: public Task()
29 Default constructor (all fields to 0 or null)
34 .. java:constructor:: public Task(String name, double flopsAmount, double bytesAmount)
37 Construct a new task with the specified processing amount and amount of data needed.
39 :param name: Task's name
40 :param flopsAmount: A value of the processing amount (in flop) needed to process the task. If 0, then it cannot be executed with the execute() method. This value has to be ≥ 0.
41 :param bytesAmount: A value of amount of data (in bytes) needed to transfert this task. If 0, then it cannot be transferred with the get() and put() methods. This value has to be ≥ 0.
46 .. java:constructor:: public Task(String name, Host[] hosts, double[] flopsAmount, double[] bytesAmount)
49 Construct a new parallel task with the specified processing amount and amount for each host implied.
51 :param name: The name of the parallel task.
52 :param hosts: The list of hosts implied by the parallel task.
53 :param flopsAmount: The amount of operations to be performed by each host of hosts. flopsAmount[i] is the total number of operations that have to be performed on hosts[i].
54 :param bytesAmount: A matrix describing the amount of data to exchange between hosts. The length of this array must be hosts.length * hosts.length. It is actually used as a matrix with the lines being the source and the columns being the destination of the communications.
61 .. java:method:: public native void cancel()
69 .. java:method:: public native void dsend(String mailbox)
72 Send the task asynchronously on the specified mailbox, with no way to retrieve whether the communication succeeded or not
77 .. java:method:: public native void dsendBounded(String mailbox, double maxrate)
80 Send the task asynchronously on the specified mailbox, with no way to retrieve whether the communication succeeded or not
85 .. java:method:: public native void execute() throws HostFailureException, TaskCancelledException
88 Executes a task on the location on which the current process is running.
90 :throws HostFailureException:
91 :throws TaskCancelledException:
96 .. java:method:: @Deprecated @Override protected void finalize() throws Throwable
99 Deletes a task once the garbage collector reclaims it
104 .. java:method:: public native double getFlopsAmount()
107 Gets the remaining amount of flops to execute in this task If it's ongoing, you get the exact amount at the present time. If it's already done, it's 0.
112 .. java:method:: public double getMessageSize()
118 .. java:method:: public String getName()
121 Gets the name of the task
126 .. java:method:: public native Process getSender()
129 Gets the sender of the task (or null if not sent yet)
134 .. java:method:: public native Host getSource()
137 Gets the source of the task (or null if not sent yet).
142 .. java:method:: public static native Comm irecv(String mailbox)
145 Starts listening for receiving a task from an asynchronous communication
148 :return: a Comm handler
153 .. java:method:: public static native Comm irecvBounded(String mailbox, double rate)
156 Starts listening for receiving a task from an asynchronous communication with a capped rate
159 :return: a Comm handler
164 .. java:method:: public native Comm isend(String mailbox)
167 Sends the task on the mailbox asynchronously
172 .. java:method:: public native Comm isendBounded(String mailbox, double maxrate)
175 Sends the task on the mailbox asynchronously (capping the sending rate to \a maxrate)
180 .. java:method:: public static native boolean listen(String mailbox)
183 Listen whether there is a task waiting (either for a send or a recv) on the mailbox identified by the specified alias
188 .. java:method:: public static native int listenFrom(String mailbox)
191 Tests whether there is a pending communication on the mailbox identified by the specified alias, and who sent it
196 .. java:method:: protected native void nativeFinalize()
202 .. java:method:: public static native void nativeInit()
205 Class initializer, to initialize various JNI stuff
210 .. java:method:: public static Task receive(String mailbox) throws TransferFailureException, HostFailureException, TimeoutException
213 Retrieves next task on the mailbox identified by the specified alias
221 .. java:method:: public static native Task receive(String mailbox, double timeout) throws TransferFailureException, HostFailureException, TimeoutException
224 Retrieves next task on the mailbox identified by the specified alias (wait at most \a timeout seconds)
233 .. java:method:: public static Task receiveBounded(String mailbox, double rate) throws TransferFailureException, HostFailureException, TimeoutException
236 Retrieves next task from the mailbox identified by the specified name with a capped rate
244 .. java:method:: public static native Task receiveBounded(String mailbox, double timeout, double rate) throws TransferFailureException, HostFailureException, TimeoutException
247 Retrieves next task on the mailbox identified by the specified name (wait at most \a timeout seconds) with a capped rate
256 .. java:method:: public void send(String mailbox) throws TransferFailureException, HostFailureException, TimeoutException
259 Sends the task on the specified mailbox
261 :param mailbox: where to send the message
262 :throws TimeoutException:
263 :throws HostFailureException:
264 :throws TransferFailureException:
269 .. java:method:: public void send(String mailbox, double timeout) throws TransferFailureException, HostFailureException, TimeoutException
272 Sends the task on the specified mailbox (wait at most \a timeout seconds)
274 :param mailbox: where to send the message
276 :throws TimeoutException:
277 :throws HostFailureException:
278 :throws TransferFailureException:
283 .. java:method:: public void sendBounded(String mailbox, double maxrate) throws TransferFailureException, HostFailureException, TimeoutException
286 Sends the task on the specified mailbox (capping the sending rate to \a maxrate)
288 :param mailbox: where to send the message
290 :throws TransferFailureException:
291 :throws HostFailureException:
292 :throws TimeoutException:
297 .. java:method:: public native void sendBounded(String mailbox, double timeout, double maxrate) throws TransferFailureException, HostFailureException, TimeoutException
300 Sends the task on the specified mailbox (capping the sending rate to \a maxrate) with a timeout
302 :param mailbox: where to send the message
305 :throws TransferFailureException:
306 :throws HostFailureException:
307 :throws TimeoutException:
312 .. java:method:: public native void setBound(double bound)
315 Changes the maximum CPU utilization of a computation task. Unit is flops/s.
320 .. java:method:: public native void setBytesAmount(double bytesAmount)
323 Set the amount of bytes to exchange the task Warning if the communication is already started and ongoing, this call does nothing.
325 :param bytesAmount: the size of the task
330 .. java:method:: public native void setFlopsAmount(double flopsAmount)
333 Set the computation amount needed to process the task Warning if the execution is already started and ongoing, this call does nothing.
335 :param flopsAmount: the amount of computation needed to process the task
340 .. java:method:: public native void setName(String name)
343 Sets the name of the task
345 :param name: the new task name
350 .. java:method:: public native void setPriority(double priority)
353 This method sets the priority of the computation of the task. The priority doesn't affect the transfer rate. For example a priority of 2 will make the task receive two times more cpu than the other ones.
355 :param priority: The new priority of the task.