From c144b32368fdd8a0338a2c0c5c0c70675e43c048 Mon Sep 17 00:00:00 2001 From: James Richings Date: Tue, 26 Oct 2021 10:37:24 +0100 Subject: [PATCH 1/6] deflation timers --- Grid/algorithms/iterative/Deflation.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Grid/algorithms/iterative/Deflation.h b/Grid/algorithms/iterative/Deflation.h index 43fe3e35..4da8e037 100644 --- a/Grid/algorithms/iterative/Deflation.h +++ b/Grid/algorithms/iterative/Deflation.h @@ -70,12 +70,26 @@ public: } virtual void operator()(const Field &src,Field &guess) { + GridStopWatch w1; + GridStopWatch w2; + + w1.Start(); guess = Zero(); + w1.Stop(); + + LOG(Message) << "Zeroing the 'out' vector took: " << w1.Elapsed() << std::endl; + + w2.Start(); for (int i=0;i Date: Tue, 9 Nov 2021 12:33:25 +0000 Subject: [PATCH 2/6] Added timing to deflation code. --- Grid/algorithms/iterative/Deflation.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Grid/algorithms/iterative/Deflation.h b/Grid/algorithms/iterative/Deflation.h index 814a0432..83ec1ab0 100644 --- a/Grid/algorithms/iterative/Deflation.h +++ b/Grid/algorithms/iterative/Deflation.h @@ -75,24 +75,19 @@ public: virtual void operator()(const Field &src,Field &guess) { GridStopWatch w1; - GridStopWatch w2; - w1.Start(); guess = Zero(); - w1.Stop(); - LOG(Message) << "Zeroing the 'out' vector took: " << w1.Elapsed() << std::endl; - - w2.Start(); + w1.Start(); for (int i=0;i Date: Tue, 9 Nov 2021 12:57:09 +0000 Subject: [PATCH 3/6] Helper functions to allow probe of cache state of lattice objects. --- Grid/allocator/MemoryManager.h | 1 + Grid/allocator/MemoryManagerCache.cc | 29 +++++++++++++++++++++++++++ Grid/allocator/MemoryManagerShared.cc | 4 ++++ Grid/lattice/Lattice_base.h | 7 +++++++ 4 files changed, 41 insertions(+) diff --git a/Grid/allocator/MemoryManager.h b/Grid/allocator/MemoryManager.h index eafcd83f..740d8d92 100644 --- a/Grid/allocator/MemoryManager.h +++ b/Grid/allocator/MemoryManager.h @@ -170,6 +170,7 @@ private: public: static void Print(void); + static void PrintState( void* CpuPtr); static int isOpen (void* CpuPtr); static void ViewClose(void* CpuPtr,ViewMode mode); static void *ViewOpen (void* CpuPtr,size_t bytes,ViewMode mode,ViewAdvise hint); diff --git a/Grid/allocator/MemoryManagerCache.cc b/Grid/allocator/MemoryManagerCache.cc index 72111dbd..61dc1125 100644 --- a/Grid/allocator/MemoryManagerCache.cc +++ b/Grid/allocator/MemoryManagerCache.cc @@ -474,6 +474,35 @@ int MemoryManager::isOpen (void* _CpuPtr) } } +void MemoryManager::PrintState(void* _CpuPtr) +{ + uint64_t CpuPtr = (uint64_t)_CpuPtr; + + if ( EntryPresent(CpuPtr) ){ + auto AccCacheIterator = EntryLookup(CpuPtr); + auto & AccCache = AccCacheIterator->second; + std::string str; + if ( AccCache.state==Empty ) str = std::string("Empty"); + if ( AccCache.state==CpuDirty ) str = std::string("CpuDirty"); + if ( AccCache.state==AccDirty ) str = std::string("AccDirty"); + if ( AccCache.state==Consistent)str = std::string("Consistent"); + if ( AccCache.state==EvictNext) str = std::string("EvictNext"); + + std::cout << GridLogMessage << "--------------------------------------------" << std::endl; + std::cout << GridLogMessage << "CpuAddr\t\tAccAddr\t\tState\t\tcpuLock\taccLock\tLRU_valid "<Device memory movement not currently managed by Grid." << std::endl; +}; void MemoryManager::Print(void){}; void MemoryManager::NotifyDeletion(void *ptr){}; diff --git a/Grid/lattice/Lattice_base.h b/Grid/lattice/Lattice_base.h index 3ad9f913..9c3d723f 100644 --- a/Grid/lattice/Lattice_base.h +++ b/Grid/lattice/Lattice_base.h @@ -88,6 +88,13 @@ public: LatticeView accessor(*( (LatticeAccelerator *) this),mode); accessor.ViewClose(); } + + // Helper function to print the state of this object in the AccCache + void PrintCacheState(void) + { + MemoryManager::PrintState(this->_odata); + } + ///////////////////////////////////////////////////////////////////////////////// // Return a view object that may be dereferenced in site loops. // The view is trivially copy constructible and may be copied to an accelerator device From 829a32845171e444415827f3800d6d7d45b5c9ec Mon Sep 17 00:00:00 2001 From: James Richings Date: Tue, 9 Nov 2021 20:46:57 +0000 Subject: [PATCH 4/6] remove deflation timing --- Grid/algorithms/iterative/Deflation.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/Grid/algorithms/iterative/Deflation.h b/Grid/algorithms/iterative/Deflation.h index 83ec1ab0..9f85ac70 100644 --- a/Grid/algorithms/iterative/Deflation.h +++ b/Grid/algorithms/iterative/Deflation.h @@ -74,21 +74,11 @@ public: } virtual void operator()(const Field &src,Field &guess) { - GridStopWatch w1; - guess = Zero(); - - w1.Start(); for (int i=0;i Date: Tue, 9 Nov 2021 21:20:36 +0000 Subject: [PATCH 5/6] fix to deflation.h --- Grid/algorithms/iterative/Deflation.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Grid/algorithms/iterative/Deflation.h b/Grid/algorithms/iterative/Deflation.h index 9f85ac70..2eb28bf9 100644 --- a/Grid/algorithms/iterative/Deflation.h +++ b/Grid/algorithms/iterative/Deflation.h @@ -78,6 +78,7 @@ public: for (int i=0;i Date: Tue, 9 Nov 2021 21:56:23 +0000 Subject: [PATCH 6/6] Format edit --- Grid/allocator/MemoryManagerCache.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/Grid/allocator/MemoryManagerCache.cc b/Grid/allocator/MemoryManagerCache.cc index 61dc1125..04b3fe95 100644 --- a/Grid/allocator/MemoryManagerCache.cc +++ b/Grid/allocator/MemoryManagerCache.cc @@ -488,15 +488,12 @@ void MemoryManager::PrintState(void* _CpuPtr) if ( AccCache.state==Consistent)str = std::string("Consistent"); if ( AccCache.state==EvictNext) str = std::string("EvictNext"); - std::cout << GridLogMessage << "--------------------------------------------" << std::endl; std::cout << GridLogMessage << "CpuAddr\t\tAccAddr\t\tState\t\tcpuLock\taccLock\tLRU_valid "<