mirror of
https://gitlab.com/scemama/irpf90.git
synced 2025-01-03 01:55:42 +01:00
// with touch
This commit is contained in:
parent
598587bcf3
commit
243fd9d4d4
@ -54,11 +54,11 @@ options['p'] = [ 'preprocess' , 'Prints a preprocessed file to standard output
|
|||||||
options['r'] = [ 'no_directives', 'Ignore all compiler directives !DEC$ and !DIR$', 0 ]
|
options['r'] = [ 'no_directives', 'Ignore all compiler directives !DEC$ and !DIR$', 0 ]
|
||||||
options['s'] = [ 'substitute' , 'Substitute values in do loops for generating specific optimized code.', 1 ]
|
options['s'] = [ 'substitute' , 'Substitute values in do loops for generating specific optimized code.', 1 ]
|
||||||
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['T'] = [ 'Task' , 'Auto-parallelism ', 0 ]
|
|
||||||
options['v'] = [ 'version' , 'Prints version of irpf90', 0 ]
|
options['v'] = [ 'version' , 'Prints version of irpf90', 0 ]
|
||||||
options['w'] = [ 'warnings' , 'Activate Warnings', 0 ]
|
options['w'] = [ 'warnings' , 'Activate Warnings', 0 ]
|
||||||
options['z'] = [ 'openmp' , 'Activate for OpenMP code', 0 ]
|
options['z'] = [ 'openmp' , 'Activate for OpenMP code', 0 ]
|
||||||
options['G'] = [ 'graph' , 'Print the dependecy-graph of the entities (dots format)', 0 ]
|
options['G'] = [ 'graph' , 'Print the dependecy-graph of the entities (dots format)', 0 ]
|
||||||
|
options['T'] = [ 'Task' , 'Auto-parallelism ', 1 ]
|
||||||
|
|
||||||
class CommandLine(object):
|
class CommandLine(object):
|
||||||
|
|
||||||
@ -78,15 +78,15 @@ class CommandLine(object):
|
|||||||
|
|
||||||
@irpy.lazy_property
|
@irpy.lazy_property
|
||||||
def include_dir(self):
|
def include_dir(self):
|
||||||
self._include_dir = []
|
l = []
|
||||||
for o,a in self.opts:
|
for o,a in self.opts:
|
||||||
if o in [ "-I", '--'+options['I'][0] ]:
|
if o in [ "-I", '--'+options['I'][0] ]:
|
||||||
if len(a) < 1:
|
if len(a) < 1:
|
||||||
print "Error: -I option needs a directory"
|
print "Error: -I option needs a directory"
|
||||||
if a[-1] != '/':
|
if a[-1] != '/':
|
||||||
a = a+'/'
|
a = a+'/'
|
||||||
self._include_dir.append(a)
|
l.append(a)
|
||||||
return self._include_dir
|
return l
|
||||||
|
|
||||||
@irpy.lazy_property
|
@irpy.lazy_property
|
||||||
def inline(self):
|
def inline(self):
|
||||||
@ -211,6 +211,9 @@ do_$LONG = property(fget=do_$LONG)
|
|||||||
def do_run(self):
|
def do_run(self):
|
||||||
return not(any( (self.do_version, self.do_help, self.do_preprocess, self.do_touch, self.do_init)))
|
return not(any( (self.do_version, self.do_help, self.do_preprocess, self.do_touch, self.do_init)))
|
||||||
|
|
||||||
|
@irpy.lazy_property
|
||||||
|
def do_Task(self):
|
||||||
|
return True
|
||||||
|
|
||||||
command_line = CommandLine()
|
command_line = CommandLine()
|
||||||
|
|
||||||
|
@ -401,35 +401,56 @@ class Entity(object):
|
|||||||
# () -> List[str]
|
# () -> List[str]
|
||||||
'''Fabric the f90 routine who handle the cache invalidation'''
|
'''Fabric the f90 routine who handle the cache invalidation'''
|
||||||
|
|
||||||
|
# Only one by EntityColleciton
|
||||||
|
if not self.is_main:
|
||||||
|
return []
|
||||||
|
|
||||||
|
template = '''
|
||||||
|
subroutine touch_{name}
|
||||||
|
|
||||||
|
{#l_module}
|
||||||
|
{name}
|
||||||
|
{/l_module}
|
||||||
|
|
||||||
|
implicit none
|
||||||
|
character*(6+{@size key=name/}),parameter :: irp_here = 'touch_{name}'
|
||||||
|
|
||||||
|
{?do_debug}
|
||||||
|
call irp_enter(irp_here)
|
||||||
|
{/do_debug}
|
||||||
|
|
||||||
|
{#l_ancestor}
|
||||||
|
{name}_is_built = .False.
|
||||||
|
{/l_ancestor}
|
||||||
|
|
||||||
|
{name}_is_built = .True.
|
||||||
|
|
||||||
|
{?do_debug}
|
||||||
|
call irp_leave(irp_here)
|
||||||
|
{/do_debug}
|
||||||
|
|
||||||
|
end subroutine touch_{name}
|
||||||
|
'''
|
||||||
|
|
||||||
# Only one by EntityColleciton
|
# Only one by EntityColleciton
|
||||||
if not self.is_main:
|
if not self.is_main:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
from util import mangled
|
from util import mangled
|
||||||
parents = mangled(self.parents,self.d_entity)
|
l_parents = [{'name':n} for n in mangled(self.parents,self.d_entity)]
|
||||||
name = self.name
|
name = self.name
|
||||||
|
l_module= [ {'name':n} for n in build_use(self.parents+[name],self.d_entity)]
|
||||||
|
|
||||||
result = ["subroutine touch_%s" % (name)]
|
from ashes import AshesEnv
|
||||||
|
ashes_env = AshesEnv()
|
||||||
result += build_use(parents+[name],self.d_entity)
|
ashes_env.register_source('touch',template)
|
||||||
result.append(" implicit none")
|
|
||||||
|
|
||||||
if command_line.do_debug:
|
|
||||||
length = str(len("touch_%s" % (name)))
|
|
||||||
result += [" character*(%s) :: irp_here = 'touch_%s'" % (length, name)]
|
|
||||||
result += [" call irp_enter(irp_here)"]
|
|
||||||
|
|
||||||
result += map(lambda x: " %s_is_built = .False." % (x), parents)
|
|
||||||
result.append(" %s_is_built = .True." % (name))
|
|
||||||
|
|
||||||
if command_line.do_debug:
|
|
||||||
result.append(" call irp_leave(irp_here)")
|
|
||||||
|
|
||||||
result.append("end subroutine touch_%s" % (name))
|
|
||||||
result.append("")
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
l = ashes_env.render('touch', {'name': name,
|
||||||
|
'l_module':l_module,
|
||||||
|
'l_ancestor':l_parents,
|
||||||
|
'do_debug':command_line.do_debug})
|
||||||
|
return l.split('\n')
|
||||||
|
|
||||||
##########################################################
|
##########################################################
|
||||||
@irpy.lazy_property
|
@irpy.lazy_property
|
||||||
def locker(self):
|
def locker(self):
|
||||||
@ -524,21 +545,24 @@ subroutine provide_{name}
|
|||||||
character*(8+{@size key=name/}),parameter :: irp_here = 'provide_{name}'
|
character*(8+{@size key=name/}),parameter :: irp_here = 'provide_{name}'
|
||||||
|
|
||||||
{?do_openmp}
|
{?do_openmp}
|
||||||
call irp_lock_{name}(.True.)
|
CALL irp_lock_{name}(.TRUE.)
|
||||||
{/do_openmp}
|
{/do_openmp}
|
||||||
|
|
||||||
{?do_debug}
|
{?do_debug}
|
||||||
call irp_enter(irp_here)
|
CALL irp_enter(irp_here)
|
||||||
{/do_debug}
|
{/do_debug}
|
||||||
|
|
||||||
{#l_children}
|
{#l_children}
|
||||||
if (.NOT.{name}_is_built) then
|
if (.NOT.{name}_is_built) then
|
||||||
call provide_{name}
|
CALL provide_{name}
|
||||||
endif
|
endif
|
||||||
{/l_children}
|
{/l_children}
|
||||||
|
|
||||||
{#do_task}
|
{#do_task}
|
||||||
!$omp task default(shared) {depend}
|
{?head_touch}
|
||||||
|
!$OMP TASKGROUP
|
||||||
|
{/head_touch}
|
||||||
|
!$OMP TASK DEFAULT(shared) {depend}
|
||||||
{/do_task}
|
{/do_task}
|
||||||
|
|
||||||
{#l_allocate}
|
{#l_allocate}
|
||||||
@ -546,18 +570,21 @@ subroutine provide_{name}
|
|||||||
{/l_allocate}
|
{/l_allocate}
|
||||||
call bld_{name}
|
call bld_{name}
|
||||||
|
|
||||||
{#do_task}
|
{?do_task}
|
||||||
!$omp end task
|
!$OMP END TASK
|
||||||
|
{?head_touch}
|
||||||
|
!$OMP END TASKGROUP
|
||||||
|
{/head_touch}
|
||||||
{/do_task}
|
{/do_task}
|
||||||
|
|
||||||
{name}_is_built = .TRUE.
|
{name}_is_built = .TRUE.
|
||||||
|
|
||||||
{?do_openmp}
|
{?do_openmp}
|
||||||
call irp_lock_{name}(.False.)
|
CALL irp_lock_{name}(.FALSE.)
|
||||||
{/do_openmp}
|
{/do_openmp}
|
||||||
|
|
||||||
{?do_debug}
|
{?do_debug}
|
||||||
call irp_leave(irp_here)
|
CALL irp_leave(irp_here)
|
||||||
{/do_debug}
|
{/do_debug}
|
||||||
|
|
||||||
end subroutine provide_{name}
|
end subroutine provide_{name}
|
||||||
@ -583,7 +610,8 @@ end subroutine provide_{name}
|
|||||||
'l_children':l_children,
|
'l_children':l_children,
|
||||||
'do_debug':command_line.do_debug,
|
'do_debug':command_line.do_debug,
|
||||||
'do_openmp':command_line.do_openmp,
|
'do_openmp':command_line.do_openmp,
|
||||||
'do_task':do_task})
|
'do_task':do_task,
|
||||||
|
'head_touch':self.is_self_touched})
|
||||||
|
|
||||||
return l.split('\n')
|
return l.split('\n')
|
||||||
|
|
||||||
|
@ -77,7 +77,8 @@ def main():
|
|||||||
print ' }'
|
print ' }'
|
||||||
|
|
||||||
comm_world.t_filename_parsed_text # Initialize entity need. Dirty I know.
|
comm_world.t_filename_parsed_text # Initialize entity need. Dirty I know.
|
||||||
|
|
||||||
|
print_full_diagram(comm_world.d_entity.values())
|
||||||
|
|
||||||
print 'digraph Compact { '
|
print 'digraph Compact { '
|
||||||
print ' graph [ordering="out" splines=true overlap=false];'
|
print ' graph [ordering="out" splines=true overlap=false];'
|
||||||
|
Loading…
Reference in New Issue
Block a user