#include #include #include "pvm3.h" #define SLAVENAME "slave" #define SLAVEMAX 32 int main(void){ int mytid; int tids[SLAVEMAX]; int n, nproc, numt, i, who, msgtype; float data[100], result[SLAVEMAX]; /* enroll in pvm */ mytid = pvm_mytid(); /* Set number of slaves to start */ puts("How many slave programs (1-32)?"); scanf("%d", &nproc); /* start up slave tasks */ numt=pvm_spawn(SLAVENAME, NULL, 0, "", nproc, tids); if( numt < nproc ){ printf("Trouble spawning slaves. Aborting. Error codes are:\n"); for( i = numt ; i < nproc ; i++ ) { printf("TID %d %d\n",i,tids[i]); } for( i = 0 ; i < numt ; i++ ){ pvm_kill( tids[i] ); } pvm_exit(); exit(0); } /* Begin User Program */ n = 100; /* initialize_data( data, n ); */ for( i=0 ; i