Newsgroups: comp.parallel.pvm
From: "D. Jain" <D.Jain@ncl.ac.uk>
Subject: XPVM and bugs : repost!
Organization: University of Newcastle upon Tyne, UK
Date: 29 Dec 1994 11:22:00 GMT
Message-ID: <3du64o$r41@whitbeck.ncl.ac.uk>

Hi,

I am reposting the following article which I originally posted on the 25th of
October because I just realised I originally failed to label the distribution as
being world and it only went to about three people here in Newcastle! I refer to
this article in my other posting so figured I better make it available!!!!!
Sorry!!!

25th of October 1994 I wrote:

Just a quick comment on a "bug" (is it a bug? In a sense this isn't)
in XPVM. When running code which has to determine if it is the parent
or the child using the standard method of calling pvmfparent (looking
for -23 as the returned tid if parent) the parent actually recieves
back a positive tid for its parent (as it is spawned by XPVM  so does
have a parent - XPVM itself). This means, for example, the standard
example of a SPMD program in the PVM 3.0 User's Guide won't work
under XPVM.

The way I get round this is to replace the following construct:

      call pvmfparent (parent_tid)
      if (parent_tid.lt.0) then
C        PARENT CODE eg spawning slaves etc
      else
C        CHILD CODE  eg receiving tids array from parent etc
      endif

by the following:

      call  pvmfjoingroup ('SPMD',ipvm_group)
      if(ipvm_group.eq.0)then
        parent_tid =-23
      else
        call pvmfparent (parent_tid)   ! check if parent
      endif
      if (parent_tid.lt.0) then
C        PARENT CODE eg spawning slaves etc
      else
C        CHILD CODE  eg receiving tids array from parent etc
      endif

Since the pvmfjoingroup call assigns group numbers sequentially
the parent is the one assigned the number 0. Of course it is sometimes
additionally useful to suspend the operation of the parent and children
until all the children have been spawned by using the pvmfbarrier command
with the group SPMD but that is another issue.

The reason I am posting this is two fold:

1) This has probably come up before with people coming up with better
solutions - if so could someone tell me! (something that will work
whether running under XPVM or not)
2) There are other ways of solving this minor hassle such as checking to
see if a file that only the parent would have access to exists (assuming
the parent is on a seperate machine) but this clearly seems very dodgy!
This group method seems to be very robust and might be useful for others.

Thanks in advance for any followup remarks either directly to me or via
the newsgroup.

Deepak Jain (Many hands make light work!)


-- 
The storms will pass      ! Deepak Jain  IRC Nick: Toon  !
It won't be long now.     ! Email:d.jain@newcastle.ac.uk !
The storms will pass      ! PHONE (091) 2227360          !
But my love lasts forever.! http://www.ncl.ac.uk/~n04ck/ !

