Subject: Re: mpi-context; MPI_ATTR_KEY_NULL proposal

From: L J Clarke <[email-masked]>
Date: Fri, 14 Jan 94 17:26:01 GMT

> You propose to add a pre-defined "NULL" value for the key, which is
> never found by get_attr_value.
> 
> I suppose this is OK, but it doesn't really seem necessary. 

> I could write your code like this (at the cost of one extra static
> variable). 

There was a small bug in the peice of code I sent.  I thought it was so
obvious I didnt want to waste bandwidth with the correction. 

At least, modulo bug fix, the example I sent works.  Your version does
NOT.  The logic of the thing is wrong. 

In your example the first time "lib_call" is ever made at all
"initialised" gets set to TRUE.  On a later call with the same user
communicator as argument this is fine.  On a later call which is the
first with a different user level communicator then the example fails
because the code in lib_init() to dup the user communicator and put the
attribute is not executed ("initialised" has the value TRUE). 

There are nevertheless ways of transforming the (bug correceted) code,
which also remove the explicit initialisation code form the library
call, and do not need this MPI_ATTR_KEY_NULL, its fair comment. 

         /--------------------------------------------------------\
    e||) | Lyndon J Clarke    Edinburgh Parallel Computing Centre | e||) 
    c||c | Tel: 031 650 5021  Email: [email-masked]  | c||c 
         \--------------------------------------------------------/

---

From: [email-masked] (James Cownie)
Date: Thu, 20 Jan 1994 10:56:09 +0000

Of course you are correct, there are two distinct levels of
initialisation required  which I confused (maybe because of your bug).

1) Initialisation of the library key.
   Required once for the whole library

2) Initialisation of the library related things associated with a
   particular communicator. Required once each time a new communicator is
   passed by the user.

I still fail to see the benefit of looking up the undefined key value,
since this seems to me to confuse the two issues (I might even be
inclined to say that doing so is an error [cf *NULL]). I'd definitely write
it like this

	if (lib_key == MPI_NULL_KEY)
	    /* Library completely uninitialised, get the key */

	lookup(communicator, key, &found);
	
	if (!found)
	    /* It's a communicator we haven't seen, so init our stuff */

	do everyting else.
	
-- Jim 
James Cownie 
Meiko Limited			Meiko Inc.
650 Aztec West			Reservoir Place
Bristol BS12 4SD		1601 Trapelo Road
England				Waltham
				MA 02154

Phone : +44 454 616171		+1 617 890 7676
FAX   : +44 454 618188		+1 617 890 5042
E-Mail: [email-masked]   or    [email-masked]