Open MPI logo

Hardware Locality Development Mailing List Archives

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

Subject: Re: [hwloc-devel] Hwloc perl binding
From: Brice Goglin (Brice.Goglin_at_[hidden])
Date: 2010-12-15 08:56:04

Le 15/12/2010 14:45, Bernd Kallies a écrit :
> The CPAN thing is the third implementation, which works with objects and
> accessor methods. It is as fast as the first implementation, and perl
> code looks almost like C code (except that it is not possible now to
> compare the hwloc_obj perl representatives by value).

Could you add something like obj->id which would contain a unique id
(the original C pointer?) that could be used to compare objects?

> In summary I'm very satisfied with this implementation. There remains
> the question how one should handle structs like hwloc_obj_memory_s and
> the like. In my implementation these are represented by perl hashes.
> SWIG code would map them to perl objects. The difference is:
> my: $obj->memory->{total_memory}
> OO: $obj->memory->total_memory
> The first variant is uncoupled from the hwloc_obj struct, and allows to
> change values or store additional things in the hash.
> The second variant may allow manipulation of the hwloc_obj struct in the
> memory of the C lib, but does not allow to store additional properties.

I don't know which one is better.

> In addition I noticed a lot of hwloc API functions that need a topology
> pointer in their parameter list, which is unused in the function. Will
> this become cleaned up in the future?

I'd say we have the topology parameter everywhere because the API looks
more consistent and because we may need it in the future.

Are you actually referring to the main API, or to inline helpers such as
hwloc/helpers.h ? The latter are not strictly part of the API, and may
be changed easily since they are not in the ABI.