Sys-Hwloc

 view release on metacpan or  search on metacpan

Hwloc.xs  view on Meta::CPAN

  PROTOTYPE:
  CODE:
    RETVAL = hwloc_get_api_version();
  OUTPUT:
    RETVAL

#else
void
hwloc_get_api_version()
  PROTOTYPE:
  PPCODE:
    XSRETURN_UNDEF;

#endif

 # -------------------------------------------------------------------
 # Topology object types
 # -------------------------------------------------------------------

int
hwloc_compare_types(type1,type2)

Hwloc.xs  view on Meta::CPAN

 # -------------------------------------------------------------------
 # Create and destroy topologies
 # -------------------------------------------------------------------

void
hwloc_topology_check(topo)
  hwloc_topology_t topo
  PROTOTYPE: $
  ALIAS:
    Sys::Hwloc::Topology::check = 1
  PPCODE:
    PERL_UNUSED_VAR(ix);
    hwloc_topology_check(topo);


void
hwloc_topology_destroy(topo)
  hwloc_topology_t topo
  PROTOTYPE: $
  ALIAS:
    Sys::Hwloc::Topology::destroy = 1
  PPCODE:
    PERL_UNUSED_VAR(ix);
    if(topo) {
      hwloc_topology_destroy(topo);
      sv_setref_pv(ST(0), "Sys::Hwloc::Topology", (void *)NULL);
    }


hwloc_topology_t
hwloc_topology_init()
  PROTOTYPE:

Hwloc.xs  view on Meta::CPAN

 # -------------------------------------------------------------------

#if HWLOC_HAS_XML
void
hwloc_topology_export_xml(topo,path)
  hwloc_topology_t  topo
  const char       *path
  PROTOTYPE: $$
  ALIAS:
    Sys::Hwloc::Topology::export_xml = 1
  PPCODE:
    PERL_UNUSED_VAR(ix);
    hwloc_topology_export_xml(topo,path);

#endif


 # -------------------------------------------------------------------
 # Get some topology information
 # -------------------------------------------------------------------

Hwloc.xs  view on Meta::CPAN

hwloc_get_closest_objs(topo,obj)
  hwloc_topology_t topo
  hwloc_obj_t      obj
  PROTOTYPE: $$
  ALIAS:
    Sys::Hwloc::Topology::get_closest_objs = 1
  PREINIT:
    int rc;
    int i;
    hwloc_obj_t *objs = NULL;
  PPCODE:
    PERL_UNUSED_VAR(ix);
    if((objs = (hwloc_obj_t *)malloc(1024 * sizeof(hwloc_obj_t *))) == NULL)
      croak("Failed to allocate memory");
    rc = hwloc_get_closest_objs(topo,obj,objs,1024);
    if(rc < 0)
      rc = 0;
    EXTEND(SP, rc);
    for(i = 0; i < rc; i++)
      PUSHs(sv_2mortal(hwlocObj2SV(objs[i])));
    free(objs);

Hwloc.xs  view on Meta::CPAN

  OUTPUT:
    RETVAL


void
children(o)
  hwloc_obj_t o
  PROTOTYPE: $
  PREINIT:
    int i;
  PPCODE:
    EXTEND(SP, o->arity);
    for(i = 0; i < o->arity; i++)
      PUSHs(sv_2mortal(hwlocObj2SV(o->children[i])));
    XSRETURN(o->arity);


hwloc_obj_t
first_child(o)
  hwloc_obj_t o
  PROTOTYPE: $

Hwloc.xs  view on Meta::CPAN

      RETVAL = s;
  OUTPUT:
      RETVAL


void
copy(set,dst)
  hwloc_cpuset_t set
  hwloc_cpuset_t dst
  PROTOTYPE: $$
  PPCODE:
    hwloc_cpuset_copy(dst,set);


