Merge pull request #2040 from martin-frbg/locks2002
Restore locking optimizations for OpenMP case
This commit is contained in:
commit
6c83b878f6
|
@ -2694,21 +2694,26 @@ void *blas_memory_alloc(int procpos){
|
||||||
|
|
||||||
position = 0;
|
position = 0;
|
||||||
|
|
||||||
|
#if defined(SMP) && !defined(USE_OPENMP)
|
||||||
LOCK_COMMAND(&alloc_lock);
|
LOCK_COMMAND(&alloc_lock);
|
||||||
|
#endif
|
||||||
do {
|
do {
|
||||||
/* if (!memory[position].used) { */
|
#if defined(USE_OPENMP)
|
||||||
/* blas_lock(&memory[position].lock);*/
|
if (!memory[position].used) {
|
||||||
|
blas_lock(&memory[position].lock);
|
||||||
|
#endif
|
||||||
if (!memory[position].used) goto allocation;
|
if (!memory[position].used) goto allocation;
|
||||||
|
|
||||||
/* blas_unlock(&memory[position].lock);*/
|
#if defined(USE_OPENMP)
|
||||||
/* } */
|
blas_unlock(&memory[position].lock);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
position ++;
|
position ++;
|
||||||
|
|
||||||
} while (position < NUM_BUFFERS);
|
} while (position < NUM_BUFFERS);
|
||||||
|
#if defined(SMP) && !defined(USE_OPENMP)
|
||||||
UNLOCK_COMMAND(&alloc_lock);
|
UNLOCK_COMMAND(&alloc_lock);
|
||||||
|
#endif
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
allocation :
|
allocation :
|
||||||
|
@ -2718,9 +2723,11 @@ void *blas_memory_alloc(int procpos){
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
memory[position].used = 1;
|
memory[position].used = 1;
|
||||||
|
#if defined(SMP) && !defined(USE_OPENMP)
|
||||||
UNLOCK_COMMAND(&alloc_lock);
|
UNLOCK_COMMAND(&alloc_lock);
|
||||||
|
#else
|
||||||
|
blas_unlock(&memory[position].lock);
|
||||||
|
#endif
|
||||||
if (!memory[position].addr) {
|
if (!memory[position].addr) {
|
||||||
do {
|
do {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
Loading…
Reference in New Issue