From 6fb5b7332056b5226cf8eafd62f117bc773498a9 Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Tue, 20 Feb 2018 15:39:03 +0100 Subject: [PATCH 1/2] Restore some unconditional locks from 0.2.19 --- driver/others/memory.c | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/driver/others/memory.c b/driver/others/memory.c index d61866eac1..5c389f9ee2 100644 --- a/driver/others/memory.c +++ b/driver/others/memory.c @@ -1016,9 +1016,7 @@ void *blas_memory_alloc(int procpos){ }; void *(**func)(void *address); -#if defined(SMP) && !defined(USE_OPENMP) LOCK_COMMAND(&alloc_lock); -#endif if (!memory_initialized) { @@ -1052,9 +1050,7 @@ void *blas_memory_alloc(int procpos){ memory_initialized = 1; } -#if defined(SMP) && !defined(USE_OPENMP) UNLOCK_COMMAND(&alloc_lock); -#endif #ifdef DEBUG printf("Alloc Start ...\n"); @@ -1071,14 +1067,15 @@ void *blas_memory_alloc(int procpos){ if (!memory[position].used && (memory[position].pos == mypos)) { #if defined(SMP) && !defined(USE_OPENMP) LOCK_COMMAND(&alloc_lock); -#endif -/* blas_lock(&memory[position].lock);*/ - +#else + blas_lock(&memory[position].lock); +#endif if (!memory[position].used) goto allocation; #if defined(SMP) && !defined(USE_OPENMP) UNLOCK_COMMAND(&alloc_lock); +#else + blas_unlock(&memory[position].lock); #endif -/* blas_unlock(&memory[position].lock);*/ } position ++; @@ -1094,14 +1091,15 @@ void *blas_memory_alloc(int procpos){ /* if (!memory[position].used) { */ #if defined(SMP) && !defined(USE_OPENMP) LOCK_COMMAND(&alloc_lock); -#endif -/* blas_lock(&memory[position].lock);*/ - +#else + blas_lock(&memory[position].lock); +#endif if (!memory[position].used) goto allocation; #if defined(SMP) && !defined(USE_OPENMP) UNLOCK_COMMAND(&alloc_lock); -#endif -/* blas_unlock(&memory[position].lock);*/ +#else + blas_unlock(&memory[position].lock); +#endif /* } */ position ++; @@ -1190,9 +1188,7 @@ void *blas_memory_alloc(int procpos){ if (memory_initialized == 1) { -#if defined(SMP) && !defined(USE_OPENMP) LOCK_COMMAND(&alloc_lock); -#endif if (memory_initialized == 1) { @@ -1201,9 +1197,8 @@ void *blas_memory_alloc(int procpos){ memory_initialized = 2; } -#if defined(SMP) && !defined(USE_OPENMP) UNLOCK_COMMAND(&alloc_lock); -#endif + } #endif From a5c9b4e7e0475a542a856d739a8aa99f1f47c6e7 Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Tue, 20 Feb 2018 16:36:03 +0100 Subject: [PATCH 2/2] Update memory.c --- driver/others/memory.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/driver/others/memory.c b/driver/others/memory.c index 5c389f9ee2..b4e10f4c5b 100644 --- a/driver/others/memory.c +++ b/driver/others/memory.c @@ -1117,10 +1117,10 @@ void *blas_memory_alloc(int procpos){ memory[position].used = 1; #if defined(SMP) && !defined(USE_OPENMP) UNLOCK_COMMAND(&alloc_lock); +#else + blas_unlock(&memory[position].lock); #endif - -/* blas_unlock(&memory[position].lock);*/ - + if (!memory[position].addr) { do { #ifdef DEBUG