Skip to content
This repository was archived by the owner on Jun 8, 2023. It is now read-only.

Commit 284bd61

Browse files
authored
Remove omp atomic update and critical (#90)
* atomic and critical sections with OpenMP are not required (and cause errors) * Fix tests
1 parent d4bea13 commit 284bd61

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

src/mod2c_core/parsact.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,7 +1263,7 @@ void threadsafe(char* s) {
12631263

12641264
Item* protect_astmt(Item* q1, Item* q2) { /* PROTECT, ';' */
12651265
Item* q;
1266-
replacstr(q1, "#pragma omp atomic update\n #pragma acc atomic update\n");
1266+
replacstr(q1, "#pragma acc atomic update\n");
12671267
q = insertstr(q2->next, "\n");
12681268
protect_include_ = 1;
12691269
return q;
@@ -1276,14 +1276,14 @@ void nrnmutex(int on, Item* q) { /* MUTEXLOCK or MUTEXUNLOCK */
12761276
diag("MUTEXLOCK invoked after MUTEXLOCK", (char*)0);
12771277
}
12781278
toggle = 1;
1279-
replacstr(q, "#pragma omp critical\n {\n");
1279+
replacstr(q, "");
12801280
protect_include_ = 1;
12811281
}else if (on == 0) {
12821282
if (toggle != 1) {
12831283
diag("MUTEXUNLOCK invoked with no earlier MUTEXLOCK", (char*)0);
12841284
}
12851285
toggle = 0;
1286-
replacstr(q, "\n}\n");
1286+
replacstr(q, "");
12871287
protect_include_ = 1;
12881288
}else{
12891289
if (toggle != 0) {

test/validation/mod2c_core/cpp/NaSm.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,10 +357,7 @@ static inline void initmodel(_threadargsproto_) {
357357
m = m0;
358358
{
359359
rates ( _threadargscomma_ v ) ;
360-
#pragma omp critical
361-
{
362-
m = minf + 1.1 ;
363-
}
360+
m = minf + 1.1 ;
364361
}
365362

366363
}

test/validation/mod2c_core/cpp/Nap_E.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,6 @@ static int rates ( _threadargsproto_ ) {
363363
}
364364
hAlpha = ( 0.00001 * ( v - - 50.0 ) ) / ( 1.0 - ( exp ( - ( v - - 50.0 ) / 13.0 ) ) ) ;
365365
if ( v == - 75.0 ) {
366-
#pragma omp atomic update
367366
#pragma acc atomic update
368367
v = v + 0.0001 ;
369368
}

0 commit comments

Comments
 (0)