Skip to content

Commit 730e8a4

Browse files
authored
[OpenMP] Add memory allocation using hwloc (#132843)
This patch adds support for memory allocation using hwloc. To enable memory allocation using hwloc, env KMP_TOPOLOGY_METHOD=hwloc needs to be used. If hwloc is not supported/available, allocation will fallback to default path.
1 parent 536fe74 commit 730e8a4

File tree

6 files changed

+343
-108
lines changed

6 files changed

+343
-108
lines changed

openmp/runtime/src/kmp.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,6 +1107,7 @@ extern omp_allocator_handle_t __kmp_def_allocator;
11071107
#endif
11081108

11091109
extern int __kmp_memkind_available;
1110+
extern bool __kmp_hwloc_available;
11101111

11111112
typedef omp_memspace_handle_t kmp_memspace_t; // placeholder
11121113

@@ -1119,6 +1120,9 @@ typedef struct kmp_allocator_t {
11191120
kmp_uint64 pool_size;
11201121
kmp_uint64 pool_used;
11211122
bool pinned;
1123+
#if KMP_USE_HWLOC
1124+
omp_alloctrait_value_t membind;
1125+
#endif
11221126
} kmp_allocator_t;
11231127

11241128
extern omp_allocator_handle_t __kmpc_init_allocator(int gtid,

openmp/runtime/src/kmp_affinity.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,6 +1444,7 @@ void KMPAffinity::pick_api() {
14441444
if (__kmp_affinity_top_method == affinity_top_method_hwloc &&
14451445
__kmp_affinity.type != affinity_disabled) {
14461446
affinity_dispatch = new KMPHwlocAffinity();
1447+
__kmp_hwloc_available = true;
14471448
} else
14481449
#endif
14491450
{

0 commit comments

Comments
 (0)