Skip to content

Commit d970b9b

Browse files
authored
Merge pull request #540 from ldorau/Add_logs_to_query_attribute_value
Add logs to query_attribute_value()
2 parents 620fd6f + c2bd58e commit d970b9b

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/memory_targets/memory_target_numa.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,27 +201,32 @@ static umf_result_t query_attribute_value(void *srcMemoryTarget,
201201
memattr_type_t type) {
202202
hwloc_topology_t topology = umfGetTopology();
203203
if (!topology) {
204+
LOG_PERR("Retrieving cached topology failed");
204205
return UMF_RESULT_ERROR_NOT_SUPPORTED;
205206
}
206207

207208
hwloc_obj_t srcNumaNode = hwloc_get_obj_by_type(
208209
topology, HWLOC_OBJ_NUMANODE,
209210
((struct numa_memory_target_t *)srcMemoryTarget)->physical_id);
210211
if (!srcNumaNode) {
212+
LOG_PERR("Getting HWLOC object by type failed");
211213
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
212214
}
213215

214216
hwloc_obj_t dstNumaNode = hwloc_get_obj_by_type(
215217
topology, HWLOC_OBJ_NUMANODE,
216218
((struct numa_memory_target_t *)dstMemoryTarget)->physical_id);
217219
if (!dstNumaNode) {
220+
LOG_PERR("Getting HWLOC object by type failed");
218221
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
219222
}
220223

221224
// Given NUMA nodes aren't local, HWLOC returns an error in such case.
222225
if (!hwloc_bitmap_intersects(srcNumaNode->cpuset, dstNumaNode->cpuset)) {
223226
// Since we want to skip such query, we return the worst possible
224227
// value for given memory attribute.
228+
LOG_PDEBUG("Testing whether two bitmaps intersect failed, using the "
229+
"worst value");
225230
*value = memattr_get_worst_value(type);
226231
return UMF_RESULT_SUCCESS;
227232
}
@@ -246,6 +251,8 @@ static umf_result_t query_attribute_value(void *srcMemoryTarget,
246251
int ret = hwloc_memattr_get_value(topology, hwlocMemAttrType, dstNumaNode,
247252
&initiator, 0, &memAttrValue);
248253
if (ret) {
254+
LOG_PERR("Getting an attribute value for a specific target NUMA node "
255+
"failed");
249256
return (errno == EINVAL) ? UMF_RESULT_ERROR_NOT_SUPPORTED
250257
: UMF_RESULT_ERROR_UNKNOWN;
251258
}

src/memspaces/memspace_highest_bandwidth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static void umfMemspaceHighestBandwidthInit(void) {
9191
umfMemspaceHighestBandwidthCreate(&UMF_MEMSPACE_HIGHEST_BANDWIDTH);
9292
if (ret != UMF_RESULT_SUCCESS) {
9393
LOG_ERR(
94-
"Creating the highest bandwidth memspace failed with a %u error\n",
94+
"Creating the highest bandwidth memspace failed with the error: %u",
9595
ret);
9696
assert(ret == UMF_RESULT_ERROR_NOT_SUPPORTED);
9797
}

src/memspaces/memspace_lowest_latency.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,9 @@ static void umfMemspaceLowestLatencyInit(void) {
8686
umf_result_t ret =
8787
umfMemspaceLowestLatencyCreate(&UMF_MEMSPACE_LOWEST_LATENCY);
8888
if (ret != UMF_RESULT_SUCCESS) {
89-
LOG_ERR("Creating the lowest latency memspace failed with a %u error\n",
90-
ret);
89+
LOG_ERR(
90+
"Creating the lowest latency memspace failed with the error: %u",
91+
ret);
9192
assert(ret == UMF_RESULT_ERROR_NOT_SUPPORTED);
9293
}
9394

0 commit comments

Comments
 (0)