From ba27cc657183e46a08444f0fe961b9af3a77a8f3 Mon Sep 17 00:00:00 2001 From: paboyle Date: Tue, 5 Sep 2017 15:00:16 +0100 Subject: [PATCH 1/2] Mac os happiness --- lib/communicator/Communicator_base.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/communicator/Communicator_base.cc b/lib/communicator/Communicator_base.cc index 600b890bf..20c310c02 100644 --- a/lib/communicator/Communicator_base.cc +++ b/lib/communicator/Communicator_base.cc @@ -157,7 +157,9 @@ void CartesianCommunicator::ShmInitGeneric(void){ perror("mmap failed "); exit(EXIT_FAILURE); } +#ifdef MADV_HUGEPAGE if (!Hugepages ) madvise(ShmCommBuf,MAX_MPI_SHM_BYTES,MADV_HUGEPAGE); +#endif #else ShmBufStorageVector.resize(MAX_MPI_SHM_BYTES); ShmCommBuf=(void *)&ShmBufStorageVector[0]; From aed5de4d508c990b2d22edbf2fb64526c8095552 Mon Sep 17 00:00:00 2001 From: paboyle Date: Tue, 5 Sep 2017 15:07:07 +0100 Subject: [PATCH 2/2] Patching macos compile --- lib/communicator/Communicator_mpi3.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/communicator/Communicator_mpi3.cc b/lib/communicator/Communicator_mpi3.cc index 75d1f0003..44aa1024b 100644 --- a/lib/communicator/Communicator_mpi3.cc +++ b/lib/communicator/Communicator_mpi3.cc @@ -215,8 +215,10 @@ void CartesianCommunicator::Init(int *argc, char ***argv) { perror("open hugetlbfs"); exit(0); } - - int mmap_flag = MAP_SHARED |MAP_POPULATE; + int mmap_flag = MAP_SHARED ; +#ifdef MAP_POPULATE + mmap_flag|=MAP_POPULATE; +#endif #ifdef MAP_HUGETLB if ( Hugepages ) mmap_flag |= MAP_HUGETLB; #endif @@ -249,7 +251,10 @@ void CartesianCommunicator::Init(int *argc, char ***argv) { if ( fd < 0 ) { perror("failed shm_open"); assert(0); } ftruncate(fd, size); - int mmap_flag = MAP_SHARED|MAP_POPULATE; + int mmap_flag = MAP_SHARED; +#ifdef MAP_POPULATE + mmap_flag |= MAP_POPULATE; +#endif #ifdef MAP_HUGETLB if (Hugepages) mmap_flag |= MAP_HUGETLB; #endif