Next: Reducing, Previous: Awaiting completion, Up: Communication statements [Contents][Index]
Although a single <send_stmt> (see Sending) can specify multiple messages at once, these messages are sent one at a time. Multicasting is a form of collective communication in which a set of tasks collaborates to deliver a message from a source to multiple targets. With many messaging layers, multicasting a message to N tasks is more efficient than sending a sequence of N individual messages. coNCePTuaL supports multicasting as follows:
<mcast_stmt> | ::= | <source_task> |
[ ASYNCHRONOUSLY ]
MULTICASTS |
||
<message_spec> | ||
TO
<target_tasks> |
Unlike <send_stmt>s,
<mcast_stmt>s do not support the
UNSUSPECTING
keyword. This is because
MULTICASTS
is a collective operation: all parties are
active participants in delivering messages to the
<target_tasks>.
<source_task> (see Source tasks) and <target_tasks> (see Target tasks) can be either disjoint or overlapping sets. That is, either of the following is legal:
TASK 0 MULTICASTS A 16 BYTE MESSAGE TO TASKS recip SUCH THAT recip<4 TASK 0 MULTICASTS A 16 BYTE MESSAGE TO TASKS recip SUCH THAT recip>=4
Note that in the first <mcast_stmt>, task 0 both sends and receives a message, while in the second <mcast_stmt>, task 0 sends but does not receive.
The
MULTICASTS
statement supports not only traditional
one-to-many multicasting as shown in the preceding example but also
many-to-many multicasting—and the less interesting but still valid
many-to-one and one-to-one multicasting. The constituent pairs of
communicating tasks are identical to those induced by the SENDS
statement (see Sending). For
example, the statement
TASKS s SUCH THAT s<3 MULTICAST A 1 KILOBYTE MESSAGE TO TASKS s SUCH THAT s>6
performs the collective analogue of
TASKS s SUCH THAT s<3 SEND A 1 KILOBYTE MESSAGE TO TASKS s SUCH THAT s>6
Specifically, task 0 will send a message to each of tasks 7, 8, 9, …; task 1 will send a message to each of tasks 7, 8, 9, … ; and task 2 will send a message to each of tasks 7, 8, 9, ...
Next: Reducing, Previous: Awaiting completion, Up: Communication statements [Contents][Index]