Skip to content

Add logs to query_attribute_value() #540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/memory_targets/memory_target_numa.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,27 +201,32 @@ static umf_result_t query_attribute_value(void *srcMemoryTarget,
memattr_type_t type) {
hwloc_topology_t topology = umfGetTopology();
if (!topology) {
LOG_PERR("Retrieving cached topology failed");
return UMF_RESULT_ERROR_NOT_SUPPORTED;
}

hwloc_obj_t srcNumaNode = hwloc_get_obj_by_type(
topology, HWLOC_OBJ_NUMANODE,
((struct numa_memory_target_t *)srcMemoryTarget)->physical_id);
if (!srcNumaNode) {
LOG_PERR("Getting HWLOC object by type failed");
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
}

hwloc_obj_t dstNumaNode = hwloc_get_obj_by_type(
topology, HWLOC_OBJ_NUMANODE,
((struct numa_memory_target_t *)dstMemoryTarget)->physical_id);
if (!dstNumaNode) {
LOG_PERR("Getting HWLOC object by type failed");
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
}

// Given NUMA nodes aren't local, HWLOC returns an error in such case.
if (!hwloc_bitmap_intersects(srcNumaNode->cpuset, dstNumaNode->cpuset)) {
// Since we want to skip such query, we return the worst possible
// value for given memory attribute.
LOG_PDEBUG("Testing whether two bitmaps intersect failed, using the "
"worst value");
*value = memattr_get_worst_value(type);
return UMF_RESULT_SUCCESS;
}
Expand All @@ -246,6 +251,8 @@ static umf_result_t query_attribute_value(void *srcMemoryTarget,
int ret = hwloc_memattr_get_value(topology, hwlocMemAttrType, dstNumaNode,
&initiator, 0, &memAttrValue);
if (ret) {
LOG_PERR("Getting an attribute value for a specific target NUMA node "
"failed");
return (errno == EINVAL) ? UMF_RESULT_ERROR_NOT_SUPPORTED
: UMF_RESULT_ERROR_UNKNOWN;
}
Expand Down
2 changes: 1 addition & 1 deletion src/memspaces/memspace_highest_bandwidth.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ static void umfMemspaceHighestBandwidthInit(void) {
umfMemspaceHighestBandwidthCreate(&UMF_MEMSPACE_HIGHEST_BANDWIDTH);
if (ret != UMF_RESULT_SUCCESS) {
LOG_ERR(
"Creating the highest bandwidth memspace failed with a %u error\n",
"Creating the highest bandwidth memspace failed with the error: %u",
ret);
assert(ret == UMF_RESULT_ERROR_NOT_SUPPORTED);
}
Expand Down
5 changes: 3 additions & 2 deletions src/memspaces/memspace_lowest_latency.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ static void umfMemspaceLowestLatencyInit(void) {
umf_result_t ret =
umfMemspaceLowestLatencyCreate(&UMF_MEMSPACE_LOWEST_LATENCY);
if (ret != UMF_RESULT_SUCCESS) {
LOG_ERR("Creating the lowest latency memspace failed with a %u error\n",
ret);
LOG_ERR(
"Creating the lowest latency memspace failed with the error: %u",
ret);
assert(ret == UMF_RESULT_ERROR_NOT_SUPPORTED);
}

Expand Down