mirror of
https://gitlab.com/scemama/irpf90.git
synced 2024-09-02 01:33:42 +02:00
Merge branch 'master' of ssh://irpf90.git.sourceforge.net/gitroot/irpf90/irpf90
This commit is contained in:
commit
73abe9908d
@ -24,9 +24,12 @@
|
||||
# 31062 Toulouse Cedex 4
|
||||
# scemama@irsamc.ups-tlse.fr
|
||||
|
||||
import os
|
||||
from zlib import crc32
|
||||
|
||||
irpdir = "IRPF90_temp/"
|
||||
mandir = "IRPF90_man/"
|
||||
irp_id = crc32(os.getcwd())
|
||||
|
||||
|
||||
class Line(object):
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
import os,sys
|
||||
import irpf90_t
|
||||
from command_line import command_line
|
||||
irpdir = irpf90_t.irpdir
|
||||
mandir = irpf90_t.mandir
|
||||
|
||||
@ -70,6 +71,8 @@ def run():
|
||||
|
||||
result = "SRC += %sirp_stack.irp.F90"%(irpdir)
|
||||
result += " %sirp_touches.irp.F90"%(irpdir)
|
||||
if command_line.do_openmp:
|
||||
result += " %sirp_locks.irp.F90"%(irpdir)
|
||||
for m in mod:
|
||||
result += " %s%s.irp.F90"%(irpdir,m.name[:-4])
|
||||
result += " %s%s.irp.module.F90"%(irpdir,m.name[:-4])
|
||||
@ -82,7 +85,11 @@ def run():
|
||||
result += " %s%s.irp.module.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),
|
||||
if command_line.do_openmp:
|
||||
print >>file, " %sirp_locks.irp.o"%(irpdir)
|
||||
else:
|
||||
print >>file, ""
|
||||
|
||||
all = filter(lambda x: modules[x].is_main, modules)
|
||||
all = map(lambda x: x[:-6], all)
|
||||
@ -110,34 +117,37 @@ def run():
|
||||
mds = filter(lambda x: not x.is_main,mod)
|
||||
mds = map(lambda x: " %s%s.irp.o %s%s.irp.o"%(irpdir,x.name[:-4],irpdir,x.name[:-4]),mds)
|
||||
print >>file," ".join(mds)
|
||||
if command_line.do_openmp:
|
||||
print >>file, "%sirp_locks.irp.o:"%(irpdir),
|
||||
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.module.o: "+irpdir+"%.irp.module.F90"
|
||||
print >>file, "\t$(FC) $(FCFLAGS) -c "+irpdir+"$*.irp.module.F90 -o "+irpdir+"$*.irp.module.o"
|
||||
|
@ -191,6 +191,7 @@ class Fmodule(object):
|
||||
if command_line.do_openmp:
|
||||
temp += [ "!$OMP END MASTER" ]
|
||||
temp += [ "!$OMP END PARALLEL" ]
|
||||
temp += [ " call irp_finalize_%s()"%(irp_id) ]
|
||||
temp += [ "end program" ]
|
||||
result = temp + result
|
||||
self._residual_text = result
|
||||
|
@ -28,6 +28,7 @@
|
||||
from irpf90_t import *
|
||||
from util import *
|
||||
from variables import variables
|
||||
from modules import modules
|
||||
|
||||
FILENAME=irpdir+'irp_touches.irp.F90'
|
||||
|
||||
@ -35,18 +36,26 @@ def create():
|
||||
out = []
|
||||
l = variables.keys()
|
||||
l.sort
|
||||
finalize = "subroutine irp_finalize_%s\n"%(irp_id)
|
||||
for m in filter(lambda x: not modules[x].is_main, modules):
|
||||
finalize += " use %s\n"%(modules[m].name)
|
||||
for v in l:
|
||||
var = variables[v]
|
||||
if var.is_touched:
|
||||
out += var.toucher
|
||||
if var.dim != []:
|
||||
finalize += " if (allocated(%s)) then\n"%v
|
||||
finalize += " %s_is_built = .False.\n"%var.same_as
|
||||
finalize += " deallocate(%s)\n"%v
|
||||
finalize += " endif\n"
|
||||
finalize += "end\n"
|
||||
|
||||
|
||||
if out != []:
|
||||
out = map(lambda x: "%s\n"%(x),out)
|
||||
else:
|
||||
out = """
|
||||
subroutine irpf90_dummy_touch()
|
||||
end
|
||||
""".splitlines()
|
||||
|
||||
out += finalize
|
||||
|
||||
if not same_file(FILENAME,out):
|
||||
file = open(FILENAME,'w')
|
||||
file.writelines(out)
|
||||
|
@ -266,6 +266,44 @@ class Variable(object):
|
||||
return self._toucher
|
||||
toucher = property(toucher)
|
||||
|
||||
##########################################################
|
||||
def locker(self):
|
||||
if '_locker' not in self.__dict__:
|
||||
if not command_line.do_openmp:
|
||||
self._locker = []
|
||||
else:
|
||||
from modules import modules
|
||||
from variables import variables
|
||||
name = self.name
|
||||
result = [ "subroutine irp_lock_%s(set)"%(name) ]
|
||||
result += [ " use omp_lib",
|
||||
" implicit none",
|
||||
" logical, intent(in) :: set",
|
||||
" integer(kind=omp_nest_lock_kind),save :: %s_lock"%(name),
|
||||
" integer,save :: ifirst",
|
||||
]
|
||||
if command_line.do_debug:
|
||||
length = str(len("irp_lock_%s"%(name)))
|
||||
result += [ " character*(%s) :: irp_here = 'irp_lock_%s'"%(length,name),
|
||||
" call irp_enter(irp_here)" ]
|
||||
result += [ " if (ifirst == 0) then",
|
||||
" ifirst = 1",
|
||||
" call omp_init_nest_lock(%s_lock)"%(name),
|
||||
" endif",
|
||||
" if (set) then",
|
||||
" call omp_set_nest_lock(%s_lock)"%(name),
|
||||
" else",
|
||||
" call omp_unset_nest_lock(%s_lock)"%(name),
|
||||
" endif",
|
||||
]
|
||||
if command_line.do_debug:
|
||||
result.append(" call irp_leave(irp_here)")
|
||||
result.append("end subroutine irp_lock_%s"%(name))
|
||||
result.append("")
|
||||
self._locker = result
|
||||
return self._locker
|
||||
locker = property(locker)
|
||||
|
||||
##########################################################
|
||||
def reader(self):
|
||||
if '_reader' not in self.__dict__:
|
||||
@ -469,20 +507,20 @@ class Variable(object):
|
||||
" character*(%d) :: irp_here = 'provide_%s'"%(length,name),
|
||||
" integer :: irp_err ",
|
||||
" logical :: irp_dimensions_OK" ]
|
||||
if command_line.do_openmp:
|
||||
result.append(" call irp_lock_%s(.True.)"%(same_as))
|
||||
if command_line.do_assert or command_line.do_debug:
|
||||
result.append(" call irp_enter(irp_here)")
|
||||
result += call_provides(self.to_provide)
|
||||
result += flatten( map(build_alloc,[self.same_as]+self.others) )
|
||||
if command_line.do_openmp:
|
||||
result += [ "!$OMP CRITICAL (%s_critical)"%(same_as) ]
|
||||
result += [ " if (.not.%s_is_built) then"%(same_as) ]
|
||||
result += [ " call bld_%s"%(same_as) ]
|
||||
result += [ " %s_is_built = .True."%(same_as), "" ]
|
||||
if command_line.do_openmp:
|
||||
result += [ " endif" ]
|
||||
result += [ "!$OMP END CRITICAL (%s_critical)"%(same_as) ]
|
||||
result += [ " if (.not.%s_is_built) then"%(same_as),
|
||||
" call bld_%s"%(same_as),
|
||||
" %s_is_built = .True."%(same_as), "" ]
|
||||
result += [ " endif" ]
|
||||
if command_line.do_assert or command_line.do_debug:
|
||||
result.append(" call irp_leave(irp_here)")
|
||||
if command_line.do_openmp:
|
||||
result.append(" call irp_lock_%s(.False.)"%(same_as))
|
||||
result.append("end subroutine provide_%s"%(name) )
|
||||
result.append("")
|
||||
self._provider = result
|
||||
|
@ -1 +1 @@
|
||||
version = "1.1.70"
|
||||
version = "1.1.74"
|
||||
|
Loading…
Reference in New Issue
Block a user