/* Standard Deviation program Slave Jim Garlick */ #include #include #include "pvm3.h" #include "stddev.h" int main (int argc, char *argv[]) { /* Initialize some variables */ int parent_id, bufid, count, i; float sum, mean; float *data; /* Get the task id of the parent process */ parent_id = pvm_parent(); /* Recieve the data from the parent */ bufid = pvm_recv(parent_id, SendData); /* Unpack how many numbers we were sent */ pvm_upkint(&count, 1, 1); /* Allocate the array based on the size */ data = (float*) malloc(count*sizeof(float)); /* Unpack the entire data array */ pvm_upkfloat(data, count, 1); /* Add up all of the numbers */ for (sum=0.0, i=0; i