version 1.2, 2000/01/16 07:55:48 |
version 1.4, 2003/08/22 16:08:22 |
|
|
/* $OpenXM$ */ |
/* $OpenXM: OpenXM/src/kan96xx/plugin/sm1pvm.c,v 1.3 2001/05/04 01:06:30 takayama Exp $ */ |
#include <stdio.h> |
#include <stdio.h> |
#include "pvm3.h" |
#include "pvm3.h" |
#define SLAVENAME "slave3" |
#define SLAVENAME "slave3" |
Line 30 static struct pvmhostinfo *Hostp[MAXHOSTS+1]; |
|
Line 30 static struct pvmhostinfo *Hostp[MAXHOSTS+1]; |
|
|
|
KpvmStartSlaves(char *name,int nproc) { |
KpvmStartSlaves(char *name,int nproc) { |
int numt,i,info; |
int numt,i,info; |
/* enroll in pvm */ |
/* enroll in pvm */ |
Nproc = nproc; |
Nproc = nproc; |
Mytid = pvm_mytid(); |
Mytid = pvm_mytid(); |
if (Nproc > MAXHOSTS) { |
if (Nproc > MAXHOSTS) { |
Nproc = MAXHOSTS-1; |
Nproc = MAXHOSTS-1; |
fprintf(stderr,"Too many tasks. It is set to %d\n",Nproc); |
fprintf(stderr,"Too many tasks. It is set to %d\n",Nproc); |
|
} |
|
/* start up slave tasks */ |
|
numt=pvm_spawn(name, (char**)0, 0, "", Nproc, Tids); |
|
if( numt < Nproc ){ |
|
fprintf(stderr,"Trouble spawning slaves. Aborting. Error codes are:\n"); |
|
for( i=numt ; i<Nproc ; i++ ) { |
|
printf("TID %d %d\n",i,Tids[i]); |
} |
} |
/* start up slave tasks */ |
for( i=0 ; i<numt ; i++ ){ |
numt=pvm_spawn(name, (char**)0, 0, "", Nproc, Tids); |
pvm_kill( Tids[i] ); |
if( numt < Nproc ){ |
|
fprintf(stderr,"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(); |
|
PvmStarted = 0; |
|
return(-1); |
|
} |
} |
PvmStarted = 1; |
pvm_exit(); |
return(0); |
PvmStarted = 0; |
|
return(-1); |
|
} |
|
PvmStarted = 1; |
|
return(0); |
} |
} |
|
|
int KpvmMcast(char *comm) { |
int KpvmMcast(char *comm) { |
Line 77 int KpvmStopSlaves() { |
|
Line 77 int KpvmStopSlaves() { |
|
pvm_mcast(Tids, Nproc, 10); |
pvm_mcast(Tids, Nproc, 10); |
/* |
/* |
for (i=0; i<numt; i++) { |
for (i=0; i<numt; i++) { |
pvm_kill(Tids[i]); |
pvm_kill(Tids[i]); |
} |
} |
*/ |
*/ |
|
|
/* Program Finished exit PVM before stopping */ |
/* Program Finished exit PVM before stopping */ |
PvmStarted = 0; |
PvmStarted = 0; |
Line 154 struct object KpvmJobPool(struct object obj) { |
|
Line 154 struct object KpvmJobPool(struct object obj) { |
|
pvm_pkint(&remaining,1,1); |
pvm_pkint(&remaining,1,1); |
pvm_pkstr(darray[remaining]); |
pvm_pkstr(darray[remaining]); |
if (KpvmVerbose) |
if (KpvmVerbose) |
printf("Sending the message <<%s>> of the type 10.\n",darray[remaining]); |
printf("Sending the message <<%s>> of the type 10.\n",darray[remaining]); |
pvm_send(rtid, 10); |
pvm_send(rtid, 10); |
} |
} |
|
|
|
|
m = 5; |
m = 5; |
|
|
|
|
if (KpvmStartSlaves(SLAVENAME,3)) exit(); |
if (KpvmStartSlaves(SLAVENAME,3)) exit(0); |
KpvmMcast("/afo { /n set (x+1). n power [((x-1)^2).] reduction 0 get (string) dc} def "); |
KpvmMcast("/afo { /n set (x+1). n power [((x-1)^2).] reduction 0 get (string) dc} def "); |
|
|
obj = newObjectArray(m); |
obj = newObjectArray(m); |