Skip to content

Commit

Permalink
[OpenMP][AIX] Use syssmt() to get the number of SMTs per physical CPU (
Browse files Browse the repository at this point in the history
…#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.
  • Loading branch information
xingxue-ibm committed Apr 26, 2024
1 parent d2caaab commit 690c929
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
10 changes: 1 addition & 9 deletions openmp/runtime/src/kmp_affinity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3038,15 +3038,7 @@ static bool __kmp_affinity_create_cpuinfo_map(int *line,
KMP_INFORM(AffParseFilename, "KMP_AFFINITY", "system info for topology");

// Get the number of SMT threads per core.
int retval =
lpar_get_info(LPAR_INFO_FORMAT1, &cpuinfo, sizeof(lpar_info_format1_t));
if (!retval)
smt_threads = cpuinfo.smt_threads;
else {
CLEANUP_THREAD_INFO;
*msg_id = kmp_i18n_str_UnknownTopology;
return false;
}
smt_threads = syssmt(GET_NUMBER_SMT_SETS, 0, 0, NULL);

// Allocate a resource set containing available system resourses.
rsethandle_t sys_rset = rs_alloc(RS_SYSTEM);
Expand Down
2 changes: 2 additions & 0 deletions openmp/runtime/src/kmp_affinity.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ class KMPHwlocAffinity : public KMPAffinity {
#include <sys/dr.h>
#include <sys/rset.h>
#define VMI_MAXRADS 64 // Maximum number of RADs allowed by AIX.
#define GET_NUMBER_SMT_SETS 0x0004
extern "C" int syssmt(int flags, int, int, int *);
#endif
class KMPNativeAffinity : public KMPAffinity {
class Mask : public KMPAffinity::Mask {
Expand Down

0 comments on commit 690c929

Please sign in to comment.