• Home
  • Raw
  • Download

Lines Matching full:mask

23   class Mask : public KMPAffinity::Mask {
24 hwloc_cpuset_t mask; variable
27 Mask() { in Mask() function
28 mask = hwloc_bitmap_alloc(); in Mask()
31 ~Mask() { hwloc_bitmap_free(mask); } in ~Mask()
32 void set(int i) override { hwloc_bitmap_set(mask, i); } in set()
33 bool is_set(int i) const override { return hwloc_bitmap_isset(mask, i); } in is_set()
34 void clear(int i) override { hwloc_bitmap_clr(mask, i); } in clear()
35 void zero() override { hwloc_bitmap_zero(mask); } in zero()
36 void copy(const KMPAffinity::Mask *src) override { in copy()
37 const Mask *convert = static_cast<const Mask *>(src); in copy()
38 hwloc_bitmap_copy(mask, convert->mask); in copy()
40 void bitwise_and(const KMPAffinity::Mask *rhs) override { in bitwise_and()
41 const Mask *convert = static_cast<const Mask *>(rhs); in bitwise_and()
42 hwloc_bitmap_and(mask, mask, convert->mask); in bitwise_and()
44 void bitwise_or(const KMPAffinity::Mask *rhs) override { in bitwise_or()
45 const Mask *convert = static_cast<const Mask *>(rhs); in bitwise_or()
46 hwloc_bitmap_or(mask, mask, convert->mask); in bitwise_or()
48 void bitwise_not() override { hwloc_bitmap_not(mask, mask); } in bitwise_not()
49 int begin() const override { return hwloc_bitmap_first(mask); } in begin()
52 return hwloc_bitmap_next(mask, previous); in next()
58 hwloc_get_cpubind(__kmp_hwloc_topology, mask, HWLOC_CPUBIND_THREAD); in get_system_affinity()
72 hwloc_set_cpubind(__kmp_hwloc_topology, mask, HWLOC_CPUBIND_THREAD); in set_system_affinity()
90 unsigned long first_32_bits = hwloc_bitmap_to_ith_ulong(mask, i * 2); in get_proc_group()
92 hwloc_bitmap_to_ith_ulong(mask, i * 2 + 1); in get_proc_group()
138 KMPAffinity::Mask *mask; in bind_thread() local
139 KMP_CPU_ALLOC_ON_STACK(mask); in bind_thread()
140 KMP_CPU_ZERO(mask); in bind_thread()
141 KMP_CPU_SET(which, mask); in bind_thread()
142 __kmp_set_system_affinity(mask, TRUE); in bind_thread()
143 KMP_CPU_FREE_FROM_STACK(mask); in bind_thread()
145 KMPAffinity::Mask *allocate_mask() override { return new Mask(); } in allocate_mask()
146 void deallocate_mask(KMPAffinity::Mask *m) override { delete m; } in deallocate_mask()
147 KMPAffinity::Mask *allocate_mask_array(int num) override { in allocate_mask_array()
148 return new Mask[num]; in allocate_mask_array()
150 void deallocate_mask_array(KMPAffinity::Mask *array) override { in deallocate_mask_array()
151 Mask *hwloc_array = static_cast<Mask *>(array); in deallocate_mask_array()
154 KMPAffinity::Mask *index_mask_array(KMPAffinity::Mask *array, in index_mask_array()
156 Mask *hwloc_array = static_cast<Mask *>(array); in index_mask_array()
243 class Mask : public KMPAffinity::Mask {
248 mask_t *mask;
249 Mask() { mask = (mask_t *)__kmp_allocate(__kmp_affin_mask_size); } in Mask() function
250 ~Mask() { in ~Mask()
251 if (mask) in ~Mask()
252 __kmp_free(mask); in ~Mask()
255 mask[i / BITS_PER_MASK_T] |= ((mask_t)1 << (i % BITS_PER_MASK_T)); in set()
258 return (mask[i / BITS_PER_MASK_T] & ((mask_t)1 << (i % BITS_PER_MASK_T))); in is_set()
261 mask[i / BITS_PER_MASK_T] &= ~((mask_t)1 << (i % BITS_PER_MASK_T)); in clear()
265 mask[i] = 0; in zero()
267 void copy(const KMPAffinity::Mask *src) override { in copy()
268 const Mask *convert = static_cast<const Mask *>(src); in copy()
270 mask[i] = convert->mask[i]; in copy()
272 void bitwise_and(const KMPAffinity::Mask *rhs) override { in bitwise_and()
273 const Mask *convert = static_cast<const Mask *>(rhs); in bitwise_and()
275 mask[i] &= convert->mask[i]; in bitwise_and()
277 void bitwise_or(const KMPAffinity::Mask *rhs) override { in bitwise_or()
278 const Mask *convert = static_cast<const Mask *>(rhs); in bitwise_or()
280 mask[i] |= convert->mask[i]; in bitwise_or()
284 mask[i] = ~(mask[i]); in bitwise_not()
304 syscall(__NR_sched_getaffinity, 0, __kmp_affin_mask_size, mask); in get_system_affinity()
307 … pthread_getaffinity_np(pthread_self(), __kmp_affin_mask_size, reinterpret_cast<cpuset_t *>(mask)); in get_system_affinity()
324 syscall(__NR_sched_setaffinity, 0, __kmp_affin_mask_size, mask); in set_system_affinity()
327 … pthread_setaffinity_np(pthread_self(), __kmp_affin_mask_size, reinterpret_cast<cpuset_t *>(mask)); in set_system_affinity()
344 KMPAffinity::Mask *allocate_mask() override { in allocate_mask()
345 KMPNativeAffinity::Mask *retval = new Mask(); in allocate_mask()
348 void deallocate_mask(KMPAffinity::Mask *m) override { in deallocate_mask()
349 KMPNativeAffinity::Mask *native_mask = in deallocate_mask()
350 static_cast<KMPNativeAffinity::Mask *>(m); in deallocate_mask()
353 KMPAffinity::Mask *allocate_mask_array(int num) override { in allocate_mask_array()
354 return new Mask[num]; in allocate_mask_array()
356 void deallocate_mask_array(KMPAffinity::Mask *array) override { in deallocate_mask_array()
357 Mask *linux_array = static_cast<Mask *>(array); in deallocate_mask_array()
360 KMPAffinity::Mask *index_mask_array(KMPAffinity::Mask *array, in index_mask_array()
362 Mask *linux_array = static_cast<Mask *>(array); in index_mask_array()
371 class Mask : public KMPAffinity::Mask {
374 mask_t *mask; variable
377 Mask() { in Mask() function
378 mask = (mask_t *)__kmp_allocate(sizeof(mask_t) * __kmp_num_proc_groups); in Mask()
380 ~Mask() { in ~Mask()
381 if (mask) in ~Mask()
382 __kmp_free(mask); in ~Mask()
385 mask[i / BITS_PER_MASK_T] |= ((mask_t)1 << (i % BITS_PER_MASK_T)); in set()
388 return (mask[i / BITS_PER_MASK_T] & ((mask_t)1 << (i % BITS_PER_MASK_T))); in is_set()
391 mask[i / BITS_PER_MASK_T] &= ~((mask_t)1 << (i % BITS_PER_MASK_T)); in clear()
395 mask[i] = 0; in zero()
397 void copy(const KMPAffinity::Mask *src) override { in copy()
398 const Mask *convert = static_cast<const Mask *>(src); in copy()
400 mask[i] = convert->mask[i]; in copy()
402 void bitwise_and(const KMPAffinity::Mask *rhs) override { in bitwise_and()
403 const Mask *convert = static_cast<const Mask *>(rhs); in bitwise_and()
405 mask[i] &= convert->mask[i]; in bitwise_and()
407 void bitwise_or(const KMPAffinity::Mask *rhs) override { in bitwise_or()
408 const Mask *convert = static_cast<const Mask *>(rhs); in bitwise_or()
410 mask[i] |= convert->mask[i]; in bitwise_or()
414 mask[i] = ~(mask[i]); in bitwise_not()
431 // Check for a valid mask. in set_system_affinity()
443 ga.Mask = mask[group]; in set_system_affinity()
456 if (!SetThreadAffinityMask(GetCurrentThread(), *mask)) { in set_system_affinity()
481 (ga.Mask == 0)) { in get_system_affinity()
484 mask[ga.Group] = ga.Mask; in get_system_affinity()
512 *mask = retval; in get_system_affinity()
522 if (mask[i] == 0) in get_proc_group()
535 KMPAffinity::Mask *allocate_mask() override { return new Mask(); } in allocate_mask()
536 void deallocate_mask(KMPAffinity::Mask *m) override { delete m; } in deallocate_mask()
537 KMPAffinity::Mask *allocate_mask_array(int num) override { in allocate_mask_array()
538 return new Mask[num]; in allocate_mask_array()
540 void deallocate_mask_array(KMPAffinity::Mask *array) override { in deallocate_mask_array()
541 Mask *windows_array = static_cast<Mask *>(array); in deallocate_mask_array()
544 KMPAffinity::Mask *index_mask_array(KMPAffinity::Mask *array, in index_mask_array()
546 Mask *windows_array = static_cast<Mask *>(array); in index_mask_array()