mirror of
https://gitlab.com/scemama/irpf90.git
synced 2025-01-03 01:55:42 +01:00
Since // touch working
This commit is contained in:
parent
243fd9d4d4
commit
982d771c61
@ -58,7 +58,7 @@ 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 ]
|
options['T'] = [ 'Task' , 'Auto-parallelism ', 0 ]
|
||||||
|
|
||||||
class CommandLine(object):
|
class CommandLine(object):
|
||||||
|
|
||||||
@ -211,9 +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
|
# @irpy.lazy_property
|
||||||
def do_Task(self):
|
# def do_Task(self):
|
||||||
return True
|
# return True
|
||||||
|
|
||||||
command_line = CommandLine()
|
command_line = CommandLine()
|
||||||
|
|
||||||
|
@ -253,6 +253,10 @@ class Entity(object):
|
|||||||
result.append("")
|
result.append("")
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@irpy.lazy_property
|
||||||
|
def is_source_touch(self):
|
||||||
|
return (Touch in self.d_type_lines or SoftTouch in self.d_type_lines)
|
||||||
|
|
||||||
@irpy.lazy_property_mutable
|
@irpy.lazy_property_mutable
|
||||||
def is_self_touched(self):
|
def is_self_touched(self):
|
||||||
'''Cehck if it will be modified (touch)'''
|
'''Cehck if it will be modified (touch)'''
|
||||||
@ -406,30 +410,32 @@ class Entity(object):
|
|||||||
return []
|
return []
|
||||||
|
|
||||||
template = '''
|
template = '''
|
||||||
subroutine touch_{name}
|
SUBROUTINE touch_{name}
|
||||||
|
|
||||||
{#l_module}
|
{#l_module}
|
||||||
{name}
|
{name}
|
||||||
{/l_module}
|
{/l_module}
|
||||||
|
|
||||||
implicit none
|
IMPLICIT NONE
|
||||||
character*(6+{@size key=name/}),parameter :: irp_here = 'touch_{name}'
|
{?do_debug}
|
||||||
|
CHARACTER*(6+{@size key=name/}),PARAMETER :: irp_here = 'touch_{name}'
|
||||||
|
{/do_debug}
|
||||||
|
|
||||||
{?do_debug}
|
{?do_debug}
|
||||||
call irp_enter(irp_here)
|
CALL irp_enter(irp_here)
|
||||||
{/do_debug}
|
{/do_debug}
|
||||||
|
|
||||||
{#l_ancestor}
|
{#l_ancestor}
|
||||||
{name}_is_built = .False.
|
{name}_is_built = .FALSE.
|
||||||
{/l_ancestor}
|
{/l_ancestor}
|
||||||
|
|
||||||
{name}_is_built = .True.
|
{name}_is_built = .TRUE.
|
||||||
|
|
||||||
{?do_debug}
|
{?do_debug}
|
||||||
call irp_leave(irp_here)
|
CALL irp_leave(irp_here)
|
||||||
{/do_debug}
|
{/do_debug}
|
||||||
|
|
||||||
end subroutine touch_{name}
|
END SUBROUTINE touch_{name}
|
||||||
'''
|
'''
|
||||||
|
|
||||||
# Only one by EntityColleciton
|
# Only one by EntityColleciton
|
||||||
@ -449,7 +455,7 @@ end subroutine touch_{name}
|
|||||||
'l_module':l_module,
|
'l_module':l_module,
|
||||||
'l_ancestor':l_parents,
|
'l_ancestor':l_parents,
|
||||||
'do_debug':command_line.do_debug})
|
'do_debug':command_line.do_debug})
|
||||||
return l.split('\n')
|
return [i for i in l.split('\n') if i]
|
||||||
|
|
||||||
##########################################################
|
##########################################################
|
||||||
@irpy.lazy_property
|
@irpy.lazy_property
|
||||||
@ -531,7 +537,7 @@ end subroutine touch_{name}
|
|||||||
{?inline}
|
{?inline}
|
||||||
!DEC$ ATTRIBUTES FORCEINLINE :: provide_{name}
|
!DEC$ ATTRIBUTES FORCEINLINE :: provide_{name}
|
||||||
{/inline}
|
{/inline}
|
||||||
subroutine provide_{name}
|
SUBROUTINE provide_{name}
|
||||||
|
|
||||||
{?do_openmp}
|
{?do_openmp}
|
||||||
use omp_lib
|
use omp_lib
|
||||||
@ -542,7 +548,9 @@ subroutine provide_{name}
|
|||||||
{/l_module}
|
{/l_module}
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
|
{?do_debug}
|
||||||
character*(8+{@size key=name/}),parameter :: irp_here = 'provide_{name}'
|
character*(8+{@size key=name/}),parameter :: irp_here = 'provide_{name}'
|
||||||
|
{/do_debug}
|
||||||
|
|
||||||
{?do_openmp}
|
{?do_openmp}
|
||||||
CALL irp_lock_{name}(.TRUE.)
|
CALL irp_lock_{name}(.TRUE.)
|
||||||
@ -553,28 +561,23 @@ subroutine provide_{name}
|
|||||||
{/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}
|
||||||
{?head_touch}
|
|
||||||
!$OMP TASKGROUP
|
|
||||||
{/head_touch}
|
|
||||||
!$OMP TASK DEFAULT(shared) {depend}
|
!$OMP TASK DEFAULT(shared) {depend}
|
||||||
{/do_task}
|
{/do_task}
|
||||||
|
|
||||||
{#l_allocate}
|
{#l_allocate}
|
||||||
call allocate_{name}
|
CALL allocate_{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.
|
||||||
@ -587,7 +590,7 @@ subroutine provide_{name}
|
|||||||
CALL irp_leave(irp_here)
|
CALL irp_leave(irp_here)
|
||||||
{/do_debug}
|
{/do_debug}
|
||||||
|
|
||||||
end subroutine provide_{name}
|
END SUBROUTINE provide_{name}
|
||||||
'''
|
'''
|
||||||
from util import mangled
|
from util import mangled
|
||||||
|
|
||||||
@ -610,10 +613,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 [i for i in l.split('\n') if i.strip()]
|
||||||
|
|
||||||
return l.split('\n')
|
|
||||||
|
|
||||||
def build_alloc(self,name):
|
def build_alloc(self,name):
|
||||||
var = self.d_entity[name]
|
var = self.d_entity[name]
|
||||||
@ -626,6 +627,7 @@ subroutine allocate_{name}
|
|||||||
{name}
|
{name}
|
||||||
{/l_module}
|
{/l_module}
|
||||||
|
|
||||||
|
|
||||||
character*(9+{@size key=name/}),parameter :: irp_here = 'allocate_{name}'
|
character*(9+{@size key=name/}),parameter :: irp_here = 'allocate_{name}'
|
||||||
integer :: irp_err
|
integer :: irp_err
|
||||||
|
|
||||||
@ -715,12 +717,9 @@ end subroutine
|
|||||||
# ~#~#~#~#~#
|
# ~#~#~#~#~#
|
||||||
|
|
||||||
#Next return the first element of the iterator
|
#Next return the first element of the iterator
|
||||||
ps_text = next(text for filename, text in self.cm_t_filename_parsed_text
|
ps_text = next(text for filename, text in self.cm_t_filename_parsed_text if self.prototype.filename[0].startswith(filename))
|
||||||
if self.prototype.filename[0].startswith(filename))
|
begin = next(i for i, (_, line) in enumerate(ps_text) if isinstance(line, Begin_provider) if line.filename[1] == self.same_as)
|
||||||
begin = next(i for i, (_, line) in enumerate(ps_text)
|
end = next(begin + i for i, (_, line) in enumerate(ps_text[begin:]) if isinstance(line, End_provider))
|
||||||
if isinstance(line, Begin_provider) if line.filename[1] == self.same_as)
|
|
||||||
end = next(begin + i for i, (_, line) in enumerate(ps_text[begin:])
|
|
||||||
if isinstance(line, End_provider))
|
|
||||||
|
|
||||||
# Now we now that the text is betern ps_text[begin:end]
|
# Now we now that the text is betern ps_text[begin:end]
|
||||||
_, line_prototype = ps_text[begin]
|
_, line_prototype = ps_text[begin]
|
||||||
@ -737,11 +736,23 @@ end subroutine
|
|||||||
text.append(([], Simple_line(line_prototype.i, " irp_rdtsc1 = irp_rdtsc()",
|
text.append(([], Simple_line(line_prototype.i, " irp_rdtsc1 = irp_rdtsc()",
|
||||||
line_prototype.filename)))
|
line_prototype.filename)))
|
||||||
|
|
||||||
|
remove = 1
|
||||||
for vars, line in ps_text[begin + 1:end]:
|
for vars, line in ps_text[begin + 1:end]:
|
||||||
|
|
||||||
|
if 'call touch' in line.lower:
|
||||||
|
text += [([], Simple_line(line.i, '!$OMP TASKGROUP', line.filename))]
|
||||||
|
remove = -1
|
||||||
|
|
||||||
text.append((vars, line))
|
text.append((vars, line))
|
||||||
text += map(lambda x: ([], Simple_line(line.i, x, line.filename)),
|
text += map(lambda x: ([], Simple_line(line.i, x, line.filename)),
|
||||||
build_call_provide(vars, self.d_entity))
|
build_call_provide(vars, self.d_entity))
|
||||||
|
|
||||||
|
|
||||||
|
if remove == 0:
|
||||||
|
text += [([], Simple_line(line.i, '!$OMP END TASKGROUP', line.filename))]
|
||||||
|
|
||||||
|
remove +=1
|
||||||
|
|
||||||
# ~#~#~#~#~#
|
# ~#~#~#~#~#
|
||||||
# Create the subroutine.
|
# Create the subroutine.
|
||||||
# ~#~#~#~#~#
|
# ~#~#~#~#~#
|
||||||
|
Loading…
Reference in New Issue
Block a user