Ports are obtained while a new process is created or by receiving them as a message. In the following example the SendingPorts array will be filled out by ports created as a result of starting NumOfNodes copies of the SlaveName program on Nodes nodes.
|
#define NumOfNodes 8
|
#define SlaveName "/usr/janusz/slave_program"
|
TCE_Port *SendingPorts[NumOfNodes];
|
TCE_Chn *Channels[NumOfNodes];
|
...
|
n = tce_exec(SendingPorts,Nodes,SlaveName,TCE_InPort,NumOfNodes);
|
tce_chn_init(Channels,TCE_InPort,SendingPorts,n);
|
for(i = 0; i < n; i++)
-
tce_chn_snd(Channels[i],SendingPorts,n,FMT_Port);
|
...
|
Using those ports the parent process can now establish a dedicated channel to each of its children by calling tce_chn_init. Through the channels it can pass the sending ports to all its children (tce_chn_snd).
|