Skip to content

Commit 690c929

Browse files
authored
[OpenMP][AIX] Use syssmt() to get the number of SMTs per physical CPU (#89985)
This patch changes to use system call `syssmt()` instead of `lpar_get_info()` to get the number of SMTs (logical processors) per physical processor for AIX. `lpar_get_info()` gives the max number of SMTs that the physical processor can support while `syssmt()` returns the number that is currently configured.
1 parent d2caaab commit 690c929

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

openmp/runtime/src/kmp_affinity.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3038,15 +3038,7 @@ static bool __kmp_affinity_create_cpuinfo_map(int *line,
30383038
KMP_INFORM(AffParseFilename, "KMP_AFFINITY", "system info for topology");
30393039

30403040
// Get the number of SMT threads per core.
3041-
int retval =
3042-
lpar_get_info(LPAR_INFO_FORMAT1, &cpuinfo, sizeof(lpar_info_format1_t));
3043-
if (!retval)
3044-
smt_threads = cpuinfo.smt_threads;
3045-
else {
3046-
CLEANUP_THREAD_INFO;
3047-
*msg_id = kmp_i18n_str_UnknownTopology;
3048-
return false;
3049-
}
3041+
smt_threads = syssmt(GET_NUMBER_SMT_SETS, 0, 0, NULL);
30503042

30513043
// Allocate a resource set containing available system resourses.
30523044
rsethandle_t sys_rset = rs_alloc(RS_SYSTEM);

openmp/runtime/src/kmp_affinity.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,8 @@ class KMPHwlocAffinity : public KMPAffinity {
322322
#include <sys/dr.h>
323323
#include <sys/rset.h>
324324
#define VMI_MAXRADS 64 // Maximum number of RADs allowed by AIX.
325+
#define GET_NUMBER_SMT_SETS 0x0004
326+
extern "C" int syssmt(int flags, int, int, int *);
325327
#endif
326328
class KMPNativeAffinity : public KMPAffinity {
327329
class Mask : public KMPAffinity::Mask {

0 commit comments

Comments
 (0)