next up previous

3.2 Fortran 77 Example     continued...

The xp argument is the first item to be packed, nitem is the total number of items to be packed and stride is the stride to use when packing.

A single message can contain any number of different data types and there is no limit on the complexity of the message. However, you should ensure that the received message is unpacked in the same way it was originally packed.

The routine to send a message is pvmfsend().

call pvmfsend(tid, msgtag, info)
This routine attaches an integer label of msgtag and immediately sends the contents of the send buffer to the task with with task id of tid. The msgtag can be used to distinguish different ``types'' of messages that a task could send out.

In the example code, within a loop, the master program clears the send buffer for each new message and packs this buffer with the number of array elements that follow in the message and a portion of the array to be sent to the task. Since each consecutive item from the array a is to be sent, starting with the num_data*(i-1)+1 position, the stride for the packing routine is 1. The task_ids array that was returned from the pvmfspawn() call is used to address each different task that will receive a portion of the array. The arbitrarily chosen value `4' is the msgtag used to label the messages.