Open MPI logo

PLPA Users' Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all PLPA Users mailing list

From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2007-04-21 19:52:27


On Apr 21, 2007, at 1:41 PM, Bert Wesarg wrote:

> just looked over the code and I have 2 points, which I bring up for
> discussion:
>
> (1) There is no word about thread-safety in the topology API.

Mmm. Good point. It wouldn't be too hard to add a big mutex around
the whole thing to make it thread safe.

> (2) Maybe its too late to change the API, but:
>
>> int plpa_max_processor_id(void);
>> Return the max processor ID
>>
>> int plpa_max_socket(void);
>> Return the max socket number
>>
>> int plpa_max_core(int socket);
>> Return the max core number for a given socket
>
> all but these return 0 on success and a positive error number on
> error, only these return either a valid number or the negative
> error
> number.

Yoinks, that was foolish -- thanks for noticing...

It is certainly not too late to change the API.

> I think there are two options:
>
> (a) pass a pointer, like the other functions. This would be more
> consistence (even to the pthread API or MPI C API) and
> return 0
> on success and the positive error number on error.
>
> (b) return -1 on error and set errno appropriate.

Or

(c) Return the same error codes as now, but negative. E.g., return -
EINVAL instead EINVAL. So > 0 is success, < 0 is an error, and 0
would never be returned.

I'm open to popular opinion here; what do most people want?

-- 
Jeff Squyres
Cisco Systems