Skip to content

Commit

Permalink
Uses envs for OMP c!omp
Browse files Browse the repository at this point in the history
  • Loading branch information
holm10 committed Jan 11, 2025
1 parent dde6c7d commit 2ca6c10
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
8 changes: 1 addition & 7 deletions localrules.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,10 @@ def Petsc(s):
s=s.replace("cpetsc","")
return s
def Omp(s):
if isomp['status']:
if getenv("OMP", 'False').lower() in ('true', '1', 't'):
if s.startswith("c!omp"):
s=s.replace("c!omp"," ")
return s
# Check whether to include or exlude c!omp-lines
try:
with open("builder/omp.flag", "r") as f:
isomp = {'status': bool(int(f.readline()))}
except:
isomp = {'status': False}
saved_dec=0
in_uses=0
savedlines=[]
Expand Down
14 changes: 3 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
import os
import os.path
from os import remove
from os import remove, environ
import string
import site
from Forthon.compilers import FCompiler
Expand Down Expand Up @@ -169,10 +169,10 @@ def run(self):
FLAGS['FARGS'].remove('-fopenmp')
FLAGS['CARGS'].remove('-fopenmp')
# Flag for localrules
set_basis_omp(False)
os.environ["OMP"] = "FALSE"
else:
# Flag for localrules
set_basis_omp(True)
os.environ["OMP"] = "TRUE"
# Add boundary checking to non-debug build
if arglist['checkbounds']:
FLAGS['FARGSOPT'] = FLAGS['FARGSOPT'] + [
Expand All @@ -199,7 +199,6 @@ def run(self):
if call(['make',COMPILEFLAGS,OMPFLAGS,'-f','Makefile.Forthon']) != 0:
raise SystemExit("UEDGE build failure")
build.run(self)
remove('builder/omp.flag')

# Modify clean to use make clean
class uedgeClean(build):
Expand All @@ -208,13 +207,6 @@ def run(self):
if call(['make', '-f', 'Makefile.Forthon', 'clean']) != 0:
raise SystemExit("Clean failure")

def set_basis_omp(isomp):
print(isomp, str(int(isomp)))
with open("builder/omp.flag", "w") as f:
f.write(str(int(isomp)))
f.write("\nPassing information on OMP build to localrules.py")


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

0 comments on commit 2ca6c10

Please sign in to comment.