Skip to content

Commit edc3298

Browse files
committed
Merge pull request #427 from wernsaar/develop
added experimental support for big numa machines
2 parents 83c4ba8 + 793175b commit edc3298

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

Makefile.rule

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ NO_WARMUP = 1
9595
# If you want to disable CPU/Memory affinity on Linux.
9696
NO_AFFINITY = 1
9797

98+
# if you are compiling for Linux and you have more than 16 numa nodes or more than 256 cpus
99+
# BIGNUMA = 1
100+
98101
# Don't use AVX kernel on Sandy Bridge. It is compatible with old compilers
99102
# and OS. However, the performance is low.
100103
# NO_AVX = 1

Makefile.system

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,10 @@ ifeq ($(USE_OPENMP), 1)
803803
CCOMMON_OPT += -DUSE_OPENMP
804804
endif
805805

806+
ifeq ($(BIGNUMA), 1)
807+
CCOMMON_OPT += -DBIGNUMA
808+
endif
809+
806810
endif
807811

808812
ifeq ($(NO_WARMUP), 1)

driver/others/init.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,16 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8585
#include <unistd.h>
8686
#include <string.h>
8787

88+
#if defined(BIGNUMA)
89+
// max number of nodes as defined in numa.h
90+
// max cpus as defined in sched.h
91+
#define MAX_NODES 128
92+
#define MAX_CPUS CPU_SETSIZE
93+
#else
8894
#define MAX_NODES 16
8995
#define MAX_CPUS 256
96+
#endif
97+
9098
#define NCPUBITS (8*sizeof(unsigned long))
9199
#define MAX_BITMASK_LEN (MAX_CPUS/NCPUBITS)
92100
#define CPUELT(cpu) ((cpu) / NCPUBITS)
@@ -544,16 +552,26 @@ static inline int is_dead(int id) {
544552

545553
return shmctl(id, IPC_STAT, &ds);
546554
}
555+
547556
static void open_shmem(void) {
548557

549558
int try = 0;
550559

551560
do {
552561

562+
#if defined(BIGNUMA)
563+
// raised to 32768, enough for 128 nodes and 1024 cups
564+
shmid = shmget(SH_MAGIC, 32768, 0666);
565+
#else
553566
shmid = shmget(SH_MAGIC, 4096, 0666);
567+
#endif
554568

555569
if (shmid == -1) {
570+
#if defined(BIGNUMA)
571+
shmid = shmget(SH_MAGIC, 32768, IPC_CREAT | 0666);
572+
#else
556573
shmid = shmget(SH_MAGIC, 4096, IPC_CREAT | 0666);
574+
#endif
557575
}
558576

559577
try ++;

0 commit comments

Comments
 (0)