summaryrefslogtreecommitdiff
path: root/libgomp/config/linux/affinity.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgomp/config/linux/affinity.c')
-rw-r--r--libgomp/config/linux/affinity.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/libgomp/config/linux/affinity.c b/libgomp/config/linux/affinity.c
index 17b65afb49a..775ee0a7fdf 100644
--- a/libgomp/config/linux/affinity.c
+++ b/libgomp/config/linux/affinity.c
@@ -353,6 +353,45 @@ gomp_affinity_print_place (void *p)
fprintf (stderr, ":%lu", len);
}
+int
+omp_get_place_num_procs (int place_num)
+{
+ if (place_num < 0 || place_num >= gomp_places_list_len)
+ return 0;
+
+ cpu_set_t *cpusetp = (cpu_set_t *) gomp_places_list[place_num];
+ return gomp_cpuset_popcount (gomp_cpuset_size, cpusetp);
+}
+
+void
+omp_get_place_proc_ids (int place_num, int *ids)
+{
+ if (place_num < 0 || place_num >= gomp_places_list_len)
+ return;
+
+ cpu_set_t *cpusetp = (cpu_set_t *) gomp_places_list[place_num];
+ unsigned long i, max = 8 * gomp_cpuset_size;
+ for (i = 0; i < max; i++)
+ if (CPU_ISSET_S (i, gomp_cpuset_size, cpusetp))
+ *ids++ = i;
+}
+
+void
+gomp_get_place_proc_ids_8 (int place_num, int64_t *ids)
+{
+ if (place_num < 0 || place_num >= gomp_places_list_len)
+ return;
+
+ cpu_set_t *cpusetp = (cpu_set_t *) gomp_places_list[place_num];
+ unsigned long i, max = 8 * gomp_cpuset_size;
+ for (i = 0; i < max; i++)
+ if (CPU_ISSET_S (i, gomp_cpuset_size, cpusetp))
+ *ids++ = i;
+}
+
+ialias(omp_get_place_num_procs)
+ialias(omp_get_place_proc_ids)
+
#else
#include "../posix/affinity.c"