mirror of
https://gitlab.com/scemama/irpf90.git
synced 2024-09-01 17:23:42 +02:00
OpenMP flag has to be set for openmp programs
This commit is contained in:
parent
673220f1a9
commit
147e3a315a
@ -50,11 +50,10 @@ options['s'] = [ 'substitute' , 'Substitute values in do loops for generating
|
|||||||
options['t'] = [ 'touch' , 'Display which entities are touched when touching the variable given as an argument.', 1 ]
|
options['t'] = [ 'touch' , 'Display which entities are touched when touching the variable given as an argument.', 1 ]
|
||||||
options['u'] = [ 'unused' , 'Print unused providers', 0 ]
|
options['u'] = [ 'unused' , 'Print unused providers', 0 ]
|
||||||
options['v'] = [ 'version' , 'Prints version of irpf90', 0 ]
|
options['v'] = [ 'version' , 'Prints version of irpf90', 0 ]
|
||||||
#options['z'] = [ 'openmp' , 'Automatic openMP tasks (may not work)', 0 ]
|
options['z'] = [ 'openmp' , 'Activate for OpenMP code', 0 ]
|
||||||
|
|
||||||
class CommandLine(object):
|
class CommandLine(object):
|
||||||
|
|
||||||
do_openmp = False
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
global options
|
global options
|
||||||
self._opts = None
|
self._opts = None
|
||||||
@ -162,6 +161,15 @@ or
|
|||||||
return self._coarray
|
return self._coarray
|
||||||
coarray = property(fget=coarray)
|
coarray = property(fget=coarray)
|
||||||
|
|
||||||
|
def openmp(self):
|
||||||
|
if '_openmp' not in self.__dict__:
|
||||||
|
self._openmp = False
|
||||||
|
for o,a in self.opts:
|
||||||
|
if o in [ "-z", '--'+options['z'][0] ]:
|
||||||
|
self._openmp = True
|
||||||
|
return self._openmp
|
||||||
|
do_openmp = property(fget=openmp)
|
||||||
|
|
||||||
def directives(self):
|
def directives(self):
|
||||||
if '_directives' not in self.__dict__:
|
if '_directives' not in self.__dict__:
|
||||||
self._directives = True
|
self._directives = True
|
||||||
|
@ -106,6 +106,10 @@ def main():
|
|||||||
import profile
|
import profile
|
||||||
profile.run()
|
profile.run()
|
||||||
|
|
||||||
|
if command_line.do_openmp:
|
||||||
|
import locks
|
||||||
|
locks.create()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ def run():
|
|||||||
if command_line.do_codelet:
|
if command_line.do_codelet:
|
||||||
print >>file, " irp_rdtsc.o",
|
print >>file, " irp_rdtsc.o",
|
||||||
if command_line.do_openmp:
|
if command_line.do_openmp:
|
||||||
print >>file, " %sirp_locks.irp.o"%(irpdir),
|
print >>file, " %sirp_locks.irp.o"%(irpdir)
|
||||||
else:
|
else:
|
||||||
print >>file, ""
|
print >>file, ""
|
||||||
|
|
||||||
|
@ -177,6 +177,7 @@ class Fmodule(object):
|
|||||||
use,dec,result = extract_use_dec_text(result)
|
use,dec,result = extract_use_dec_text(result)
|
||||||
self._use = make_single(map(lambda x: " "+x[1].text, use))
|
self._use = make_single(map(lambda x: " "+x[1].text, use))
|
||||||
self._dec = map(lambda x: " "+x[1].text, dec)
|
self._dec = map(lambda x: " "+x[1].text, dec)
|
||||||
|
# self._dec = make_single(map(lambda x: " "+x[1].text, dec))
|
||||||
result = provide_variables(result)
|
result = provide_variables(result)
|
||||||
result = move_to_top(result,Declaration)
|
result = move_to_top(result,Declaration)
|
||||||
result = move_to_top(result,Implicit)
|
result = move_to_top(result,Implicit)
|
||||||
|
@ -627,13 +627,7 @@ def irp_simple_statements(text):
|
|||||||
temp = [ Program(0,"program irp_program",program_name) ]
|
temp = [ Program(0,"program irp_program",program_name) ]
|
||||||
if command_line.do_profile:
|
if command_line.do_profile:
|
||||||
temp += [ Simple_line(0,"call irp_init_timer()",line.filename) ]
|
temp += [ Simple_line(0,"call irp_init_timer()",line.filename) ]
|
||||||
if command_line.do_openmp:
|
|
||||||
temp += [ Openmp(0,"!$OMP PARALLEL",line.filename) ]
|
|
||||||
temp += [ Openmp(0,"!$OMP MASTER",line.filename) ]
|
|
||||||
temp += [ Call(0," call %s"%(program_name),line.filename) ]
|
temp += [ Call(0," call %s"%(program_name),line.filename) ]
|
||||||
if command_line.do_openmp:
|
|
||||||
temp += [ Openmp(0,"!$OMP END MASTER",line.filename) ]
|
|
||||||
temp += [ Openmp(0,"!$OMP END PARALLEL",line.filename) ]
|
|
||||||
if command_line.do_profile:
|
if command_line.do_profile:
|
||||||
temp += [ Simple_line(0,"call irp_print_timer()",line.filename) ]
|
temp += [ Simple_line(0,"call irp_print_timer()",line.filename) ]
|
||||||
temp += [ Simple_line(0," call irp_finalize_%s()"%(irp_id),line.filename) ]
|
temp += [ Simple_line(0," call irp_finalize_%s()"%(irp_id),line.filename) ]
|
||||||
|
@ -470,6 +470,7 @@ class Variable(object):
|
|||||||
"!$ print *, irp_here//': Error: Provider in an openMP section'" ,
|
"!$ print *, irp_here//': Error: Provider in an openMP section'" ,
|
||||||
"!$ stop 1",
|
"!$ stop 1",
|
||||||
"!$ endif" ]
|
"!$ endif" ]
|
||||||
|
result = []
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def build_alloc(name):
|
def build_alloc(name):
|
||||||
|
@ -69,26 +69,15 @@ def call_provides(vars,opt=False):
|
|||||||
vars = filter(lambda x: x not in all_children,vars)
|
vars = filter(lambda x: x not in all_children,vars)
|
||||||
def fun(x):
|
def fun(x):
|
||||||
result = []
|
result = []
|
||||||
if command_line.do_openmp:
|
|
||||||
result += [ "!$OMP TASK" ]
|
|
||||||
result += [ \
|
result += [ \
|
||||||
" if (.not.%s_is_built) then"%(x) ]
|
" if (.not.%s_is_built) then"%(x) ]
|
||||||
result += [ \
|
result += [ \
|
||||||
" call provide_%s"%(x) ]
|
" call provide_%s"%(x) ]
|
||||||
result += [ \
|
result += [ \
|
||||||
" endif" ]
|
" endif" ]
|
||||||
if command_line.do_openmp:
|
|
||||||
result += [ "!$OMP END TASK" ]
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
result = flatten ( map (fun, vars) )
|
result = flatten ( map (fun, vars) )
|
||||||
if command_line.do_openmp and result != []:
|
|
||||||
result.reverse()
|
|
||||||
result.remove("!$OMP TASK")
|
|
||||||
result.remove("!$OMP END TASK")
|
|
||||||
result.reverse()
|
|
||||||
if "!$OMP TASK" in result:
|
|
||||||
result += [ "!$OMP TASKWAIT" ]
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
|
@ -1 +1 @@
|
|||||||
version = "1.3.6"
|
version = "1.4.1"
|
||||||
|
Loading…
Reference in New Issue
Block a user