Synergy User Manual and Tutorial. - THE CORE MEMORY
Synergy User Manual and Tutorial. - THE CORE MEMORY
Synergy User Manual and Tutorial. - THE CORE MEMORY
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>Synergy</strong> <strong>User</strong> <strong>Manual</strong> <strong>and</strong> <strong>Tutorial</strong><br />
}<br />
// Get host machine name<br />
gethostname(host, sizeof(host));<br />
// Get parents task ID<br />
ptid = pvm_parent();<br />
// Label first message as 1<br />
msgtag = 1;<br />
// Execute a blocking receive to wait for message from master<br />
pvm_recv(ptid, msgtag);<br />
// Put the received message in the buffer<br />
pvm_upkstr(buf);<br />
// Print the message to file<br />
fprintf(fd, "Worker: From %x: %s\n", ptid, buf);<br />
// Put reply message in buffer<br />
sprintf(buf, "Hello master from %s", host);<br />
// Initialize the send message operation<br />
pvm_initsend(PvmDataDefault);<br />
// Transfer the message to PVM storage<br />
pvm_pkstr(buf);<br />
// Send the message signal to master<br />
pvm_send(ptid, msgtag);<br />
// Close file<br />
fclose(fd);<br />
// Exit application<br />
pvm_exit();<br />
The worker waits for the initial message from the master, writes the message to a file,<br />
sends a reply <strong>and</strong> terminates. The output on the master machine would resemble:<br />
[c615111@owin ~/pvm ]>master<br />
Master: ID is 0, name is owin<br />
Master: Messages sent to 3 workers<br />
Master: From 3: Hello master from saber<br />
Master: From 1: Hello master from sarlac<br />
Master: From 2: Hello master from owin<br />
Master: Application is finished<br />
All the workers output can be redirected to the master’s terminal by running the<br />
application in PVM’s console, which can be started by typing:<br />
[c615111@owin ~/pvm ]>pvm<br />
71