@@ -180,15 +180,16 @@ qvi_hwloc_obj_type_is_host_resource(
180
180
181
181
int
182
182
qvi_hwloc_bitmap_string (
183
+ hwloc_topology_t topo,
183
184
hwloc_const_bitmap_t bitmap,
184
185
qv_bind_string_format_t format,
185
186
char **result
186
187
) {
187
188
switch (format) {
188
189
case QV_BIND_STRING_AS_BITMAP:
189
- return qvi_hwloc_bitmap_asprintf (bitmap, result);
190
+ return qvi_hwloc_bitmap_asprintf (topo, bitmap, result);
190
191
case QV_BIND_STRING_AS_LIST:
191
- return qvi_hwloc_bitmap_list_asprintf (bitmap, result);
192
+ return qvi_hwloc_bitmap_list_asprintf (topo, bitmap, result);
192
193
default :
193
194
*result = nullptr ;
194
195
return QV_ERR_INVLD_ARG;
@@ -816,7 +817,7 @@ qvi_hwloc_emit_cpubind(
816
817
if (rc != QV_SUCCESS) return rc;
817
818
818
819
char *cpusets = nullptr ;
819
- rc = qvi_hwloc_bitmap_asprintf (cpuset, &cpusets);
820
+ rc = qvi_hwloc_bitmap_asprintf (hwl-> topo , cpuset, &cpusets);
820
821
if (rc != QV_SUCCESS) goto out;
821
822
822
823
qvi_log_info (
@@ -831,6 +832,7 @@ qvi_hwloc_emit_cpubind(
831
832
832
833
int
833
834
qvi_hwloc_bitmap_asprintf (
835
+ hwloc_topology_t topo,
834
836
hwloc_const_cpuset_t cpuset,
835
837
char **result
836
838
) {
@@ -840,12 +842,33 @@ qvi_hwloc_bitmap_asprintf(
840
842
qvi_log_error (" hwloc_bitmap_asprintf() failed" );
841
843
return QV_ERR_OOR;
842
844
}
845
+
846
+ if (topo) {
847
+ int num_pus = hwloc_get_nbobjs_inside_cpuset_by_type (topo, cpuset, HWLOC_OBJ_PU);
848
+ hwloc_obj_t obj_pu = NULL ;
849
+ char str[128 ] = {0 };
850
+ sprintf (str," %s" ," | cpubind (logical)=[" );
851
+ for (int idx = 0 ; idx < num_pus ; idx++){
852
+ char str2[64 ] = {0 };
853
+ obj_pu = hwloc_get_next_obj_inside_cpuset_by_type (topo, cpuset, HWLOC_OBJ_PU, obj_pu);
854
+ sprintf (str2," %i%s" ,obj_pu->logical_index , idx == (num_pus-1 ) ? " ]" :" ," );
855
+ strcat (str,str2);
856
+ }
857
+
858
+ char *newstr = (char *)malloc (sizeof (char )*(strlen (str)+strlen (iresult)+1 ));
859
+ strcpy (newstr,iresult);
860
+ strcat (newstr,str);
861
+ free (iresult);
862
+ iresult = newstr;
863
+ }
864
+
843
865
*result = iresult;
844
866
return QV_SUCCESS;
845
867
}
846
868
847
869
int
848
870
qvi_hwloc_bitmap_list_asprintf (
871
+ hwloc_topology_t topo,
849
872
hwloc_const_cpuset_t cpuset,
850
873
char **result
851
874
) {
@@ -855,6 +878,26 @@ qvi_hwloc_bitmap_list_asprintf(
855
878
qvi_log_error (" hwloc_bitmap_list_asprintf() failed" );
856
879
return QV_ERR_OOR;
857
880
}
881
+
882
+ if (topo) {
883
+ int num_pus = hwloc_get_nbobjs_inside_cpuset_by_type (topo, cpuset, HWLOC_OBJ_PU);
884
+ hwloc_obj_t obj_pu = NULL ;
885
+ char str[128 ] = {0 };
886
+ sprintf (str," %s" ," | cpubind (logical)=[" );
887
+ for (int idx = 0 ; idx < num_pus ; idx++){
888
+ char str2[64 ] = {0 };
889
+ obj_pu = hwloc_get_next_obj_inside_cpuset_by_type (topo, cpuset, HWLOC_OBJ_PU, obj_pu);
890
+ sprintf (str2," %i%s" ,obj_pu->logical_index , idx == (num_pus-1 ) ? " ]" :" ," );
891
+ strcat (str,str2);
892
+ }
893
+
894
+ char *newstr = (char *)malloc (sizeof (char )*(strlen (str)+strlen (iresult)+1 ));
895
+ strcpy (newstr,iresult);
896
+ strcat (newstr,str);
897
+ free (iresult);
898
+ iresult = newstr;
899
+ }
900
+
858
901
*result = iresult;
859
902
return QV_SUCCESS;
860
903
}
@@ -869,7 +912,7 @@ qvi_hwloc_cpuset_debug(
869
912
#endif
870
913
assert (cpuset);
871
914
char *cpusets = nullptr ;
872
- int rc = qvi_hwloc_bitmap_asprintf (cpuset, &cpusets);
915
+ int rc = qvi_hwloc_bitmap_asprintf (NULL , cpuset, &cpusets);
873
916
if (rc != QV_SUCCESS) {
874
917
qvi_abort ();
875
918
}
@@ -957,7 +1000,7 @@ qvi_hwloc_task_get_cpubind_as_string(
957
1000
int rc = qvi_hwloc_task_get_cpubind (hwl, task_id, &cpuset);
958
1001
if (rc != QV_SUCCESS) return rc;
959
1002
960
- rc = qvi_hwloc_bitmap_asprintf (cpuset, cpusets);
1003
+ rc = qvi_hwloc_bitmap_asprintf (hwl-> topo , cpuset, cpusets);
961
1004
qvi_hwloc_bitmap_delete (&cpuset);
962
1005
return rc;
963
1006
}
@@ -1185,7 +1228,7 @@ qvi_hwloc_devices_emit(
1185
1228
}
1186
1229
for (auto &dev : *devlist) {
1187
1230
char *cpusets = nullptr ;
1188
- int rc = qvi_hwloc_bitmap_asprintf (dev->affinity .cdata (), &cpusets);
1231
+ int rc = qvi_hwloc_bitmap_asprintf (hwl-> topo , dev->affinity .cdata (), &cpusets);
1189
1232
if (rc != QV_SUCCESS) return rc;
1190
1233
1191
1234
qvi_log_info (" Device Name: {}" , dev->name );
0 commit comments