int tid = pvm_mytid (void)
call pvmfmytid (tid)
tid
tid
of this process and can be call
multiple times
pvm_mytid()
must be call before any other calls in
an application
if (me = pvm_mytid () < 0) printf ("error in enrolling\n") ; else printf ("success, I am %d\n", me) ;
CALL PVMFMYTID (ME) IF (ME .LT. 0) THEN WRITE (*,*) 'error in enrolling' ELSE WRITE (*,*) 'success, I am ', ME ENDIF
int info = pvm_exit (void)
call pvmfexit (info)
pvm_spawn
;/* program done */ pvm_exit () ; exit () ;
C **program done** CALL PVMEXIT (INFO) STOP
int numt = pvm_spawn (char *task, char **argv,
int flag, char *where, int ntask, int *tids)
call pvmfspawn (task, flag, where, ntask, tids, numt)
ntask
copies of an executable file
task
on the virtual machine:
pvm3/bin/$PVMARCH/task argv
argv
is a pointer to a NULL
terminated array of
arguments to task
flag
argument is used to specify options, and is
sum of
where
argument
specifies a particular host to spawn on
where
argument
specifies a type of architecture to spawn on
numt
is set to the number of tasks
successfully spawned or an error code if no tasks could be
started
tids
numtr = pvm_spawn ("host", 0, PvmTaskHost, "ms3", 1, &tid[0]) ; numtr = pvm_spawn ("host", 0, PvmTaskHost+PvmTaskDebug, "ms3", 1, &tid[0]) ; numtr = pvm_spawn ("node", 0, PvmTaskArch, "SUN4", 1, &tid[i]) ; numtr = pvm_spawn ("FEM1", args, 0, 0, 16, tids) ; numtr = pvm_spawn ("pde", 0, PvmTaskHost, "paragon.lifl.fr", 512, tids) ;
CALL PVMFSPAWN ("host", PVMTASKHOST, "ms3", 1, TID, NUMTR) CALL PVMFSPAWN ("host", PVMTASKHOST+PVMTASKDEBUG, "ms3", 1, TID, NUMTR) CALL PVMFSPAWN ("node", PVMTASKARCH, "SUN4", 1, TID, NUMTR) CALL PVMFSPAWN ("FEM1" 0, 0, 16, TIDS, NUMTR) CALL PVMFSPAWN ("pde" PVMTASKHOST, "paragon.lifl.fr", 512, TIDS, NUMTR)
program firstpvm include 'fpvm3.h' integer nprocs, info, tids (0:20), mytid call pvmfmytid (mytid) call pvmfparent (tids(0)) if (tids (0) .lt. 0) then C*** In the master code *** tids(0) = mytid read (*,*), nprocs call pvmfspawn ('a.out', PVMTASKDEFAULT, & '*', nproc-1, tids(1), numt) .... else C*** In the slave code *** .... end if call pvmfexit (info) end
int info = pvm_kill (int tid)
call pvmfkill (tid, info)
tid
tid
pvm_exit()
followed by exit()
)
info
indicates an error