Open MPI logo

Hardware Locality Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Hardware Locality Development mailing list

Subject: Re: [hwloc-devel] -lhwloc in components.
From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2012-09-05 11:13:36


On Sep 5, 2012, at 11:08 AM, Samuel Thibault wrote:

>> No. It's not really an ltdl issue. ltdl is just a portable wrapper around OS-specific dlopen-like mechanisms.
>
> I understand that, but dlopen is usually used for plugins, and plugins
> usually need such kind of calling back into what loaded the plugin.

Sure. It's really a matter of the linker scopes.

IIRC, in a somewhat-recent version of ltdl (I don't remember the version offhand -- perhaps somewhere in the 2.2 series?), they changed the default of lt_dlopen to start opening plugins in private scopes, not the global scope. That's what has contributed to this hubaloo -- by default, plugins can no longer see the global scope, which is typically where the symbols are that they need to resolve (e.g., in the libhwloc.so that is linked in to lstopo).

>>> One way would be to pass to the component a structure with all the
>>> useful function pointers (using #define to keep the same source code).
>>
>> We thought about this in OMPI and decided it would be a nightmare in the source code.
>
> The source code shouldn't need to be modified:
>
> #define hwloc_foo_bar(arg1, arg2) hwloc_funcs->foo_bar(arg1, arg2)

You need to make sure that #define is only effected in certain places in the code. And you need to ensure that hwloc_funcs->[foo] isn't attempted to be used before it has been filled in. And unless there is a very fixed set of functions that can be called by plugins, you'll probably need to grow hwloc_funcs over time, which may lead to ABI issues...?

-- 
Jeff Squyres
jsquyres_at_[hidden]
For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/