mirror of
https://gitlab.com/scemama/irpf90.git
synced 2024-06-02 11:25:19 +02:00
Merge branch 'new'
This commit is contained in:
commit
23d9daaba5
|
@ -41,7 +41,7 @@ def dress(f, in_root=False):
|
|||
""" Transfoms the filename into $PWD/IRPF90_temp/f
|
||||
|
||||
Note:
|
||||
In root=True resurn $PWD/f
|
||||
In root=True resurn $PWD/f
|
||||
"""
|
||||
|
||||
pwd = os.getcwd()
|
||||
|
@ -124,7 +124,7 @@ def create_build_link(t, l_irp_m, l_usr_m, l_ext_m, ninja=True):
|
|||
|
||||
basename = os.path.basename(filename)
|
||||
if basename != progname:
|
||||
from util import logger
|
||||
from util import logger
|
||||
logger.info('program-name `{0}` != file-name `{1}` (using file-name for now...)'.format(progname,basename))
|
||||
|
||||
target = dress(filename, in_root=True)
|
||||
|
@ -158,8 +158,8 @@ def create_build_compile(t, l_module, l_ext_modfile=[], ninja=True):
|
|||
|
||||
- The module can produce a .MOD file
|
||||
- The module can Need another .MOD file.
|
||||
This .MOD file can be produced by:
|
||||
1) a file generated by IRP_F90 preprocessor.
|
||||
This .MOD file can be produced by:
|
||||
1) a file generated by IRP_F90 preprocessor.
|
||||
2) a file defined by the user but a .irp.f90 file.
|
||||
3) a file not handle at all by IRPF90.
|
||||
|
||||
|
@ -211,12 +211,12 @@ def create_build_compile(t, l_module, l_ext_modfile=[], ninja=True):
|
|||
|
||||
inline_include = True
|
||||
if not inline_include:
|
||||
#Wrong name, this not work!
|
||||
#list_of_includes = ' '.join(map(lambda x: dress(x, in_root=True), t.includes))
|
||||
raise NotImplemented
|
||||
#Wrong name, this not work!
|
||||
#list_of_includes = ' '.join(map(lambda x: dress(x, in_root=True), t.includes))
|
||||
raise NotImplemented
|
||||
else:
|
||||
#The include have already by included
|
||||
list_of_includes = ' '
|
||||
#The include have already by included
|
||||
list_of_includes = ' '
|
||||
|
||||
l_build = [
|
||||
"build {target_o}: compile_fortran_{irp_id} {target_F90} | {list_of_includes} {list_of_modules} {list_of_modules_irp}",
|
||||
|
@ -236,8 +236,8 @@ def create_build_compile(t, l_module, l_ext_modfile=[], ninja=True):
|
|||
l_build += [
|
||||
"build {target_module_o}: compile_fortran_{irp_id} {target_module_F90} | {list_of_includes} {list_of_modules} ",
|
||||
" short_in = {short_target_module_F90}",
|
||||
" short_out = {short_target_module_o}",
|
||||
""
|
||||
" short_out = {short_target_module_o}",
|
||||
""
|
||||
]
|
||||
|
||||
l_build_make += [
|
||||
|
@ -363,7 +363,7 @@ def create_make_all_clean(l_main):
|
|||
|
||||
'''
|
||||
|
||||
l_executable =' '.join(dress( t.filename, in_root=True) for t in l_main)
|
||||
l_executable =' '.join(dress( t.filename, in_root=True) for t in l_main)
|
||||
|
||||
output = [".PHONY : all",
|
||||
"all: {l_executable}",
|
||||
|
|
|
@ -90,7 +90,7 @@ class Entity(object):
|
|||
@irpy.lazy_property
|
||||
def d_type_lines(self):
|
||||
# () -> Dict[Line, Tuple[int,Line] ]
|
||||
'''Contruct a mapping table between the type of the line and the possition'''
|
||||
'''Contruct a mapping table between the type of the line and the possition'''
|
||||
from collections import defaultdict
|
||||
d = defaultdict(list)
|
||||
for i, line in enumerate(self.text):
|
||||
|
@ -338,7 +338,7 @@ class Entity(object):
|
|||
|
||||
if not type_:
|
||||
logger.error( "Error in definition of %s." % (self.name))
|
||||
sys.exit(1)
|
||||
sys.exit(1)
|
||||
|
||||
if self.dim:
|
||||
return "%s, allocatable" % (type_)
|
||||
|
|
|
@ -59,8 +59,8 @@ def main():
|
|||
|
||||
print 'graph { '
|
||||
for name,entity in comm_world.d_entity.items():
|
||||
if entity.needs:
|
||||
print ' {0} -> {1}'.format(name, ' '.join(entity.needs))
|
||||
if entity.needs:
|
||||
print ' {0} -> {1}'.format(name, ' '.join(entity.needs))
|
||||
print '}'
|
||||
return
|
||||
|
||||
|
|
|
@ -238,8 +238,8 @@ class Irpy_comm_world(object):
|
|||
from irpf90_t import NoDep,Declaration,Implicit,Use,Cont_provider
|
||||
def moved_to_top_l(ptext):
|
||||
l = [NoDep, Declaration, Implicit, Use, Cont_provider]
|
||||
for _, text in ptext:
|
||||
parsed_text.move_to_top_list(text, l)
|
||||
for _, text in ptext:
|
||||
parsed_text.move_to_top_list(text, l)
|
||||
|
||||
#Touch routine
|
||||
parsed_text.build_sub_needs(parsed_text_0, d_routine)
|
||||
|
@ -318,5 +318,5 @@ class Irpy_comm_world(object):
|
|||
out += [ "end subroutine", "" ]
|
||||
|
||||
filename = os.path.join(irpf90_t.irpdir,'irp_locks.irp.F90')
|
||||
lazy_write_file(filename, '\n'.join(out))
|
||||
lazy_write_file(filename, '\n'.join(out))
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@ def move_to_top_list(text, it):
|
|||
- We can have `nested` subroutine / Function. (Because of interface)
|
||||
- This function is called way to much. Is need to be efficient
|
||||
- This function is Impure
|
||||
- One pass over `text`
|
||||
- One pass over `text`
|
||||
|
||||
|
||||
NB:
|
||||
|
|
|
@ -445,7 +445,7 @@ def remove_comments(text, form):
|
|||
text = remove_after_bang(line.text)
|
||||
if text:
|
||||
line.text = text
|
||||
result.append(line)
|
||||
result.append(line)
|
||||
|
||||
return result
|
||||
else:
|
||||
|
@ -769,7 +769,7 @@ def process_old_style_do(text):
|
|||
######################################################################
|
||||
def change_single_line_ifs(text):
|
||||
# List[Line] -> List[Line]
|
||||
'''Changes: `if (test) result`
|
||||
'''Changes: `if (test) result`
|
||||
into
|
||||
`if (test) then
|
||||
result
|
||||
|
@ -853,7 +853,7 @@ def check_begin_end(raw_text):
|
|||
|
||||
if n_end > n_begin:
|
||||
logger.error("You have more close statement than open statement (%s) (%s)",line.filename,t_end)
|
||||
else:
|
||||
else:
|
||||
logger.error('You have more end statement than open statenemt for (%s) (%s)' % (line.filename, t_end))
|
||||
|
||||
for i in zip([l for i in l_begin for l in d_type[i]], d_type[t_end]):
|
||||
|
|
14
src/util.py
14
src/util.py
|
@ -82,12 +82,12 @@ def parmap(f, it, parallel=False):
|
|||
# https://docs.python.org/2/library/pickle.html#what-can-be-pickled-and-unpickled
|
||||
#from cPickle import PicklingError
|
||||
#try:
|
||||
# p = multiprocessing.Pool(nproc)
|
||||
# l_res = p.map(f, it,nproc)
|
||||
# p = multiprocessing.Pool(nproc)
|
||||
# l_res = p.map(f, it,nproc)
|
||||
#except PicklingError:
|
||||
# pass
|
||||
# pass
|
||||
#else:
|
||||
# return l_res
|
||||
# return l_res
|
||||
|
||||
# ~!~!~!
|
||||
# Parallelisation By Us
|
||||
|
@ -128,7 +128,7 @@ def parmap(f, it, parallel=False):
|
|||
except BaseException as e:
|
||||
t = e
|
||||
else:
|
||||
t = (i, result)
|
||||
t = (i, result)
|
||||
|
||||
q_out.put(t)
|
||||
q_in.task_done()
|
||||
|
@ -162,8 +162,8 @@ def parmap(f, it, parallel=False):
|
|||
from itertools import ifilter
|
||||
e = next(ifilter(lambda t: isinstance(t,BaseException), l_res))
|
||||
except StopIteration:
|
||||
# Now we need first to order the result, and secondly to flatte it
|
||||
return [item for _, chunk in sorted(l_res) for item in chunk]
|
||||
# Now we need first to order the result, and secondly to flatte it
|
||||
return [item for _, chunk in sorted(l_res) for item in chunk]
|
||||
else:
|
||||
raise e
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user