mirror of
https://gitlab.com/scemama/irpf90.git
synced 2024-12-21 20:03:33 +01:00
Disallow provide, touch, soft_touch, provide_all in openMP
This commit is contained in:
parent
f6ff97f5c5
commit
6bdc7afde4
@ -852,6 +852,27 @@ def remove_ifdefs(text):
|
|||||||
result.append(line)
|
result.append(line)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
def check_OpenMP(text):
|
||||||
|
assert type(text) == list
|
||||||
|
result = []
|
||||||
|
inside_openmp = False
|
||||||
|
for line in text:
|
||||||
|
if type(line) == Openmp:
|
||||||
|
# Detect OpenMP blocks
|
||||||
|
buffer = line.text.lower().split()
|
||||||
|
if buffer[1] == "parallel":
|
||||||
|
inside_openmp = True
|
||||||
|
if buffer[1] == "end" and buffer[2] == "parallel":
|
||||||
|
inside_openmp = False
|
||||||
|
result.append(line)
|
||||||
|
|
||||||
|
if inside_openmp:
|
||||||
|
if type(line) in [ Provide_all, Provide, Touch, SoftTouch ]:
|
||||||
|
error.fail(line,type(line).str+" is not allowed in an OpenMP block.")
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
def create_preprocessed_text(filename):
|
def create_preprocessed_text(filename):
|
||||||
file = open(filename,"r")
|
file = open(filename,"r")
|
||||||
@ -869,6 +890,7 @@ def create_preprocessed_text(filename):
|
|||||||
result = change_single_line_ifs(result)
|
result = change_single_line_ifs(result)
|
||||||
result = process_old_style_do(result)
|
result = process_old_style_do(result)
|
||||||
result = irp_simple_statements(result)
|
result = irp_simple_statements(result)
|
||||||
|
result = check_OpenMP(result)
|
||||||
check_begin_end(result)
|
check_begin_end(result)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@ -58,14 +58,8 @@ class Variable(object):
|
|||||||
############################################################
|
############################################################
|
||||||
def has_openmp(self):
|
def has_openmp(self):
|
||||||
if '_has_openmp' not in self.__dict__:
|
if '_has_openmp' not in self.__dict__:
|
||||||
buffer = None
|
self._has_openmp = False
|
||||||
text = self.text
|
self.builder()
|
||||||
result = False
|
|
||||||
for line in text:
|
|
||||||
if type(line) == Openmp:
|
|
||||||
result = True
|
|
||||||
break
|
|
||||||
self._has_openmp = result
|
|
||||||
return self._has_openmp
|
return self._has_openmp
|
||||||
has_openmp = property(has_openmp)
|
has_openmp = property(has_openmp)
|
||||||
|
|
||||||
@ -593,6 +587,7 @@ class Variable(object):
|
|||||||
text = parsed_text.move_to_top(text,Implicit)
|
text = parsed_text.move_to_top(text,Implicit)
|
||||||
text = parsed_text.move_to_top(text,Use)
|
text = parsed_text.move_to_top(text,Use)
|
||||||
text = map(lambda x: x[1], text)
|
text = map(lambda x: x[1], text)
|
||||||
|
inside_omp = False
|
||||||
for line in filter(lambda x: type(x) not in [ Begin_doc, End_doc, Doc], text):
|
for line in filter(lambda x: type(x) not in [ Begin_doc, End_doc, Doc], text):
|
||||||
if type(line) == Begin_provider:
|
if type(line) == Begin_provider:
|
||||||
result = []
|
result = []
|
||||||
@ -608,7 +603,19 @@ class Variable(object):
|
|||||||
" call irp_set_timer(%d,(irp_rdtsc2-irp_rdtsc1))"%self.label ]
|
" call irp_set_timer(%d,(irp_rdtsc2-irp_rdtsc1))"%self.label ]
|
||||||
result.append( "end subroutine bld_%s"%(name) )
|
result.append( "end subroutine bld_%s"%(name) )
|
||||||
break
|
break
|
||||||
|
elif type(line) == Openmp:
|
||||||
|
# Detect OpenMP blocks
|
||||||
|
buffer = line.text.lower().split()
|
||||||
|
if buffer[1] == "parallel":
|
||||||
|
inside_omp = True
|
||||||
|
self._has_openmp = True
|
||||||
|
if buffer[1] == "end" and buffer[2] == "parallel":
|
||||||
|
inside_omp = False
|
||||||
|
result.append(line.text)
|
||||||
else:
|
else:
|
||||||
|
# if inside_omp:
|
||||||
|
# if type(line) in [ Provide_all, Provide, Touch, SoftTouch ]:
|
||||||
|
# error.fail(line,str(type(line))+"is not allowed in an OpenMP block.")
|
||||||
result.append(line.text)
|
result.append(line.text)
|
||||||
self._builder = result
|
self._builder = result
|
||||||
return self._builder
|
return self._builder
|
||||||
|
Loading…
Reference in New Issue
Block a user