diff --git a/Makefile.rule b/Makefile.rule index 1969761d6..7bbb39e7a 100644 --- a/Makefile.rule +++ b/Makefile.rule @@ -95,6 +95,9 @@ NO_WARMUP = 1 # If you want to disable CPU/Memory affinity on Linux. 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 # and OS. However, the performance is low. # NO_AVX = 1 diff --git a/Makefile.system b/Makefile.system index 370da5928..ccde8e9ce 100644 --- a/Makefile.system +++ b/Makefile.system @@ -803,6 +803,10 @@ ifeq ($(USE_OPENMP), 1) CCOMMON_OPT += -DUSE_OPENMP endif +ifeq ($(BIGNUMA), 1) +CCOMMON_OPT += -DBIGNUMA +endif + endif ifeq ($(NO_WARMUP), 1) diff --git a/driver/others/init.c b/driver/others/init.c index 30d35e05d..913538555 100644 --- a/driver/others/init.c +++ b/driver/others/init.c @@ -85,8 +85,16 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include +#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_CPUS 256 +#endif + #define NCPUBITS (8*sizeof(unsigned long)) #define MAX_BITMASK_LEN (MAX_CPUS/NCPUBITS) #define CPUELT(cpu) ((cpu) / NCPUBITS) @@ -544,16 +552,26 @@ static inline int is_dead(int id) { return shmctl(id, IPC_STAT, &ds); } + static void open_shmem(void) { int try = 0; 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); +#endif if (shmid == -1) { +#if defined(BIGNUMA) + shmid = shmget(SH_MAGIC, 32768, IPC_CREAT | 0666); +#else shmid = shmget(SH_MAGIC, 4096, IPC_CREAT | 0666); +#endif } try ++;