From 3dccd7aa2c376fe175d26c27c2704b21a971f138 Mon Sep 17 00:00:00 2001 From: Christoph Lehner Date: Sun, 14 Jun 2020 13:26:01 -0400 Subject: [PATCH] Catch edge case in SharedMemoryMPI::GetShmDims; Change default units to consistent MB in init args; Want last element not past last element in MemoryManagerCache.cc --- Grid/allocator/MemoryManagerCache.cc | 2 +- Grid/communicator/SharedMemoryMPI.cc | 2 +- Grid/util/Init.cc | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Grid/allocator/MemoryManagerCache.cc b/Grid/allocator/MemoryManagerCache.cc index 5e259a32..5dd7575e 100644 --- a/Grid/allocator/MemoryManagerCache.cc +++ b/Grid/allocator/MemoryManagerCache.cc @@ -77,7 +77,7 @@ void MemoryManager::LRUinsert(AcceleratorViewEntry &AccCache) assert(AccCache.LRU_valid==0); if (AccCache.transient) { LRU.push_back(AccCache.CpuPtr); - AccCache.LRU_entry = LRU.end(); + AccCache.LRU_entry = --LRU.end(); } else { LRU.push_front(AccCache.CpuPtr); AccCache.LRU_entry = LRU.begin(); diff --git a/Grid/communicator/SharedMemoryMPI.cc b/Grid/communicator/SharedMemoryMPI.cc index 31d6f46c..45fefc71 100644 --- a/Grid/communicator/SharedMemoryMPI.cc +++ b/Grid/communicator/SharedMemoryMPI.cc @@ -180,7 +180,7 @@ void GlobalSharedMemory::GetShmDims(const Coordinate &WorldDims,Coordinate &ShmD && divides(prime,WorldShmSize/AutoShmSize) ) { AutoShmSize*=prime; ShmDims[dim]*=prime; - last_dim = (dim + ndimension - 1) % ndimension; + last_dim = dim; break; } } diff --git a/Grid/util/Init.cc b/Grid/util/Init.cc index 01348384..cd85a784 100644 --- a/Grid/util/Init.cc +++ b/Grid/util/Init.cc @@ -297,11 +297,11 @@ void Grid_init(int *argc,char ***argv) } if( GridCmdOptionExists(*argv,*argv+*argc,"--device-mem") ){ - int GB; + int MB; arg= GridCmdOptionPayload(*argv,*argv+*argc,"--device-mem"); - GridCmdOptionInt(arg,GB); - uint64_t GB64 = GB; - MemoryManager::DeviceMaxBytes = GB64*1024LL*1024LL*1024LL; + GridCmdOptionInt(arg,MB); + uint64_t MB64 = MB; + MemoryManager::DeviceMaxBytes = MB64*1024LL*1024LL; } if( GridCmdOptionExists(*argv,*argv+*argc,"--hypercube") ){