On 02/06/13 02:03, Samuel Thibault wrote:
Eugene Loh, le Wed 06 Feb 2013 07:50:02 +0100, a écrit :
How about adding a check upon entry to hwloc_solaris_get_sth_cpubind(): if
processor_bind() shows binding, report this and be done. If not, then
continue on with the lgroup logic that's already in that function. Yes?
If processor_bind() correctly reports an error when only an lgroup
binding is done, that should be all fine and welcome, indeed.
Well, no. It doesn't report an error. It simply says there is no binding. I think we're on the same page, though. The point is
not to check on processor_bind error but to check on "no binding".
I'm attaching a patch.
Index: src/topology-solaris.c
===================================================================
--- src/topology-solaris.c (revision 5292)
+++ src/topology-solaris.c (working copy)
@@ -143,6 +143,7 @@
int depth = hwloc_get_type_depth(topology, HWLOC_OBJ_NODE);
int n;
int i;
+ processorid_t binding;
if (depth < 0) {
errno = ENOSYS;
@@ -152,6 +153,15 @@
hwloc_bitmap_zero(hwloc_set);
n = hwloc_get_nbobjs_by_depth(topology, depth);
+ /* first check if processor_bind() was used to bind to a single processor rather than to an lgroup */
+
+ if ( processor_bind(idtype, id, PBIND_QUERY, &binding) == 0 && binding != PBIND_NONE ) {
+ hwloc_bitmap_only(hwloc_set, binding);
+ return 0;
+ }
+
+ /* if not, check lgroups */
+
for (i = 0; i < n; i++) {
hwloc_obj_t obj = hwloc_get_obj_by_depth(topology, depth, i);
lgrp_affinity_t aff = lgrp_affinity_get(idtype, id, obj->os_index);