Browse Source

added experimental support for big numa machines

tags/v0.2.11^2
wernsaar 11 years ago
parent
commit
793175be3a
3 changed files with 25 additions and 0 deletions
  1. +3
    -0
      Makefile.rule
  2. +4
    -0
      Makefile.system
  3. +18
    -0
      driver/others/init.c

+ 3
- 0
Makefile.rule View File

@@ -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


+ 4
- 0
Makefile.system View File

@@ -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)


+ 18
- 0
driver/others/init.c View File

@@ -85,8 +85,16 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <unistd.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_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 ++;


Loading…
Cancel
Save