On Oct 9, 2013, at 15:29 , Ralph Castain <rhc_at_[hidden]> wrote:
> IIRC, the concern was with where the thread safety should reside. Some classes (e.g., opal_list) were littered with thread locks for every operation. So if someone implemented thread protection at a higher level (e.g., protecting the list while cycling thru it), then all these lower-level lock/unlock operations were just a waste of cycles.
I tried to find these protections in the basic objects (pal_list_t as you named it) but I failed. I don't see this being the case in any of the versions out there (1.6, 1.7 nor trunk). There are some atomic operations to keep track of the ref counts, but this is a completely different topic.
In the OMPI layer we tried to follow the rule that all calls without capitals are not thread safe (and are functions), while all calls with capitals at macros and are protected. This was a best effort applied where it made sense.
> However, some people felt that there were places where it helped to have the locking down below. So this was the compromise - use the version that fits your situation.
In most of the cases there is nothing better we can do down than protecting the call itself.
> Personally, I'm not wild about it, but I can live with it. I'd prefer to see no lock/unlock calls in the classes themselves as they are too atomistic, and would have opted for providing a macro version of the function that included the appropriate lock/unlocks around the function.
I'm 100% with you here, I also prefer to see the locks, as this makes errors easier to spot. This is why I'm concerned about moving them outside the view, buried under several levels of macro indirections. I could understand the push if there was an obvious performance or safety benefit, but as I fail to see I was wondering if I was missing something from the "bigger" picture.
> Anyway, that was the thinking at the meeting last June.
> On Oct 9, 2013, at 1:40 AM, George Bosilca <bosilca_at_[hidden]> wrote:
>> My concern is that increasing the number of interfaces will not make the code thread safe, as in most cases thread safety is not only a matter of using a _mt version of the basic class object but a matter of a careful manipulation of higher level concepts.
>> We can hardly use the lack of the _MT function as a reason for not having thread safety in the code. We did have the thread safety a while back without the support of _MT version of all the basic classes.
>> So I really wonder what is the rationale behind such an intrusive change of the codebase?
>> On Oct 8, 2013, at 18:14 , Ralph Castain <rhc_at_[hidden]> wrote:
>>> Hi folks
>>> This was one item from the last devel meeting that can be done independent of other things:
>>> resolution: all opal and orte (and possibly ompi) classes need to have a thread safe and thread-free interface
>>> _st suffix: single thread (i.e., not thread safe variant)
>>> _mt suffix: multi thread (i.e., thread safe variant)
>>> for functions that have both st/mt, they will *both* have suffixes
>>> other functions (that do not have st/mt versions) will be naked names
>>> need to rename all classes that have locking enabled already (e.g., opal_free_list)
>>> so today, we go rename all the functions (e.g., opal_free_list functions get _mt suffix) throughout the code base
>>> as someone needs the _st version, they go create it and use it as they want to
>>> Ralph will do the orte classes
>>> Aurelien will do this for the ompi classes
>>> I believe some of these have been done - I will take care of the ORTE classes this week, so consider this a "heads up" for that change.
>>> devel mailing list
>> devel mailing list
> devel mailing list