hwlocality\_glibc\_sched(3) Library Functions Manual hwlocality\_glibc\_sched(3)

# [NAME](#NAME)

hwlocality\_glibc\_sched - Interoperability with glibc sched affinity

# [SYNOPSIS](#SYNOPSIS)

## [Functions](#Functions)

int **hwloc\_cpuset\_to\_glibc\_sched\_affinity** (**hwloc\_topology\_t** topology, **hwloc\_const\_cpuset\_t** hwlocset, cpu\_set\_t \*schedset, size\_t schedsetsize)  
int **hwloc\_cpuset\_from\_glibc\_sched\_affinity** (**hwloc\_topology\_t** topology, **hwloc\_cpuset\_t** hwlocset, const cpu\_set\_t \*schedset, size\_t schedsetsize)

# [Detailed Description](#Detailed_Description)

This interface offers ways to convert between hwloc cpusets and glibc cpusets such as those manipulated by sched\_getaffinity() or pthread\_attr\_setaffinity\_np().

**Note**

Topology topology must match the current machine.

# [Function Documentation](#Function_Documentation)

## [int hwloc\_cpuset\_from\_glibc\_sched\_affinity (**hwloc\_topology\_t** topology, **hwloc\_cpuset\_t** hwlocset, const cpu\_set\_t * schedset, size\_t schedsetsize) \[inline\]](#int_hwloc_cpuset_from_glibc_sched_affinity_%28)

Convert glibc sched affinity CPU set schedset into hwloc CPU set. This function may be used before calling sched\_setaffinity or any other function that takes a cpu\_set\_t as input parameter.

schedsetsize should be sizeof(cpu\_set\_t) unless schedset was dynamically allocated with CPU\_ALLOC

**Returns**

0 on success.

-1 with errno set to ENOMEM if some internal reallocation failed.

## [int hwloc\_cpuset\_to\_glibc\_sched\_affinity (**hwloc\_topology\_t** topology, **hwloc\_const\_cpuset\_t** hwlocset, cpu\_set\_t * schedset, size\_t schedsetsize) \[inline\]](#int_hwloc_cpuset_to_glibc_sched_affinity_%28)

Convert hwloc CPU set toposet into glibc sched affinity CPU set schedset. This function may be used before calling sched\_setaffinity or any other function that takes a cpu\_set\_t as input parameter.

schedsetsize should be sizeof(cpu\_set\_t) unless schedset was dynamically allocated with CPU\_ALLOC

**Returns**

0\.

# [Author](#Author)

Generated automatically by Doxygen for Hardware Locality (hwloc) from the source code.

Version 2.15.0 Hardware Locality (hwloc)

---

Document: hwloc_cpuset_from_glibc_sched_affinity(3) from hwloc-cuda-12.8 2.15.0-r0 (Chainguard OS)
Source: https://github.com/open-mpi/hwloc
