00001
00002
00003
00004
00005
00006
00011 #ifndef HWLOC_CPUSET_H
00012 #define HWLOC_CPUSET_H
00013
00014 #include <hwloc/config.h>
00015
00016
00030 typedef struct hwloc_cpuset_s * hwloc_cpuset_t;
00031 typedef const struct hwloc_cpuset_s * hwloc_const_cpuset_t;
00032
00033
00034
00035
00036
00037
00044 HWLOC_DECLSPEC hwloc_cpuset_t hwloc_cpuset_alloc(void) __hwloc_attribute_malloc;
00045
00047 HWLOC_DECLSPEC void hwloc_cpuset_free(hwloc_cpuset_t set);
00048
00050 HWLOC_DECLSPEC hwloc_cpuset_t hwloc_cpuset_dup(hwloc_const_cpuset_t set) __hwloc_attribute_malloc;
00051
00053 HWLOC_DECLSPEC void hwloc_cpuset_copy(hwloc_cpuset_t dst, hwloc_const_cpuset_t src);
00054
00055
00056
00057
00058
00059
00067 HWLOC_DECLSPEC int hwloc_cpuset_snprintf(char * __hwloc_restrict buf, size_t buflen, hwloc_const_cpuset_t set);
00068
00074 HWLOC_DECLSPEC int hwloc_cpuset_asprintf(char ** strp, hwloc_const_cpuset_t set);
00075
00080 HWLOC_DECLSPEC int hwloc_cpuset_from_string(hwloc_cpuset_t set, const char * __hwloc_restrict string);
00081
00082
00083
00084
00085
00086
00088 HWLOC_DECLSPEC void hwloc_cpuset_zero(hwloc_cpuset_t set);
00089
00091 HWLOC_DECLSPEC void hwloc_cpuset_fill(hwloc_cpuset_t set);
00092
00094 HWLOC_DECLSPEC void hwloc_cpuset_from_ulong(hwloc_cpuset_t set, unsigned long mask);
00095
00097 HWLOC_DECLSPEC void hwloc_cpuset_from_ith_ulong(hwloc_cpuset_t set, unsigned i, unsigned long mask);
00098
00100 HWLOC_DECLSPEC unsigned long hwloc_cpuset_to_ulong(hwloc_const_cpuset_t set) __hwloc_attribute_pure;
00101
00103 HWLOC_DECLSPEC unsigned long hwloc_cpuset_to_ith_ulong(hwloc_const_cpuset_t set, unsigned i) __hwloc_attribute_pure;
00104
00106 HWLOC_DECLSPEC void hwloc_cpuset_cpu(hwloc_cpuset_t set, unsigned cpu);
00107
00109 HWLOC_DECLSPEC void hwloc_cpuset_all_but_cpu(hwloc_cpuset_t set, unsigned cpu);
00110
00112 HWLOC_DECLSPEC void hwloc_cpuset_set(hwloc_cpuset_t set, unsigned cpu);
00113
00115 HWLOC_DECLSPEC void hwloc_cpuset_set_range(hwloc_cpuset_t set, unsigned begincpu, unsigned endcpu);
00116
00118 HWLOC_DECLSPEC void hwloc_cpuset_clr(hwloc_cpuset_t set, unsigned cpu);
00119
00121 HWLOC_DECLSPEC void hwloc_cpuset_clr_range(hwloc_cpuset_t set, unsigned begincpu, unsigned endcpu);
00122
00124 HWLOC_DECLSPEC int hwloc_cpuset_isset(hwloc_const_cpuset_t set, unsigned cpu) __hwloc_attribute_pure;
00125
00127 HWLOC_DECLSPEC int hwloc_cpuset_iszero(hwloc_const_cpuset_t set) __hwloc_attribute_pure;
00128
00130 HWLOC_DECLSPEC int hwloc_cpuset_isfull(hwloc_const_cpuset_t set) __hwloc_attribute_pure;
00131
00133 HWLOC_DECLSPEC int hwloc_cpuset_isequal (hwloc_const_cpuset_t set1, hwloc_const_cpuset_t set2) __hwloc_attribute_pure;
00134
00136 HWLOC_DECLSPEC int hwloc_cpuset_intersects (hwloc_const_cpuset_t set1, hwloc_const_cpuset_t set2) __hwloc_attribute_pure;
00137
00139 HWLOC_DECLSPEC int hwloc_cpuset_isincluded (hwloc_const_cpuset_t sub_set, hwloc_const_cpuset_t super_set) __hwloc_attribute_pure;
00140
00142 HWLOC_DECLSPEC void hwloc_cpuset_or (hwloc_cpuset_t res, hwloc_const_cpuset_t set1, hwloc_const_cpuset_t set2);
00143
00145 HWLOC_DECLSPEC void hwloc_cpuset_and (hwloc_cpuset_t res, hwloc_const_cpuset_t set1, hwloc_const_cpuset_t set2);
00146
00148 HWLOC_DECLSPEC void hwloc_cpuset_andnot (hwloc_cpuset_t res, hwloc_const_cpuset_t set1, hwloc_const_cpuset_t set2);
00149
00151 HWLOC_DECLSPEC void hwloc_cpuset_xor (hwloc_cpuset_t res, hwloc_const_cpuset_t set1, hwloc_const_cpuset_t set2);
00152
00154 HWLOC_DECLSPEC void hwloc_cpuset_not (hwloc_cpuset_t res, hwloc_const_cpuset_t set);
00155
00160 HWLOC_DECLSPEC int hwloc_cpuset_first(hwloc_const_cpuset_t set) __hwloc_attribute_pure;
00161
00166 HWLOC_DECLSPEC int hwloc_cpuset_last(hwloc_const_cpuset_t set) __hwloc_attribute_pure;
00167
00172 HWLOC_DECLSPEC int hwloc_cpuset_next(hwloc_const_cpuset_t set, unsigned prev_cpu) __hwloc_attribute_pure;
00173
00180 HWLOC_DECLSPEC void hwloc_cpuset_singlify(hwloc_cpuset_t set);
00181
00187 HWLOC_DECLSPEC int hwloc_cpuset_compare_first(hwloc_const_cpuset_t set1, hwloc_const_cpuset_t set2) __hwloc_attribute_pure;
00188
00194 HWLOC_DECLSPEC int hwloc_cpuset_compare(hwloc_const_cpuset_t set1, hwloc_const_cpuset_t set2) __hwloc_attribute_pure;
00195
00201 HWLOC_DECLSPEC int hwloc_cpuset_weight(hwloc_const_cpuset_t set) __hwloc_attribute_pure;
00202
00212 #define hwloc_cpuset_foreach_begin(cpu, set) \
00213 do { \
00214 for (cpu = hwloc_cpuset_first(set); \
00215 (unsigned) cpu != (unsigned) -1; \
00216 cpu = hwloc_cpuset_next(set, cpu)) { \
00217
00221 #define hwloc_cpuset_foreach_end() \
00222 } \
00223 } while (0)
00224
00227 #endif