#if HWLOC_XSAPI_VERSION
void
and(set,seta)
  hwloc_cpuset_t set
  hwloc_cpuset_t seta
  PROTOTYPE: $$
  ALIAS:
    Sys::Hwloc::Cpuset::andnot = 1
    Sys::Hwloc::Cpuset::or     = 2
    Sys::Hwloc::Cpuset::xor    = 3
  PREINIT:
    hwloc_cpuset_t res = NULL;
  PPCODE:
    if((res = hwloc_cpuset_alloc()) == NULL)
      croak("Failed to create temporary cpuset in Sys::Hwloc::Cpuset->and alias %d", (int)ix);
    if(ix == 0)
      hwloc_cpuset_and(res,set,seta);
    else if(ix == 1)
      hwloc_cpuset_andnot(res,set,seta);
    else if(ix == 2)
      hwloc_cpuset_or(res,set,seta);
    else if(ix == 3)
      hwloc_cpuset_xor(res,set,seta);

Hwloc.xs  view on Meta::CPAN

    hwloc_cpuset_free(set);
    sv_setref_pv(ST(0), "Sys::Hwloc::Cpuset", (void *)res);


void
not(set)
  hwloc_cpuset_t set
  PROTOTYPE: $
  PREINIT:
    hwloc_cpuset_t res = NULL;
  PPCODE:
    if((res = hwloc_cpuset_alloc()) == NULL)
      croak("Failed to create temporary cpuset in Sys::Hwloc::Cpuset->not");
    hwloc_cpuset_not(res,set);
    hwloc_cpuset_free(set);
    sv_setref_pv(ST(0), "Sys::Hwloc::Cpuset", (void *)res);

#else
void
and(set,seta)
  hwloc_cpuset_t set
  hwloc_cpuset_t seta
  PROTOTYPE: $$
  ALIAS:
    Sys::Hwloc::Cpuset::or     = 2
    Sys::Hwloc::Cpuset::xor    = 3
  PPCODE:
    if(ix == 0)
      hwloc_cpuset_andset(set,seta);
    else if(ix == 2)
      hwloc_cpuset_orset(set,seta);
    else if(ix == 3)
      hwloc_cpuset_xorset(set,seta);
    else
      croak("Should not come here in Sys::Hwloc::Cpuset->and, alias = %d", (int)ix);

#endif

Hwloc.xs  view on Meta::CPAN

      RETVAL = s;
  OUTPUT:
      RETVAL


void
copy(map,dst)
  hwloc_bitmap_t map
  hwloc_bitmap_t dst
  PROTOTYPE: $$
  PPCODE:
    hwloc_bitmap_copy(dst,map);


void
and(map,mapa)
  hwloc_bitmap_t map
  hwloc_bitmap_t mapa
  PROTOTYPE: $$
  ALIAS:
    Sys::Hwloc::Bitmap::andnot = 1
    Sys::Hwloc::Bitmap::or     = 2
    Sys::Hwloc::Bitmap::xor    = 3
  PREINIT:
    hwloc_bitmap_t res = NULL;
  PPCODE:
    if((res = hwloc_bitmap_alloc()) == NULL)
      croak("Failed to create temporary bitmap in Sys::Hwloc::Bitmap->and alias %d", (int)ix);
    if(ix == 0)
      hwloc_bitmap_and(res,map,mapa);
    else if(ix == 1)
      hwloc_bitmap_andnot(res,map,mapa);
    else if(ix == 2)
      hwloc_bitmap_or(res,map,mapa);
    else if(ix == 3)
      hwloc_bitmap_xor(res,map,mapa);

Hwloc.xs  view on Meta::CPAN

    hwloc_bitmap_free(map);
    sv_setref_pv(ST(0), "Sys::Hwloc::Bitmap", (void *)res);


void
not(map)
  hwloc_bitmap_t map
  PROTOTYPE: $
  PREINIT:
    hwloc_bitmap_t res = NULL;
  PPCODE:
    if((res = hwloc_bitmap_alloc()) == NULL)
      croak("Failed to create temporary bitmap in Sys::Hwloc::Bitmap->not");
    hwloc_bitmap_not(res,map);
    hwloc_bitmap_free(map);
    sv_setref_pv(ST(0), "Sys::Hwloc::Bitmap", (void *)res);

#endif

fallback/const-xs.inc  view on Meta::CPAN

	dTARGET;
