Advertisement
patryk

[PR] 16.03.2016 master.c

Mar 16th, 2016
371
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.58 KB | None | 0 0
  1. #include "def.h"
  2.  
  3. main()
  4. {
  5.     int mytid;
  6.     int tids[SLAVENUM];     /* slave task ids */
  7.     char slave_name[NAMESIZE];
  8.     int nproc, i, who;
  9.  
  10.     mytid = pvm_mytid();
  11.  
  12.     nproc=pvm_spawn(SLAVENAME, NULL, PvmTaskDefault, "", SLAVENUM, tids);
  13.     int inst = pvm_joingroup(GROUP1);
  14.  
  15.     pvm_barrier(GROUP1, 11);
  16.  
  17.     pvm_initsend(PvmDataDefault);
  18.     pvm_pkint(&mytid, 1, 1);
  19.     pvm_pkint(&i, 1, 1);
  20.     pvm_bcast(GROUP1, MSG_MSTR);
  21.  
  22.     for( i=0 ; i<nproc ; i++ )
  23.     {
  24.         pvm_recv( -1, MSG_SLV );
  25.         pvm_upkint(&who, 1, 1 );
  26.         pvm_upkstr(slave_name );
  27.         printf("%d: %s\n",who, slave_name);
  28.     }
  29.  
  30.     pvm_exit();
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement