* Configure checks for architecture-specific functions to detect nr of sockets. #245master
parent
47b63a8054
commit
4e2d179052
24
configure.ac
24
configure.ac
|
@ -400,6 +400,30 @@ Consider --with-aws4c=, CPPFLAGS, LDFLAGS, etc])
|
||||||
LDFLAGS=$ORIG_LDFLAGS
|
LDFLAGS=$ORIG_LDFLAGS
|
||||||
])
|
])
|
||||||
|
|
||||||
|
# Check for existence of the function to detect the CPU socket ID (for multi-socket systems)
|
||||||
|
AC_COMPILE_IFELSE(
|
||||||
|
[AC_LANG_SOURCE([[
|
||||||
|
int main(){
|
||||||
|
unsigned long a,d,c;
|
||||||
|
__asm__ volatile("rdtscp" : "=a" (a), "=d" (d), "=c" (c));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
]])],
|
||||||
|
AC_DEFINE([HAVE_RDTSCP_ASM], [], [Has ASM to detect CPU socket ID]))
|
||||||
|
|
||||||
|
AC_COMPILE_IFELSE(
|
||||||
|
[AC_LANG_SOURCE([[
|
||||||
|
#define _GNU_SOURCE
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/syscall.h>
|
||||||
|
unsigned long GetProcessorAndCore(int *chip, int *core){
|
||||||
|
return syscall(SYS_getcpu, core, chip, NULL);
|
||||||
|
}
|
||||||
|
int main(){
|
||||||
|
}
|
||||||
|
]])],
|
||||||
|
AC_DEFINE([HAVE_GETCPU_SYSCALL], [], [Has syscall to detect CPU socket ID]))
|
||||||
|
|
||||||
|
|
||||||
# Enable building "IOR", in all capitals
|
# Enable building "IOR", in all capitals
|
||||||
AC_ARG_ENABLE([caps],
|
AC_ARG_ENABLE([caps],
|
||||||
|
|
|
@ -792,8 +792,7 @@ void GetTestFileName(char *testFileName, IOR_param_t * test)
|
||||||
strcpy(initialTestFileName, test->testFileName);
|
strcpy(initialTestFileName, test->testFileName);
|
||||||
if(test->dualMount){
|
if(test->dualMount){
|
||||||
GetProcessorAndCore(&socket, &core);
|
GetProcessorAndCore(&socket, &core);
|
||||||
sprintf(tmpString, "%s%d/%s",initialTestFileName,
|
sprintf(tmpString, "%s%d/%s",initialTestFileName, socket, "data");
|
||||||
socket, "data");
|
|
||||||
strcpy(initialTestFileName, tmpString);
|
strcpy(initialTestFileName, tmpString);
|
||||||
}
|
}
|
||||||
fileNames = ParseFileName(initialTestFileName, &count);
|
fileNames = ParseFileName(initialTestFileName, &count);
|
||||||
|
|
|
@ -16,6 +16,12 @@
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_GETCPU_SYSCALL
|
||||||
|
# define _GNU_SOURCE
|
||||||
|
# include <unistd.h>
|
||||||
|
# include <sys/syscall.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
# define _GNU_SOURCE /* Needed for O_DIRECT in fcntl */
|
# define _GNU_SOURCE /* Needed for O_DIRECT in fcntl */
|
||||||
#endif /* __linux__ */
|
#endif /* __linux__ */
|
||||||
|
@ -869,17 +875,15 @@ char *HumanReadable(IOR_offset_t value, int base)
|
||||||
return valueStr;
|
return valueStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__aarch64__)
|
#if defined(HAVE_GETCPU_SYSCALL)
|
||||||
// TODO: This might be general enough to provide the functionality for any system
|
// Assume we aren't worried about thread/process migration.
|
||||||
// regardless of processor type given we aren't worried about thread/process migration.
|
|
||||||
// Test on Intel systems and see if we can get rid of the architecture specificity
|
// Test on Intel systems and see if we can get rid of the architecture specificity
|
||||||
// of the code.
|
// of the code.
|
||||||
unsigned long GetProcessorAndCore(int *chip, int *core){
|
unsigned long GetProcessorAndCore(int *chip, int *core){
|
||||||
return syscall(SYS_getcpu, core, chip, NULL);
|
return syscall(SYS_getcpu, core, chip, NULL);
|
||||||
}
|
}
|
||||||
// TODO: Add in AMD function
|
#elif defined(HAVE_RDTSCP_ASM)
|
||||||
#else
|
// We're on an intel processor and use the
|
||||||
// If we're not on an ARM processor assume we're on an intel processor and use the
|
|
||||||
// rdtscp instruction.
|
// rdtscp instruction.
|
||||||
unsigned long GetProcessorAndCore(int *chip, int *core){
|
unsigned long GetProcessorAndCore(int *chip, int *core){
|
||||||
unsigned long a,d,c;
|
unsigned long a,d,c;
|
||||||
|
@ -888,4 +892,12 @@ unsigned long GetProcessorAndCore(int *chip, int *core){
|
||||||
*core = c & 0xFFF;
|
*core = c & 0xFFF;
|
||||||
return ((unsigned long)a) | (((unsigned long)d) << 32);;
|
return ((unsigned long)a) | (((unsigned long)d) << 32);;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
// TODO: Add in AMD function
|
||||||
|
unsigned long GetProcessorAndCore(int *chip, int *core){
|
||||||
|
#warning GetProcessorAndCore is implemented as a dummy
|
||||||
|
*chip = 0;
|
||||||
|
*core = 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue