Added irp_id and deallocate array upon termination

Version:1.1.73
This commit is contained in:
Anthony Scemama 2011-06-01 15:36:04 +02:00
parent 3289431ca8
commit b4e93c05da
5 changed files with 19 additions and 7 deletions

View File

@ -87,10 +87,6 @@ def main():
import touches
touches.create()
if command_line.do_openmp:
import locks
locks.create()
import create_man
create_man.run()

View File

@ -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):

View File

@ -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

View File

@ -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,15 +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
var2 = variables[v]
if var2.dim != []:
finalize += " if (allocated(%s)) then\n"%v
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()\n", "end\n"]
out += finalize
if not same_file(FILENAME,out):
file = open(FILENAME,'w')
file.writelines(out)

View File

@ -1 +1 @@
version = "1.1.72"
version = "1.1.73"