Skip to content

Commit

Permalink
Adds special c!omp for single-source build
Browse files Browse the repository at this point in the history
c!omp lines are removed in BASIS builds, which do not support OMP
  • Loading branch information
holm10 committed Jan 11, 2025
1 parent 7d89786 commit ea631f0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
18 changes: 9 additions & 9 deletions bbb/oderhs.m
Original file line number Diff line number Diff line change
Expand Up @@ -12323,13 +12323,13 @@ integer ia(neq+1) # pointers to beginning of each row in jac,ja
Use(ParallelEval) # ParallelJac

write(*,*) "jc_interf, ParallelJac = ", ParallelJac
if (ParallelJac.eq.1) then
call jac_calc_parallel (neq, t, yl, yldot00, ml, mu, wk,
. nnzmx, jac, ja, ia)
else
c!omp if (ParallelJac.eq.1) then
c!omp call jac_calc_parallel (neq, t, yl, yldot00, ml, mu, wk,
c!omp. nnzmx, jac, ja, ia)
c!omp else
call jac_calc (neq, t, yl, yldot00, ml, mu, wk,
. nnzmx, jac, ja, ia)
endif
c!omp endif
end subroutine jac_calc_interface

subroutine Pandf1rhs_interface(neq, time, yl, yldot)
Expand All @@ -12340,11 +12340,11 @@ subroutine Pandf1rhs_interface(neq, time, yl, yldot)
integer neq
real time, yl(neqmx),yldot(neq)

if (ParallelPandf1.gt.0) then
call OMPPandf1Rhs(neq, time, yl, yldot)
else
c!omp if (ParallelPandf1.gt.0) then
c!omp call OMPPandf1Rhs(neq, time, yl, yldot)
c!omp else
call pandf1(-1, -1, 0, neq, time, yl, yldot)
endif
c!omp endif

end subroutine Pandf1rhs_interface

Expand Down
3 changes: 1 addition & 2 deletions localrules.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,10 @@ def Petsc(s):
s=s.replace("cpetsc","")
return s
def Omp(s):
if getenv("ENV_VAR", 'False').lower() in ('true', '1', 't')
if getenv("OMP", 'False').lower() in ('true', '1', 't'):
if s.startswith("c!omp"):
s=s.replace("c!omp"," ")
return s

saved_dec=0
in_uses=0
savedlines=[]
Expand Down
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#
import os
import os.path
from os import remove, environ
import string
import site
from Forthon.compilers import FCompiler
Expand Down Expand Up @@ -167,6 +168,11 @@ def run(self):
FLAGS['OMPargs'].remove('--omp')
FLAGS['FARGS'].remove('-fopenmp')
FLAGS['CARGS'].remove('-fopenmp')
# Flag for localrules
os.environ["OMP"] = "FALSE"
else:
# Flag for localrules
os.environ["OMP"] = "TRUE"
# Add boundary checking to non-debug build
if arglist['checkbounds']:
FLAGS['FARGSOPT'] = FLAGS['FARGSOPT'] + [
Expand Down Expand Up @@ -201,7 +207,6 @@ def run(self):
if call(['make', '-f', 'Makefile.Forthon', 'clean']) != 0:
raise SystemExit("Clean failure")


setup( name="uedge",
ext_modules= [
Extension(
Expand Down

0 comments on commit ea631f0

Please sign in to comment.