The Queen's University of Belfast
Parallel Computer Centre

[Next] [Previous] [Top]

Dynamic Process Groups


Dynamic Process Groups

Joining a Group

pvmfjoingroup

CALL PVMFJOINGROUP(GROUP, INUM)

Leaving a Group

pvmflvgroup

CALL PVMFLVGROUP(GROUP, INFO)

General Group Functions

Group Functions

CALL PVMFGETTID(GROUP, INUM, TID)

CALL PVMFGETINST(GROUP, TID, INUM)

CALL PVMFGSIZE(GROUP, SIZE)

CALL PVMFBARRIER(GROUP, COUNT, INFO)

CALL PVMFBCAST(GROUP, MSGTAG, INFO)

CALL PVMFREDUCE (FUNC, DATA, COUNT, DATATYPE,MSGTAG, GROUP, ROOT, INFO)

Example SPMD

c Join a group and if I am the first instance

c ie me=0 spawn more copies of myself

call pvmfjoingroup(`foo', me)

if(me .eq. 0) call pvmfspawn (`spmd',

& PVMDEFAULT, '*', NPROC-1, tids(1), info)

c Wait for everyone to startup before proceeding.

call pvmfbarrier(`foo', NPROC, info)

if(me .eq. 0) print*, 'setup complete'

call dowork(me, NPROC)

c program finished leave group and exit pvm

call pvmflvgroup(`foo', info)

... etc

subroutine dowork(me, nproc)

include `/totem/pvm3/include/fpvm3.h'

c Simple subroutine to pass a token around a ring

integer me, nproc

integer token, src, dest, msgtag

c Determine neighbours in the ring

call pvmfgettid(`foo', me-1, src)

call pvmfgettid(`foo', me+1, dest)

if(me .eq. 0) then

call pvmfgettid(`foo', NPROC-1,src)

else if(me .eq. NPROC-1) then

call pvmfgettid(`foo', 0, dest)

endif

msgtag = 4

call pvmfinitsend(PVMDEFAULT, info)

if (me .eq. 0) then

token = dest

call pvmfpack(INTEGER4, token, 1, 1, info)

call pvmfsend(dest, msgtag, info)

call pvmfrecv(src, msgtag, info)

print*, `token ring done'

else

call pvmfrecv(src, msgtag, info)

call pvmfunpack(INTEGER4, token,1,1, info)

token = dest

call pvmfpack(INTEGER4, token, 1, 1, info)

call pvmfsend(dest, msgtag, info)

endif


[Next] [Previous] [Top]
All documents are the responsibility of, and copyright, © their authors and do not represent the views of The Parallel Computer Centre, nor of The Queen's University of Belfast.
Maintained by Alan Rea, email A.Rea@qub.ac.uk
Generated with CERN WebMaker