17 #ifndef HWLOC_GLIBC_SCHED_H 18 #define HWLOC_GLIBC_SCHED_H 21 #include "hwloc/helper.h" 25 #if !defined _GNU_SOURCE || !defined _SCHED_H || (!defined CPU_SETSIZE && !defined sched_priority) 26 #error Please make sure to include sched.h before including glibc-sched.h, and define _GNU_SOURCE before any inclusion of sched.h 35 #ifdef HWLOC_HAVE_CPU_SET 56 static __hwloc_inline
int 58 cpu_set_t *schedset,
size_t schedsetsize)
62 CPU_ZERO_S(schedsetsize, schedset);
64 CPU_SET_S(cpu, schedsetsize, schedset);
69 assert(schedsetsize ==
sizeof(cpu_set_t));
71 CPU_SET(cpu, schedset);
84 static __hwloc_inline
int 86 const cpu_set_t *schedset,
size_t schedsetsize)
94 count = CPU_COUNT_S(schedsetsize, schedset);
97 if (CPU_ISSET_S(cpu, schedsetsize, schedset)) {
107 assert(schedsetsize ==
sizeof(cpu_set_t));
108 for(cpu=0; cpu<CPU_SETSIZE; cpu++)
109 if (CPU_ISSET(cpu, schedset))
static int hwloc_cpuset_from_glibc_sched_affinity(hwloc_topology_t topology, hwloc_cpuset_t hwlocset, const cpu_set_t *schedset, size_t schedsetsize)
Convert glibc sched affinity CPU set schedset into hwloc CPU set.
Definition: glibc-sched.h:85
struct hwloc_topology * hwloc_topology_t
Topology context.
Definition: hwloc.h:667
hwloc_const_bitmap_t hwloc_const_cpuset_t
A non-modifiable hwloc_cpuset_t.
Definition: hwloc.h:142
static int hwloc_cpuset_to_glibc_sched_affinity(hwloc_topology_t topology, hwloc_const_cpuset_t hwlocset, cpu_set_t *schedset, size_t schedsetsize)
Convert hwloc CPU set toposet into glibc sched affinity CPU set schedset.
Definition: glibc-sched.h:57
int hwloc_bitmap_set(hwloc_bitmap_t bitmap, unsigned id)
Add index id in bitmap bitmap.
void hwloc_bitmap_zero(hwloc_bitmap_t bitmap)
Empty the bitmap bitmap.
hwloc_bitmap_t hwloc_cpuset_t
A CPU set is a bitmap whose bits are set according to CPU physical OS indexes.
Definition: hwloc.h:140
#define hwloc_bitmap_foreach_end()
End of loop macro iterating on a bitmap.
Definition: bitmap.h:384
#define hwloc_bitmap_foreach_begin(id, bitmap)
Loop macro iterating on bitmap bitmap.
Definition: bitmap.h:370