[ofa-general] Re: [PATCH] opensm: provide methods for getting the OpenSM and Log

Timothy A. Meier meier3 at llnl.gov
Mon Mar 10 08:48:53 PDT 2008


Hi Sasha,

Sasha Khapyorsky wrote:
> Hi Tim,
> 
> On 17:21 Tue 04 Mar     , Timothy A. Meier wrote:
>> I wrote this patch so I could avoid passing around a pointer to the opensm, 
>> just to
>> get access to the log.  Also, it provides a method to get a pointer to the 
>> opensm
>> as well, because there are several instances where this is needed for a 
>> trivial reason,
>> and many functions include it as one of their arguments.
> 
> You can pass pointer to opensm object to a function where you structure
> is created (*_init() or so) and to store it there if you like. Basically
> in OpenSM we are avoiding to use global non-constant data and I don't
> see any really good reason to change this.
> 
I understand, and agree in principal with the philosophy.

In practice, however, this leads to many instances where a pointer to the
opensm object is just being casually added to the argument list of a function.
This is often done, just to get access to the log, or to pass the pointer through
to another function that "might" need it.  In these cases, a dependency is
needlessly created in the higher level function.

* I just feel that if a function has a legitimate need for the opensm object,
it shouldn't impose that requirement on its entire calling tree.

>> Since the opensm 
>> is a
>> singleton,
> 
> It could change some days.
> 
> Sasha
> 
No matter how it is created or initialized, the basic design assumes one and only
one OpenSM object.  In addition, the OpenSM object contains other objects (such as
the log) that are also unique.

If there comes a time when more than one opensm per thread of execution is required,
I suspect many things will need to be re-examined.

==

How about trying this out with just the log?  I think we will find this solves problems
without introducing any.  I'll whip up a patch for the log, and have you look at it...

-- 
Timothy A. Meier
Computer Scientist
ICCD/High Performance Computing
meier3 at llnl.gov



More information about the general mailing list