#endif
	STRLEN		len;
        int		type;
	IV		iv;
	/* NV		nv;	Uncomment this if you need to return NVs */
	/* const char	*pv;	Uncomment this if you need to return PVs */
    INPUT:
	SV *		sv;
        const char *	s = SvPV(sv, len);
    PPCODE:
        /* Change this to constant(aTHX_ s, len, &iv, &nv);
           if you need to return both NVs and IVs */
	type = constant(aTHX_ s, len, &iv);
      /* Return 1 or 2 items. First is error message, or undef if no error.
           Second, if present, is found value */
        switch (type) {
        case PERL_constant_NOTFOUND:
          sv = sv_2mortal(newSVpvf("%s is not a valid Sys::Hwloc macro", s));
          PUSHs(sv);
          break;

hwloc_bitmap.xsh  view on Meta::CPAN

  PROTOTYPE: $
  ALIAS:
    Sys::Hwloc::Bitmap::free          = 1
    Sys::Hwloc::Bitmap::destroy       = 2
    Sys::Hwloc::hwloc_bitmap_fill     = 10
    Sys::Hwloc::Bitmap::fill          = 11
    Sys::Hwloc::hwloc_bitmap_singlify = 20
    Sys::Hwloc::Bitmap::singlify      = 21
    Sys::Hwloc::hwloc_bitmap_zero     = 30
    Sys::Hwloc::Bitmap::zero          = 31
  PPCODE:
    if(ix < 10) {
      hwloc_bitmap_free(map);
      sv_setref_pv(ST(0), "Sys::Hwloc::Bitmap", (void *)NULL);
    }
    else if(ix < 20)
      hwloc_bitmap_fill(map);
    else if(ix < 30)
      hwloc_bitmap_singlify(map);
    else if(ix < 40)
      hwloc_bitmap_zero(map);

hwloc_bitmap.xsh  view on Meta::CPAN

  unsigned       id
  PROTOTYPE: $$
  ALIAS:
    Sys::Hwloc::Bitmap::allbut      = 1
    Sys::Hwloc::hwloc_bitmap_clr    = 10
    Sys::Hwloc::Bitmap::clr         = 11
    Sys::Hwloc::hwloc_bitmap_only   = 20
    Sys::Hwloc::Bitmap::only        = 21
    Sys::Hwloc::hwloc_bitmap_set    = 30
    Sys::Hwloc::Bitmap::set         = 31
  PPCODE:
    if(ix < 10)
      hwloc_bitmap_allbut(map,id);
    else if(ix < 20)
      hwloc_bitmap_clr(map,id);
    else if(ix < 30)
      hwloc_bitmap_only(map,id);
    else if(ix < 40)
      hwloc_bitmap_set(map,id);
    else
      croak("Should not come here in Sys::Hwloc::hwloc_bitmap_allbut, alias = %d", (int)ix);

hwloc_bitmap.xsh  view on Meta::CPAN

void
hwloc_bitmap_clr_range(map,begin,end)
  hwloc_bitmap_t map
  unsigned       begin
  unsigned       end
  PROTOTYPE: $$$
  ALIAS:
    Sys::Hwloc::Bitmap::clr_range      = 1
    Sys::Hwloc::hwloc_bitmap_set_range = 10
    Sys::Hwloc::Bitmap::set_range      = 11
  PPCODE:
    if(ix < 10)
      hwloc_bitmap_clr_range(map,begin,end);
    else if(ix < 20)
      hwloc_bitmap_set_range(map,begin,end);
    else
      croak("Should not come here in Sys::Hwloc::hwloc_bitmap_clr_range, alias = %d", (int)ix);


void
hwloc_bitmap_copy(dst,src)
  hwloc_bitmap_t dst
  hwloc_bitmap_t src
  PROTOTYPE: $$
  PPCODE:
    hwloc_bitmap_copy(dst,src);


void
hwloc_bitmap_from_ith_ulong(map,i,mask)
  hwloc_bitmap_t map
  unsigned       i
  unsigned long  mask
  PROTOTYPE: $$$
  ALIAS:
    Sys::Hwloc::Bitmap::from_ith_ulong     = 1
    Sys::Hwloc::hwloc_bitmap_set_ith_ulong = 10
    Sys::Hwloc::Bitmap::set_ith_ulong      = 11
  PREINIT:
    unsigned long lmask = mask;
  PPCODE:
    if(ix < 10)
      hwloc_bitmap_from_ith_ulong(map,i,lmask);
    else if(ix < 20)
      hwloc_bitmap_set_ith_ulong(map,i,lmask);
    else
      croak("Should not come here in Sys::Hwloc::hwloc_bitmap_from_ith_ulong, alias = %d", (int)ix);


int
hwloc_bitmap_sscanf(map,string)

hwloc_bitmap.xsh  view on Meta::CPAN


void
hwloc_bitmap_from_ulong(map,mask)
  hwloc_bitmap_t map
  unsigned long  mask
  PROTOTYPE: $$
  ALIAS:
    Sys::Hwloc::Bitmap::from_ulong = 1
  PREINIT:
    unsigned long lmask = mask;
  PPCODE:
    PERL_UNUSED_VAR(ix);
    hwloc_bitmap_from_ulong(map,lmask);


 # -- setlogic

void
hwloc_bitmap_and(res,map1,map2)
  hwloc_bitmap_t res
  hwloc_bitmap_t map1
  hwloc_bitmap_t map2
  PROTOTYPE: $$$
  ALIAS:
    Sys::Hwloc::hwloc_bitmap_andnot = 1
    Sys::Hwloc::hwloc_bitmap_or     = 2
    Sys::Hwloc::hwloc_bitmap_xor    = 3
  PPCODE:
    if(ix == 0)
      hwloc_bitmap_and(res,map1,map2);
    else if(ix == 1)
      hwloc_bitmap_andnot(res,map1,map2);
    else if(ix == 2)
      hwloc_bitmap_or(res,map1,map2);
    else if(ix == 3)
      hwloc_bitmap_xor(res,map1,map2);
    else
      croak("Should not come here in Sys::Hwloc::hwloc_bitmap_and, alias = %d", (int)ix);


void
hwloc_bitmap_not(res,map)
  hwloc_bitmap_t res
  hwloc_bitmap_t map
  PROTOTYPE: $$
  PPCODE:
    hwloc_bitmap_not(res,map);


 # -- get

int
hwloc_bitmap_first(map)
  hwloc_bitmap_t map
  PROTOTYPE: $
  ALIAS:

hwloc_bitmap.xsh  view on Meta::CPAN


void
hwloc_bitmap_ids(map)
  hwloc_bitmap_t map
  PROTOTYPE: $
  ALIAS:
  Sys::Hwloc::Bitmap::ids = 1
  PREINIT:
    unsigned id;
    int      count = 0;
  PPCODE:
    PERL_UNUSED_VAR(ix);
    hwloc_bitmap_foreach_begin(id,map) {
      mXPUSHu(id);
      count++;
    }
    hwloc_bitmap_foreach_end();
    XSRETURN(count);


SV *

hwloc_bitmap.xsh  view on Meta::CPAN

  hwloc_bitmap_t   nodeset
  PROTOTYPE: $$$
  ALIAS:
    Sys::Hwloc::Topology::cpuset_to_nodeset          = 1
    Sys::Hwloc::hwloc_cpuset_to_nodeset_strict       = 10
    Sys::Hwloc::Topology::cpuset_to_nodeset_strict   = 11
    Sys::Hwloc::hwloc_cpuset_from_nodeset            = 20
    Sys::Hwloc::Topology::cpuset_from_nodeset        = 21
    Sys::Hwloc::hwloc_cpuset_from_nodeset_strict     = 30
    Sys::Hwloc::Topology::cpuset_from_nodeset_strict = 31
  PPCODE:
    if(ix < 10)
      hwloc_cpuset_to_nodeset(topo,cpuset,nodeset);
    else if(ix < 20)
      hwloc_cpuset_to_nodeset_strict(topo,cpuset,nodeset);
    else if(ix < 30)
      hwloc_cpuset_from_nodeset(topo,cpuset,nodeset);
    else if(ix < 40)
      hwloc_cpuset_from_nodeset_strict(topo,cpuset,nodeset);
    else
      croak("Should not come here in Sys::Hwloc::hwloc_cpuset_to_nodeset, alias = %d", (int)ix);

hwloc_bitmap.xsh  view on Meta::CPAN

hwloc_get_largest_objs_inside_cpuset(topo,set)
  hwloc_topology_t topo
  hwloc_bitmap_t   set
  PROTOTYPE: $$
  ALIAS:
    Sys::Hwloc::Topology::get_largest_objs_inside_cpuset = 1
  PREINIT:
    int rc;
    int i;
    hwloc_obj_t *objs = NULL;
  PPCODE:
    PERL_UNUSED_VAR(ix);
    if((objs = (hwloc_obj_t *)malloc(1024 * sizeof(hwloc_obj_t *))) == NULL)
      croak("Failed to allocate memory");
    rc = hwloc_get_largest_objs_inside_cpuset(topo,set,objs,1024);
    if(rc < 0)
      rc = 0;
    EXTEND(SP, rc);
    for(i = 0; i < rc; i++)
      PUSHs(sv_2mortal(hwlocObj2SV(objs[i])));
    free(objs);

hwloc_cpuset.xsh  view on Meta::CPAN

  PROTOTYPE: $
  ALIAS:
    Sys::Hwloc::Cpuset::free          = 1
    Sys::Hwloc::Cpuset::destroy       = 2
    Sys::Hwloc::hwloc_cpuset_fill     = 10
    Sys::Hwloc::Cpuset::fill          = 11
    Sys::Hwloc::hwloc_cpuset_singlify = 20
    Sys::Hwloc::Cpuset::singlify      = 21
    Sys::Hwloc::hwloc_cpuset_zero     = 30
    Sys::Hwloc::Cpuset::zero          = 31
  PPCODE:
    if(ix < 10) {
      hwloc_cpuset_free(set);
      sv_setref_pv(ST(0), "Sys::Hwloc::Cpuset", (void *)NULL);
    }
    else if(ix < 20)
      hwloc_cpuset_fill(set);
    else if(ix < 30)
      hwloc_cpuset_singlify(set);
    else if(ix < 40)
      hwloc_cpuset_zero(set);

hwloc_cpuset.xsh  view on Meta::CPAN

  unsigned       cpu
  PROTOTYPE: $$
  ALIAS:
    Sys::Hwloc::Cpuset::all_but_cpu = 1
    Sys::Hwloc::hwloc_cpuset_clr    = 10
    Sys::Hwloc::Cpuset::clr         = 11
    Sys::Hwloc::hwloc_cpuset_cpu    = 20
    Sys::Hwloc::Cpuset::cpu         = 21
    Sys::Hwloc::hwloc_cpuset_set    = 30
    Sys::Hwloc::Cpuset::set         = 31
  PPCODE:
    if(ix < 10)
      hwloc_cpuset_all_but_cpu(set,cpu);
    else if(ix < 20)
      hwloc_cpuset_clr(set,cpu);
    else if(ix < 30)
      hwloc_cpuset_cpu(set,cpu);
    else if(ix < 40)
      hwloc_cpuset_set(set,cpu);
    else
      croak("Should not come here in Sys::Hwloc::hwloc_cpuset_all_but_cpu, alias = %d", (int)ix);

hwloc_cpuset.xsh  view on Meta::CPAN


#if HWLOC_XSAPI_VERSION
void
hwloc_cpuset_clr_range(set,cpua,cpue)
  hwloc_cpuset_t set
  unsigned       cpua
  unsigned       cpue
  PROTOTYPE: $$$
  ALIAS:
    Sys::Hwloc::Cpuset::clr_range      = 1
  PPCODE:
    PERL_UNUSED_VAR(ix);
    hwloc_cpuset_clr_range(set,cpua,cpue);

#endif


void
hwloc_cpuset_set_range(set,cpua,cpue)
  hwloc_cpuset_t set
  unsigned       cpua
  unsigned       cpue
  PROTOTYPE: $$$
  ALIAS:
    Sys::Hwloc::Cpuset::set_range      = 1
  PPCODE:
    PERL_UNUSED_VAR(ix);
    hwloc_cpuset_set_range(set,cpua,cpue);


void
hwloc_cpuset_copy(dst,src)
  hwloc_cpuset_t dst
  hwloc_cpuset_t src
  PROTOTYPE: $$
  PPCODE:
    hwloc_cpuset_copy(dst,src);


void
hwloc_cpuset_from_ith_ulong(set,i,mask)
  hwloc_cpuset_t set
  unsigned       i
  unsigned long  mask
  PROTOTYPE: $$$
  ALIAS:
    Sys::Hwloc::Cpuset::from_ith_ulong = 1
  PREINIT:
    unsigned long lmask = mask;
  PPCODE:
    PERL_UNUSED_VAR(ix);
    hwloc_cpuset_from_ith_ulong(set,i,lmask);


#if HWLOC_XSAPI_VERSION
int
hwloc_cpuset_from_string(set,string)
  hwloc_cpuset_t  set
  const char     *string
  PROTOTYPE: $$

hwloc_cpuset.xsh  view on Meta::CPAN


void
hwloc_cpuset_from_ulong(set,mask)
  hwloc_cpuset_t set
  unsigned long  mask
  PROTOTYPE: $$
  ALIAS:
    Sys::Hwloc::Cpuset::from_ulong = 1
  PREINIT:
    unsigned long lmask = mask;
  PPCODE:
    PERL_UNUSED_VAR(ix);
    hwloc_cpuset_from_ulong(set,lmask);


 # -- setlogic

#if HWLOC_XSAPI_VERSION
void
hwloc_cpuset_and(res,set1,set2)
  hwloc_cpuset_t res
  hwloc_cpuset_t set1
  hwloc_cpuset_t set2
  PROTOTYPE: $$$
  ALIAS:
    Sys::Hwloc::hwloc_cpuset_andnot = 1
    Sys::Hwloc::hwloc_cpuset_or     = 2
    Sys::Hwloc::hwloc_cpuset_xor    = 3
  PPCODE:
    if(ix == 0)
      hwloc_cpuset_and(res,set1,set2);
    else if(ix == 1)
      hwloc_cpuset_andnot(res,set1,set2);
    else if(ix == 2)
      hwloc_cpuset_or(res,set1,set2);
    else if(ix == 3)
      hwloc_cpuset_xor(res,set1,set2);
    else
      croak("Should not come here in Sys::Hwloc::hwloc_cpuset_and, alias = %d", (int)ix);


void
hwloc_cpuset_not(res,set)
  hwloc_cpuset_t res
  hwloc_cpuset_t set
  PROTOTYPE: $$
  PPCODE:
    hwloc_cpuset_not(res,set);

#else
void
hwloc_cpuset_andset(set1,set2)
  hwloc_cpuset_t set1
  hwloc_cpuset_t set2
  PROTOTYPE: $$
  ALIAS:
    Sys::Hwloc::hwloc_cpuset_orset  = 2
    Sys::Hwloc::hwloc_cpuset_xorset = 3
  PPCODE:
    if(ix == 0)
      hwloc_cpuset_andset(set1,set2);
    else if(ix == 2)
      hwloc_cpuset_orset(set1,set2);
    else if(ix == 3)
      hwloc_cpuset_xorset(set1,set2);
    else
      croak("Should not come here in Sys::Hwloc::hwloc_cpuset_andset, alias = %d", (int)ix);

#endif

hwloc_cpuset.xsh  view on Meta::CPAN


void
hwloc_cpuset_ids(set)
  hwloc_cpuset_t set
  PROTOTYPE: $
  ALIAS:
  Sys::Hwloc::Cpuset::ids = 1
  PREINIT:
    unsigned id;
    int      count = 0;
  PPCODE:
    PERL_UNUSED_VAR(ix);
    hwloc_cpuset_foreach_begin(id,set) {
      mXPUSHu(id);
      count++;
    }
    hwloc_cpuset_foreach_end();
    XSRETURN(count);


SV *

hwloc_cpuset.xsh  view on Meta::CPAN

hwloc_get_largest_objs_inside_cpuset(topo,set)
  hwloc_topology_t topo
  hwloc_cpuset_t   set
  PROTOTYPE: $$
  ALIAS:
    Sys::Hwloc::Topology::get_largest_objs_inside_cpuset = 1
  PREINIT:
    int rc;
    int i;
    hwloc_obj_t *objs = NULL;
  PPCODE:
    PERL_UNUSED_VAR(ix);
    if((objs = (hwloc_obj_t *)malloc(1024 * sizeof(hwloc_obj_t *))) == NULL)
      croak("Failed to allocate memory");
    rc = hwloc_get_largest_objs_inside_cpuset(topo,set,objs,1024);
    if(rc < 0)
      rc = 0;
    EXTEND(SP, rc);
    for(i = 0; i < rc; i++)
      PUSHs(sv_2mortal(hwlocObj2SV(objs[i])));
    free(objs);



( run in 0.564 second using v1.01-cache-2.11-cpan-5511b514fd6 )