mirror of
https://gitlab.com/scemama/irpf90.git
synced 2024-12-21 11:53:32 +01:00
Parallelized parsed_text
Version:1.1.50
This commit is contained in:
parent
86f281f5ab
commit
999093aedb
@ -96,14 +96,20 @@ def do_print(var):
|
||||
######################################################################
|
||||
def run():
|
||||
import parsed_text
|
||||
file = open("irpf90_entities","w")
|
||||
import os,sys
|
||||
l = variables.keys()
|
||||
l.sort()
|
||||
for v in l:
|
||||
do_print_short(file,variables[v])
|
||||
file.close()
|
||||
for v in l:
|
||||
do_print(variables[v])
|
||||
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()
|
||||
for v in l:
|
||||
do_print_short(file,variables[v])
|
||||
file.close()
|
||||
sys.exit(0)
|
||||
|
||||
######################################################################
|
||||
if __name__ == '__main__':
|
||||
|
@ -63,6 +63,7 @@ def main():
|
||||
if not command_line.do_run:
|
||||
return
|
||||
|
||||
|
||||
init()
|
||||
|
||||
import irp_stack
|
||||
|
161
src/makefile.py
161
src/makefile.py
@ -25,6 +25,7 @@
|
||||
# scemama@irsamc.ups-tlse.fr
|
||||
|
||||
|
||||
import os,sys
|
||||
import irpf90_t
|
||||
irpdir = irpf90_t.irpdir
|
||||
mandir = irpf90_t.mandir
|
||||
@ -60,93 +61,95 @@ irpf90.make: $(wildcard *.irp.f)
|
||||
######################################################################
|
||||
def run():
|
||||
from modules import modules
|
||||
mod = []
|
||||
for m in modules.keys():
|
||||
mod.append(modules[m])
|
||||
if os.fork() == 0:
|
||||
mod = []
|
||||
for m in modules.keys():
|
||||
mod.append(modules[m])
|
||||
|
||||
file = open('irpf90.make','w')
|
||||
file = open('irpf90.make','w')
|
||||
|
||||
result = "SRC += %sirp_stack.irp.F90"%(irpdir)
|
||||
result += " %sirp_touches.irp.F90"%(irpdir)
|
||||
for m in mod:
|
||||
result += " %s%s.irp.F90"%(irpdir,m.name[:-4])
|
||||
print >>file, result
|
||||
result = "SRC += %sirp_stack.irp.F90"%(irpdir)
|
||||
result += " %sirp_touches.irp.F90"%(irpdir)
|
||||
for m in mod:
|
||||
result += " %s%s.irp.F90"%(irpdir,m.name[:-4])
|
||||
print >>file, result
|
||||
|
||||
result = "OBJ += %sirp_stack.irp.o"%(irpdir)
|
||||
for m in mod:
|
||||
if not m.is_main:
|
||||
result += " %s%s.irp.o"%(irpdir,m.name[:-4])
|
||||
print >>file, result
|
||||
result = "OBJ += %sirp_stack.irp.o"%(irpdir)
|
||||
for m in mod:
|
||||
if not m.is_main:
|
||||
result += " %s%s.irp.o"%(irpdir,m.name[:-4])
|
||||
print >>file, result
|
||||
|
||||
print >>file, "OBJ1 = $(patsubst %%, %s%%,$(notdir $(OBJ))) %sirp_touches.irp.o"%(irpdir,irpdir)
|
||||
print >>file, "OBJ1 = $(patsubst %%, %s%%,$(notdir $(OBJ))) %sirp_touches.irp.o"%(irpdir,irpdir)
|
||||
|
||||
all = filter(lambda x: modules[x].is_main, modules)
|
||||
all = map(lambda x: x[:-6], all)
|
||||
all_o = map(lambda x: "%s.irp.o"%(x), all)
|
||||
print >>file, "ALL = %s"%(" ".join(all))
|
||||
print >>file, "ALL_OBJ = %s"%(" ".join(all_o))
|
||||
print >>file, "ALL_OBJ1 = $(patsubst %%, %s%%,$(notdir $(ALL_OBJ)))"%(irpdir)
|
||||
print >>file, "all:$(ALL)"
|
||||
print >>file, "\t@make -s move"
|
||||
for m in mod:
|
||||
if m.is_main:
|
||||
exe = m.name[:-4]
|
||||
print >>file, "%s: %s%s.irp.o $(OBJ1)"%(exe,irpdir,exe)
|
||||
print >>file, "\t$(FC) -o $@ %s$@.irp.o $(OBJ1) $(LIB)"%(irpdir)
|
||||
print >>file, "\t@make -s move"
|
||||
all = filter(lambda x: modules[x].is_main, modules)
|
||||
all = map(lambda x: x[:-6], all)
|
||||
all_o = map(lambda x: "%s.irp.o"%(x), all)
|
||||
print >>file, "ALL = %s"%(" ".join(all))
|
||||
print >>file, "ALL_OBJ = %s"%(" ".join(all_o))
|
||||
print >>file, "ALL_OBJ1 = $(patsubst %%, %s%%,$(notdir $(ALL_OBJ)))"%(irpdir)
|
||||
print >>file, "all:$(ALL)"
|
||||
print >>file, "\t@make -s move"
|
||||
for m in mod:
|
||||
if m.is_main:
|
||||
exe = m.name[:-4]
|
||||
print >>file, "%s: %s%s.irp.o $(OBJ1)"%(exe,irpdir,exe)
|
||||
print >>file, "\t$(FC) -o $@ %s$@.irp.o $(OBJ1) $(LIB)"%(irpdir)
|
||||
print >>file, "\t@make -s move"
|
||||
|
||||
buffer = ""
|
||||
for m in mod:
|
||||
filename = "%s%s.irp.o:"%(irpdir,m.name[:-4])
|
||||
mds = map (lambda x: " %s%s.irp.o"%(irpdir,x[:-4]),m.needed_modules)
|
||||
print >>file, filename+" ".join(mds)
|
||||
if not m.is_main:
|
||||
buffer += "\t - @echo '"+filename+" ".join(mds)+"' >> %sdist_Makefile\n"%(irpdir)
|
||||
print >>file, "%sirp_touches.irp.o:"%(irpdir),
|
||||
mds = filter(lambda x: not x.is_main,mod)
|
||||
mds = map(lambda x: " %s%s.irp.o"%(irpdir,x.name[:-4]),mds)
|
||||
print >>file," ".join(mds)
|
||||
|
||||
buffer = ""
|
||||
for m in mod:
|
||||
filename = "%s%s.irp.o:"%(irpdir,m.name[:-4])
|
||||
mds = map (lambda x: " %s%s.irp.o"%(irpdir,x[:-4]),m.needed_modules)
|
||||
print >>file, filename+" ".join(mds)
|
||||
if not m.is_main:
|
||||
buffer += "\t - @echo '"+filename+" ".join(mds)+"' >> %sdist_Makefile\n"%(irpdir)
|
||||
print >>file, "%sirp_touches.irp.o:"%(irpdir),
|
||||
mds = filter(lambda x: not x.is_main,mod)
|
||||
mds = map(lambda x: " %s%s.irp.o"%(irpdir,x.name[:-4]),mds)
|
||||
print >>file," ".join(mds)
|
||||
|
||||
|
||||
print >>file, "%sdist_Makefile:"%(irpdir)
|
||||
print >>file, "\t- @echo FC=$(FC) > %sdist_Makefile"%(irpdir)
|
||||
print >>file, "\t- @echo FCFLAGS=$(FCFLAGS) >> %sdist_Makefile"%(irpdir)
|
||||
print >>file, "\t- @echo LIB=$(LIB) >> %sdist_Makefile"%(irpdir)
|
||||
print >>file, "\t- @echo .DEFAULT_GOAL: exe >> %sdist_Makefile"%(irpdir)
|
||||
print >>file, "\t- @echo 'exe: $$(EXE).irp.F90 $(OBJ) irp_touches.irp.o' >> %sdist_Makefile"%(irpdir)
|
||||
print >>file, "\t- @echo '\t$$(FC) -o $$(EXE) $$(EXE).irp.F90 $(OBJ) irp_touches.irp.o $$(LIB)' >> %sdist_Makefile"%(irpdir)
|
||||
print >>file, "\t- @echo '%%.o: %%.F90' >> %sdist_Makefile"%(irpdir)
|
||||
print >>file, "\t- @echo '\t$$(FC) $$(FCFLAGS) -c $$*.F90 -o $$*.o' >> %sdist_Makefile"%(irpdir)
|
||||
print >>file, "\t- @echo 'clean:' >> %sdist_Makefile"%(irpdir)
|
||||
print >>file, "\t- @echo '\trm *.o *.mod $$(EXE) 2>/dev/null' >> %sdist_Makefile"%(irpdir)
|
||||
print >>file, buffer
|
||||
print >>file, "\t- @echo '\tirp_touches.irp.o: irp_touches.irp.F90 $(OBJ) >> %sdist_Makefile"%(irpdir)
|
||||
print >>file, "%sdist_Makefile:"%(irpdir)
|
||||
print >>file, "\t- @echo FC=$(FC) > %sdist_Makefile"%(irpdir)
|
||||
print >>file, "\t- @echo FCFLAGS=$(FCFLAGS) >> %sdist_Makefile"%(irpdir)
|
||||
print >>file, "\t- @echo LIB=$(LIB) >> %sdist_Makefile"%(irpdir)
|
||||
print >>file, "\t- @echo .DEFAULT_GOAL: exe >> %sdist_Makefile"%(irpdir)
|
||||
print >>file, "\t- @echo 'exe: $$(EXE).irp.F90 $(OBJ) irp_touches.irp.o' >> %sdist_Makefile"%(irpdir)
|
||||
print >>file, "\t- @echo '\t$$(FC) -o $$(EXE) $$(EXE).irp.F90 $(OBJ) irp_touches.irp.o $$(LIB)' >> %sdist_Makefile"%(irpdir)
|
||||
print >>file, "\t- @echo '%%.o: %%.F90' >> %sdist_Makefile"%(irpdir)
|
||||
print >>file, "\t- @echo '\t$$(FC) $$(FCFLAGS) -c $$*.F90 -o $$*.o' >> %sdist_Makefile"%(irpdir)
|
||||
print >>file, "\t- @echo 'clean:' >> %sdist_Makefile"%(irpdir)
|
||||
print >>file, "\t- @echo '\trm *.o *.mod $$(EXE) 2>/dev/null' >> %sdist_Makefile"%(irpdir)
|
||||
print >>file, buffer
|
||||
print >>file, "\t- @echo '\tirp_touches.irp.o: irp_touches.irp.F90 $(OBJ) >> %sdist_Makefile"%(irpdir)
|
||||
|
||||
print >>file, "%%.dist: %sdist_Makefile"%(irpdir)
|
||||
print >>file, "\t- @mkdir -p dist/$*| DO_NOTHING="
|
||||
print >>file, "\t- @cp %s* dist/$*/| DO_NOTHING="%(irpdir)
|
||||
print >>file, "\t- @for i in $(ALL) $(OBJ) irp_touches.irp.o $(ALL_OBJ); do rm dist/$*/$$i ; done| DO_NOTHING="
|
||||
print >>file, "\t- @for i in $(ALL) ; do rm dist/$*/$$i.irp.F90 ; done| DO_NOTHING="
|
||||
print >>file, "\t- @rm dist/$*/{*.irp.f,*.mod,irpf90_entities}| DO_NOTHING="
|
||||
print >>file, "\t- @rm dist/$*/*.mod 2>/dev/null| DO_NOTHING="
|
||||
print >>file, "\t- @echo 'EXE = $*' > dist/$*/Makefile| DO_NOTHING="
|
||||
print >>file, "\t- @cat dist/$*/dist_Makefile >> dist/$*/Makefile| DO_NOTHING="
|
||||
print >>file, "\t- @rm dist/$*/dist_Makefile| DO_NOTHING="
|
||||
print >>file, "\t- @cp %s$*.irp.F90 dist/$*/| DO_NOTHING="%(irpdir)
|
||||
print >>file, "\t- cd dist ; tar -zcvf ../$*.tar.gz $*\n"
|
||||
print >>file, "%%.dist: %sdist_Makefile"%(irpdir)
|
||||
print >>file, "\t- @mkdir -p dist/$*| DO_NOTHING="
|
||||
print >>file, "\t- @cp %s* dist/$*/| DO_NOTHING="%(irpdir)
|
||||
print >>file, "\t- @for i in $(ALL) $(OBJ) irp_touches.irp.o $(ALL_OBJ); do rm dist/$*/$$i ; done| DO_NOTHING="
|
||||
print >>file, "\t- @for i in $(ALL) ; do rm dist/$*/$$i.irp.F90 ; done| DO_NOTHING="
|
||||
print >>file, "\t- @rm dist/$*/{*.irp.f,*.mod,irpf90_entities}| DO_NOTHING="
|
||||
print >>file, "\t- @rm dist/$*/*.mod 2>/dev/null| DO_NOTHING="
|
||||
print >>file, "\t- @echo 'EXE = $*' > dist/$*/Makefile| DO_NOTHING="
|
||||
print >>file, "\t- @cat dist/$*/dist_Makefile >> dist/$*/Makefile| DO_NOTHING="
|
||||
print >>file, "\t- @rm dist/$*/dist_Makefile| DO_NOTHING="
|
||||
print >>file, "\t- @cp %s$*.irp.F90 dist/$*/| DO_NOTHING="%(irpdir)
|
||||
print >>file, "\t- cd dist ; tar -zcvf ../$*.tar.gz $*\n"
|
||||
|
||||
print >>file, irpdir+"%.irp.o: "+irpdir+"%.irp.F90"
|
||||
print >>file, "\t$(FC) $(FCFLAGS) -c "+irpdir+"$*.irp.F90 -o "+irpdir+"$*.irp.o"
|
||||
print >>file, irpdir+"%.o: %.F90"
|
||||
print >>file, "\t$(FC) $(FCFLAGS) -c $*.F90 -o "+irpdir+"$*.o"
|
||||
print >>file, irpdir+"%.o: %.f90\n\t$(FC) $(FCFLAGS) -c $*.f90 -o "+irpdir+"$*.o"
|
||||
print >>file, irpdir+"%.o: %.f\n\t$(FC) $(FCFLAGS) -c $*.f -o "+irpdir+"$*.o"
|
||||
print >>file, irpdir+"%.o: %.F\n\t$(FC) $(FCFLAGS) -c $*.F -o "+irpdir+"$*.o"
|
||||
print >>file, irpdir+"%.irp.F90: irpf90.make\n"
|
||||
print >>file, "move:\n\t@mv -f *.mod IRPF90_temp/ 2> /dev/null | DO_NOTHING=\n"
|
||||
print >>file, "clean:\n\trm -rf $(EXE) $(OBJ1) $(ALL_OBJ1) $(ALL)\n"
|
||||
print >>file, "veryclean:\n\t- make clean\n"
|
||||
print >>file, "\t- rm -rf "+irpdir+" "+mandir+" irpf90.make irpf90_variables dist\n"
|
||||
print >>file, irpdir+"%.irp.o: "+irpdir+"%.irp.F90"
|
||||
print >>file, "\t$(FC) $(FCFLAGS) -c "+irpdir+"$*.irp.F90 -o "+irpdir+"$*.irp.o"
|
||||
print >>file, irpdir+"%.o: %.F90"
|
||||
print >>file, "\t$(FC) $(FCFLAGS) -c $*.F90 -o "+irpdir+"$*.o"
|
||||
print >>file, irpdir+"%.o: %.f90\n\t$(FC) $(FCFLAGS) -c $*.f90 -o "+irpdir+"$*.o"
|
||||
print >>file, irpdir+"%.o: %.f\n\t$(FC) $(FCFLAGS) -c $*.f -o "+irpdir+"$*.o"
|
||||
print >>file, irpdir+"%.o: %.F\n\t$(FC) $(FCFLAGS) -c $*.F -o "+irpdir+"$*.o"
|
||||
print >>file, irpdir+"%.irp.F90: irpf90.make\n"
|
||||
print >>file, "move:\n\t@mv -f *.mod IRPF90_temp/ 2> /dev/null | DO_NOTHING=\n"
|
||||
print >>file, "clean:\n\trm -rf $(EXE) $(OBJ1) $(ALL_OBJ1) $(ALL)\n"
|
||||
print >>file, "veryclean:\n\t- make clean\n"
|
||||
print >>file, "\t- rm -rf "+irpdir+" "+mandir+" irpf90.make irpf90_variables dist\n"
|
||||
|
||||
file.close()
|
||||
file.close()
|
||||
sys.exit(0)
|
||||
|
||||
|
@ -87,9 +87,8 @@ def check_touch(line,vars,main_vars):
|
||||
error.fail(line,message)
|
||||
|
||||
def get_parsed_text():
|
||||
main_result = []
|
||||
varlist = []
|
||||
for filename, text in preprocessed_text:
|
||||
def func(filename, text):
|
||||
varlist = []
|
||||
result = []
|
||||
for line in filter(
|
||||
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 = filter(lambda x: x not in varlist, l)
|
||||
result.append( (l,line) )
|
||||
main_result.append( (filename, result) )
|
||||
return main_result
|
||||
return 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()
|
||||
|
||||
|
||||
|
||||
######################################################################
|
||||
|
||||
def move_to_top(text,t):
|
||||
@ -240,6 +246,7 @@ for filename,text in parsed_text:
|
||||
result.append ( (filename,text) )
|
||||
parsed_text = result
|
||||
|
||||
|
||||
######################################################################
|
||||
def move_variables():
|
||||
|
||||
@ -329,9 +336,14 @@ def move_variables():
|
||||
result.append( (vars,line) )
|
||||
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()
|
||||
|
||||
######################################################################
|
||||
def build_sub_needs():
|
||||
# Needs
|
||||
@ -366,6 +378,7 @@ def add_subroutine_needs():
|
||||
|
||||
parsed_text = add_subroutine_needs()
|
||||
|
||||
|
||||
######################################################################
|
||||
def build_needs():
|
||||
# Needs
|
||||
@ -428,6 +441,7 @@ for filename,text in parsed_text:
|
||||
result.append ( (filename,text) )
|
||||
parsed_text = result
|
||||
|
||||
|
||||
######################################################################
|
||||
from command_line import command_line
|
||||
|
||||
|
@ -1 +1 @@
|
||||
version = "1.1.49"
|
||||
version = "1.1.50"
|
||||
|
Loading…
Reference in New Issue
Block a user