From 612e4688895eca0fafa234c7a3c5d45829bd9317 Mon Sep 17 00:00:00 2001 From: Peter Boyle Date: Fri, 20 Nov 2020 16:48:28 +0100 Subject: [PATCH 1/2] Configurable ALLOC_ALIGN and ALLOC_CACHE --- Grid/allocator/MemoryManager.h | 2 -- configure.ac | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Grid/allocator/MemoryManager.h b/Grid/allocator/MemoryManager.h index aac13aee..25c5b5f5 100644 --- a/Grid/allocator/MemoryManager.h +++ b/Grid/allocator/MemoryManager.h @@ -34,8 +34,6 @@ NAMESPACE_BEGIN(Grid); // Move control to configure.ac and Config.h? -#define ALLOCATION_CACHE -#define GRID_ALLOC_ALIGN (2*1024*1024) #define GRID_ALLOC_SMALL_LIMIT (4096) /*Pinning pages is costly*/ diff --git a/configure.ac b/configure.ac index 5b22309d..4d16d776 100644 --- a/configure.ac +++ b/configure.ac @@ -491,6 +491,28 @@ AM_CFLAGS="$SIMD_FLAGS $AM_CFLAGS" ###### PRECISION ALWAYS DOUBLE AC_DEFINE([GRID_DEFAULT_PRECISION_DOUBLE],[1],[GRID_DEFAULT_PRECISION is DOUBLE] ) +######################################################### +###################### GRID ALLOCATOR ALIGNMENT ## +######################################################### +AC_ARG_ENABLE([alloc-align],[AC_HELP_STRING([--enable-alloc-align=2MB|4k], + [Alignment in bytes of GRID Allocator ])],[ac_ALLOC_ALIGN=${enable_alloc_align}],[ac_ALLOC_ALIGN=2MB]) +case ${ac_ALLOC_ALIGN} in + 4k) + AC_DEFINE([GRID_ALLOC_ALIGN],[(4096)],[GRID_ALLOC_ALIGN]);; + 2MB) + AC_DEFINE([GRID_ALLOC_ALIGN],[(2*1024*1024)],[GRID_ALLOC_ALIGN]);; + *);; +esac + +AC_ARG_ENABLE([alloc-cache],[AC_HELP_STRING([--enable-alloc-cache ], + [Cache a pool of recent "frees" to reuse])],[ac_ALLOC_CACHE=${enable_alloc_cache}],[ac_ALLOC_CACHE=yes]) +case ${ac_ALLOC_CACHE} in + yes) + AC_DEFINE([ALLOCATION_CACHE],[1],[ALLOCATION_CACHE]);; + *);; +esac + + ######################################################### ###################### set GPU device to rank in node ## ######################################################### From 86e8b9fe387a922e13d4cfe67a2dbd5554f6ed46 Mon Sep 17 00:00:00 2001 From: Peter Boyle Date: Fri, 20 Nov 2020 17:07:16 +0100 Subject: [PATCH 2/2] ALLOC_ALIGN removed --- Grid/threads/Accelerator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Grid/threads/Accelerator.h b/Grid/threads/Accelerator.h index 5f5cd5fe..6232aea8 100644 --- a/Grid/threads/Accelerator.h +++ b/Grid/threads/Accelerator.h @@ -361,7 +361,7 @@ inline void acceleratorMemSet(void *base,int value,size_t bytes) { hipMemset(bas ////////////////////////////////////////////// // CPU Target - No accelerator just thread instead ////////////////////////////////////////////// -#define GRID_ALLOC_ALIGN (2*1024*1024) // 2MB aligned + #if ( (!defined(GRID_SYCL)) && (!defined(GRID_CUDA)) && (!defined(GRID_HIP)) ) #undef GRID_SIMT