10
0
mirror of https://gitlab.com/scemama/irpf90.git synced 2024-12-22 04:13:33 +01:00

Parallelized parsed_text

Version:1.1.50
This commit is contained in:
Anthony Scemama 2010-10-02 20:53:22 +02:00
parent 86f281f5ab
commit 999093aedb
5 changed files with 117 additions and 93 deletions

View File

@ -96,14 +96,20 @@ def do_print(var):
###################################################################### ######################################################################
def run(): def run():
import parsed_text import parsed_text
file = open("irpf90_entities","w") import os,sys
l = variables.keys() l = variables.keys()
if os.fork() == 0:
for v in l:
do_print(variables[v])
sys.exit(0)
if os.fork() == 0:
file = open("irpf90_entities","w")
l.sort() l.sort()
for v in l: for v in l:
do_print_short(file,variables[v]) do_print_short(file,variables[v])
file.close() file.close()
for v in l: sys.exit(0)
do_print(variables[v])
###################################################################### ######################################################################
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -63,6 +63,7 @@ def main():
if not command_line.do_run: if not command_line.do_run:
return return
init() init()
import irp_stack import irp_stack

View File

@ -25,6 +25,7 @@
# scemama@irsamc.ups-tlse.fr # scemama@irsamc.ups-tlse.fr
import os,sys
import irpf90_t import irpf90_t
irpdir = irpf90_t.irpdir irpdir = irpf90_t.irpdir
mandir = irpf90_t.mandir mandir = irpf90_t.mandir
@ -60,6 +61,7 @@ irpf90.make: $(wildcard *.irp.f)
###################################################################### ######################################################################
def run(): def run():
from modules import modules from modules import modules
if os.fork() == 0:
mod = [] mod = []
for m in modules.keys(): for m in modules.keys():
mod.append(modules[m]) mod.append(modules[m])
@ -149,4 +151,5 @@ def run():
print >>file, "\t- rm -rf "+irpdir+" "+mandir+" irpf90.make irpf90_variables dist\n" print >>file, "\t- rm -rf "+irpdir+" "+mandir+" irpf90.make irpf90_variables dist\n"
file.close() file.close()
sys.exit(0)

View File

@ -87,9 +87,8 @@ def check_touch(line,vars,main_vars):
error.fail(line,message) error.fail(line,message)
def get_parsed_text(): def get_parsed_text():
main_result = [] def func(filename, text):
varlist = [] varlist = []
for filename, text in preprocessed_text:
result = [] result = []
for line in filter( for line in filter(
lambda x: type(x) not in [ Doc, Begin_doc, End_doc ], lambda x: type(x) not in [ Doc, Begin_doc, End_doc ],
@ -203,12 +202,19 @@ def get_parsed_text():
l = find_variables_in_line(line) l = find_variables_in_line(line)
l = filter(lambda x: x not in varlist, l) l = filter(lambda x: x not in varlist, l)
result.append( (l,line) ) result.append( (l,line) )
main_result.append( (filename, result) ) return result
return main_result
#main_result = []
#for filename,text in preprocessed_text:
# main_result.append( (filename, func(filename,text)) )
#return main_result
return parallel_loop(func,preprocessed_text)
parsed_text = get_parsed_text() parsed_text = get_parsed_text()
###################################################################### ######################################################################
def move_to_top(text,t): def move_to_top(text,t):
@ -240,6 +246,7 @@ for filename,text in parsed_text:
result.append ( (filename,text) ) result.append ( (filename,text) )
parsed_text = result parsed_text = result
###################################################################### ######################################################################
def move_variables(): def move_variables():
@ -329,9 +336,14 @@ def move_variables():
result.append( (vars,line) ) result.append( (vars,line) )
return result return result
return parallel_loop(func,parsed_text) main_result = []
for filename,text in parsed_text:
main_result.append( (filename, func(filename,text)) )
return main_result
#return parallel_loop(func,parsed_text)
parsed_text = move_variables() parsed_text = move_variables()
###################################################################### ######################################################################
def build_sub_needs(): def build_sub_needs():
# Needs # Needs
@ -366,6 +378,7 @@ def add_subroutine_needs():
parsed_text = add_subroutine_needs() parsed_text = add_subroutine_needs()
###################################################################### ######################################################################
def build_needs(): def build_needs():
# Needs # Needs
@ -428,6 +441,7 @@ for filename,text in parsed_text:
result.append ( (filename,text) ) result.append ( (filename,text) )
parsed_text = result parsed_text = result
###################################################################### ######################################################################
from command_line import command_line from command_line import command_line

View File

@ -1 +1 @@
version = "1.1.49" version = "1.1.50"