added experimental support for big numa machines

This commit is contained in:
wernsaar 2014-08-02 13:40:16 +02:00
parent 271af406f3
commit 793175be3a
3 changed files with 25 additions and 0 deletions

View File

@ -95,6 +95,9 @@ NO_WARMUP = 1
# If you want to disable CPU/Memory affinity on Linux. # If you want to disable CPU/Memory affinity on Linux.
NO_AFFINITY = 1 NO_AFFINITY = 1
# if you are compiling for Linux and you have more than 16 numa nodes or more than 256 cpus
# BIGNUMA = 1
# Don't use AVX kernel on Sandy Bridge. It is compatible with old compilers # Don't use AVX kernel on Sandy Bridge. It is compatible with old compilers
# and OS. However, the performance is low. # and OS. However, the performance is low.
# NO_AVX = 1 # NO_AVX = 1

View File

@ -803,6 +803,10 @@ ifeq ($(USE_OPENMP), 1)
CCOMMON_OPT += -DUSE_OPENMP CCOMMON_OPT += -DUSE_OPENMP
endif endif
ifeq ($(BIGNUMA), 1)
CCOMMON_OPT += -DBIGNUMA
endif
endif endif
ifeq ($(NO_WARMUP), 1) ifeq ($(NO_WARMUP), 1)

View File

@ -85,8 +85,16 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#if defined(BIGNUMA)
// max number of nodes as defined in numa.h
// max cpus as defined in sched.h
#define MAX_NODES 128
#define MAX_CPUS CPU_SETSIZE
#else
#define MAX_NODES 16 #define MAX_NODES 16
#define MAX_CPUS 256 #define MAX_CPUS 256
#endif
#define NCPUBITS (8*sizeof(unsigned long)) #define NCPUBITS (8*sizeof(unsigned long))
#define MAX_BITMASK_LEN (MAX_CPUS/NCPUBITS) #define MAX_BITMASK_LEN (MAX_CPUS/NCPUBITS)
#define CPUELT(cpu) ((cpu) / NCPUBITS) #define CPUELT(cpu) ((cpu) / NCPUBITS)
@ -544,16 +552,26 @@ static inline int is_dead(int id) {
return shmctl(id, IPC_STAT, &ds); return shmctl(id, IPC_STAT, &ds);
} }
static void open_shmem(void) { static void open_shmem(void) {
int try = 0; int try = 0;
do { do {
#if defined(BIGNUMA)
// raised to 32768, enough for 128 nodes and 1024 cups
shmid = shmget(SH_MAGIC, 32768, 0666);
#else
shmid = shmget(SH_MAGIC, 4096, 0666); shmid = shmget(SH_MAGIC, 4096, 0666);
#endif
if (shmid == -1) { if (shmid == -1) {
#if defined(BIGNUMA)
shmid = shmget(SH_MAGIC, 32768, IPC_CREAT | 0666);
#else
shmid = shmget(SH_MAGIC, 4096, IPC_CREAT | 0666); shmid = shmget(SH_MAGIC, 4096, IPC_CREAT | 0666);
#endif
} }
try ++; try ++;