#include #include #include "pvm3.h" int main() { int ptid; char buf[100]; //pvm_parent() returns the tid of the process that spawned me off ptid = pvm_parent(); strcpy(buf, "hello world, from "); //gethostname simply gets the name of the machine you are on. gethostname(buf + strlen(buf), 64); //Here is how you send messages between processes: pvm_initsend(PvmDataDefault); //Initsend initializes a new buffer that you can put stuff in pvm_pkstr(buf); //pvm_pkstr takes a string and places it in the buffer /* Other functions for packing that might come in useful are as follows: pvm_pkint(int* to_pack, int num_items, int stride) pvm_pkdouble(double* to_pack, int num_items, int stride) pvm_pkfloat(float* to_pack, int num_items, int stride) These functions take a pointer to the type they are packing and two integers, one to tell how many data elements to pack and one telling the stride. A stride of 1 is what you probably want. The stride tells how far to go before you find the next data element, so if I had an array of 10 items and I passed 5 and 2, pvm would pack every other element of the array. */ pvm_send(ptid, 1); //pvm_send has two arguments: // 1) The tid of the process you want to send this to. // 2) An integer that is the message tag number pvm_exit(); return 0; }