diff --git a/lib/communicator/Communicator_base.cc b/lib/communicator/Communicator_base.cc index 2e6626be..3378c56a 100644 --- a/lib/communicator/Communicator_base.cc +++ b/lib/communicator/Communicator_base.cc @@ -149,7 +149,9 @@ void CartesianCommunicator::ShmInitGeneric(void){ #if 1 int mmap_flag = MAP_SHARED | MAP_ANONYMOUS; +#ifdef MAP_HUGETLB if ( Hugepages ) mmap_flag |= MAP_HUGETLB; +#endif ShmCommBuf =(void *) mmap(NULL, MAX_MPI_SHM_BYTES, PROT_READ | PROT_WRITE, mmap_flag, -1, 0); if (ShmCommBuf == (void *)MAP_FAILED) exit(EXIT_FAILURE); std::cout << "ShmCommBuf "< #include #endif -// Make up for linex deficiencies -#ifndef SHM_HUGETLB -#define SHM_HUGETLB 0x0 -#endif -#ifndef MAP_HUGETLB -#define MAP_HUGETLB 0x0 -#endif namespace Grid { @@ -220,7 +213,9 @@ void CartesianCommunicator::Init(int *argc, char ***argv) { ftruncate(fd, size); int mmap_flag = MAP_SHARED; +#ifdef MAP_HUGETLB if (Hugepages) mmap_flag |= MAP_HUGETLB; +#endif void * ptr = mmap(NULL,size, PROT_READ | PROT_WRITE, mmap_flag, fd, 0); if ( ptr == MAP_FAILED ) { perror("failed mmap"); assert(0); } @@ -274,7 +269,11 @@ void CartesianCommunicator::Init(int *argc, char ***argv) { for(int r=0;r