Open MPI logo

Hardware Locality Development Mailing List Archives

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

Subject: Re: [hwloc-devel] perl bindings
From: Samuel Thibault (samuel.thibault_at_[hidden])
Date: 2011-01-21 11:09:12


Bernd Kallies, le Thu 20 Jan 2011 20:35:04 +0100, a écrit :
> On Thu, 2011-01-20 at 20:22 +0100, Samuel Thibault wrote:
> > Bernd Kallies, le Thu 20 Jan 2011 20:13:03 +0100, a écrit :
> > > The only thing I was wondering about are these OO method names, which I
> > > had to invent them myself. If there is some need to synchronize these
> > > with the python binding, we may agree about them. Backwards
> > > compatibility of the Perl binding is not a real problem, since there may
> > > be many aliases for a function in the base XS code.
> >
> > Could you perhaps list those you have defined already, if any?
>
> See
>
> http://search.cpan.org/~bka/Sys-Hwloc-0.10/lib/Sys/Hwloc/Topology.pod
> http://search.cpan.org/~bka/Sys-Hwloc-0.10/lib/Sys/Hwloc/Obj.pod
> http://search.cpan.org/~bka/Sys-Hwloc-0.10/lib/Sys/Hwloc/Cpuset.pod
> http://search.cpan.org/~bka/Sys-Hwloc-0.10/lib/Sys/Hwloc/Bitmap.pod

Well, I meant the ones for which you had to invent a name. These are
mostly the same as the C interface, hwloc_ prefix stripped. Are there
names that don't exactly map to a C function? I see there is a "not in
hwloc" section, I guess it is supposed to contain them all?

> HWLOC_XSAPI_VERSION always returns a version number (may be 0)

Ok

> HWLOC_HAS_XML flag if hwloc was built with XML support

Why do you need it? At worse the xml functions would fail.

> hwloc_compare_objects compares two Sys::Hwloc::Obj by C pointer value

Ok.

> hwloc_bitmap_ids returns bitmap bits as list of decimal numbers

That seems perl-specific indeed.

> hwloc_bitmap_list_sscanf parses a list format cpuset ASCII string
> hwloc_bitmap_list_sprintf outputs a list format cpuset ASCII string
> hwloc_bitmap_includes reverse of hwloc_bitmap_isincluded

I guess these could be added to the C API?

> http://search.cpan.org/~bka/Sys-Hwloc-0.10/lib/Sys/Hwloc.pm

Ok, that perl I can read :)

I'd say you shouldn't care about providing all the hwloc_cpuset_*
functions, since these names are deprecated in the C API.

> $mapa = hwloc_bitmap_dup($map)

Same issue as in Python: when a const bitmap is returned by a hwloc
function, the user shouldn't be able to modify it.

> hwloc_bitmap_from_ulong($set,$mask)
> hwloc_bitmap_from_ith_ulong($set,$i,$mask)
> hwloc_bitmap_set_ith_ulong($set,$i,$mask)
> $val = hwloc_bitmap_to_ulong($set)
> $val = hwloc_bitmap_to_ith_ulong($set,$i)

Same issue as in Python (but with different answer): AIUI, perl doesn't
have unbound integers, so has a limitation, but is possibly not exactly
like C longs. I guess these should just use the regular perl integer
name and size?

About area membind, same remark as for python: if someone uses perl to
drive C-library computations, it may be useful, but else it probably
doesn't make sense in pure perl.

Samuel