mirror of
https://gitlab.com/scemama/irpf90.git
synced 2024-12-22 20:33:39 +01:00
commit
7a0ede7e87
2
Makefile
2
Makefile
@ -4,7 +4,7 @@ src:
|
|||||||
$(MAKE) -C $@
|
$(MAKE) -C $@
|
||||||
|
|
||||||
man:
|
man:
|
||||||
- $(MAKE) -C $@
|
- $(MAKE) -C $@ &> /dev/null
|
||||||
|
|
||||||
all: src man
|
all: src man
|
||||||
|
|
||||||
|
73
src/checkpoint.py
Normal file
73
src/checkpoint.py
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# IRPF90 is a Fortran90 preprocessor written in Python for programming using
|
||||||
|
# the Implicit Reference to Parameters (IRP) method.
|
||||||
|
# Copyright (C) 2009 Anthony SCEMAMA
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License along
|
||||||
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
#
|
||||||
|
# Anthony Scemama
|
||||||
|
# LCPQ - IRSAMC - CNRS
|
||||||
|
# Universite Paul Sabatier
|
||||||
|
# 118, route de Narbonne
|
||||||
|
# 31062 Toulouse Cedex 4
|
||||||
|
# scemama@irsamc.ups-tlse.fr
|
||||||
|
|
||||||
|
|
||||||
|
from irpf90_t import *
|
||||||
|
from util import *
|
||||||
|
from variables import variables
|
||||||
|
from modules import modules
|
||||||
|
|
||||||
|
CHECKPOINT_UNIT_NUMBER=63
|
||||||
|
|
||||||
|
FILENAME=irpdir+'irp_checkpoint.irp.F90'
|
||||||
|
|
||||||
|
def create():
|
||||||
|
out_write = [ "subroutine irp_checkpoint_write" ]
|
||||||
|
l = variables.keys()
|
||||||
|
l.sort
|
||||||
|
main_modules = filter(lambda x: modules[x].is_main, modules)
|
||||||
|
for m in filter(lambda x: not modules[x].is_main, modules):
|
||||||
|
out_write += [ " use %s"%(modules[m].name) ]
|
||||||
|
out_write += [ " implicit none" ]
|
||||||
|
out_write += [ " integer, parameter :: iunit = %d"%(CHECKPOINT_UNIT_NUMBER) ]
|
||||||
|
out_write += [ " open(unit=%d,file='irp_checkpoint.dat',status='UNKNOWN',action='WRITE')"%(CHECKPOINT_UNIT_NUMBER) ]
|
||||||
|
for v in l:
|
||||||
|
var = variables[v]
|
||||||
|
if var.is_main:
|
||||||
|
out_write += [ " if (%s_is_built) then"%(v) ]
|
||||||
|
for w in [v]+var.others:
|
||||||
|
d = variables[w].dim
|
||||||
|
if d == []:
|
||||||
|
out_write += [ " write(iunit,*) '%s', 0"%(w) ]
|
||||||
|
else:
|
||||||
|
out_write += [ " write(iunit, *) '%s', %d"%(w, len(d)),
|
||||||
|
" write(iunit, *) %s"%(",".join(
|
||||||
|
[ "size(%s,%d)"%(w,i+1) for i in range(len(d)) ] ))
|
||||||
|
]
|
||||||
|
out_write += [ " write(iunit,*) %s"%(w) ]
|
||||||
|
out_write += [ " endif" ]
|
||||||
|
out_write += [ " close(%d)"%(CHECKPOINT_UNIT_NUMBER) ]
|
||||||
|
out_write += [ "end" ]
|
||||||
|
|
||||||
|
out = '\n'.join(out_write)
|
||||||
|
if not same_file(FILENAME,out):
|
||||||
|
file = open(FILENAME,'w')
|
||||||
|
file.writelines(out)
|
||||||
|
file.close()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
create()
|
||||||
|
|
@ -256,6 +256,7 @@ def print_options():
|
|||||||
description = p1.communicate(description)[0]
|
description = p1.communicate(description)[0]
|
||||||
description = description.replace('\n','\n'.ljust(27))
|
description = description.replace('\n','\n'.ljust(27))
|
||||||
print ("-%s, --%s"%(k,options[k][0])).ljust(25), description+'\n'
|
print ("-%s, --%s"%(k,options[k][0])).ljust(25), description+'\n'
|
||||||
|
print "\n"
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print_options()
|
print_options()
|
||||||
|
@ -29,7 +29,7 @@ from distutils.extension import Extension
|
|||||||
from Cython.Distutils import build_ext
|
from Cython.Distutils import build_ext
|
||||||
import os
|
import os
|
||||||
|
|
||||||
to_remove = """cython_setup.py command_line.py""".split()
|
to_remove = """cython_setup.py version.py command_line.py""".split()
|
||||||
ext_modules = []
|
ext_modules = []
|
||||||
|
|
||||||
files = os.listdir('.')
|
files = os.listdir('.')
|
||||||
|
133
src/irp_stack.py
133
src/irp_stack.py
@ -31,6 +31,7 @@ from command_line import command_line
|
|||||||
do_assert = command_line.do_assert
|
do_assert = command_line.do_assert
|
||||||
do_debug = command_line.do_debug
|
do_debug = command_line.do_debug
|
||||||
do_openmp = command_line.do_openmp
|
do_openmp = command_line.do_openmp
|
||||||
|
do_memory = command_line.do_memory
|
||||||
|
|
||||||
import irpf90_t
|
import irpf90_t
|
||||||
|
|
||||||
@ -53,34 +54,45 @@ subroutine irp_enter(irp_where)
|
|||||||
use irp_stack_mod
|
use irp_stack_mod
|
||||||
integer :: ithread
|
integer :: ithread
|
||||||
character*(*) :: irp_where
|
character*(*) :: irp_where
|
||||||
!$ integer, external :: omp_get_thread_num
|
|
||||||
!$ integer, external :: omp_get_num_threads
|
|
||||||
ithread = 0
|
|
||||||
!$ ithread = omp_get_thread_num()
|
|
||||||
$1
|
|
||||||
"""
|
"""
|
||||||
|
if do_openmp:
|
||||||
if not command_line.do_openmp:
|
|
||||||
txt += """
|
txt += """
|
||||||
|
integer, external :: omp_get_thread_num
|
||||||
|
integer, external :: omp_get_num_threads
|
||||||
|
ithread = omp_get_thread_num()
|
||||||
if (ithread /= 0) then
|
if (ithread /= 0) then
|
||||||
print *, 'Error: Provider is called by thread', ithread
|
print *, 'Error: Provider is called by thread', ithread
|
||||||
call irp_trace
|
call irp_trace
|
||||||
stop 1
|
stop 1
|
||||||
endif
|
endif
|
||||||
|
"""
|
||||||
|
else:
|
||||||
|
txt += """
|
||||||
|
ithread = 0
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if command_line.do_memory:
|
txt += "$1"
|
||||||
txt+="""
|
|
||||||
|
if do_memory:
|
||||||
|
txt+="""
|
||||||
if (.not.alloc) then
|
if (.not.alloc) then
|
||||||
nthread = 1
|
"""
|
||||||
|
if do_openmp:
|
||||||
|
txt += """
|
||||||
!$OMP PARALLEL
|
!$OMP PARALLEL
|
||||||
!$OMP SINGLE
|
!$OMP SINGLE
|
||||||
!$ nthread = omp_get_num_threads()
|
nthread = omp_get_num_threads()
|
||||||
!$OMP END SINGLE
|
!$OMP END SINGLE
|
||||||
!$OMP END PARALLEL
|
!$OMP END PARALLEL
|
||||||
print *, 'Allocating irp_stack(',STACKMAX,',',nthread,')'
|
"""
|
||||||
print *, 'Allocating irp_cpu(',STACKMAX,',',nthread,')'
|
else:
|
||||||
print *, 'Allocating stack_index(',nthread,')'
|
txt += """
|
||||||
|
nthread = 1
|
||||||
|
"""
|
||||||
|
txt += """
|
||||||
|
print *, 'Allocating irp_stack(',STACKMAX,',',nthread,')'
|
||||||
|
print *, 'Allocating irp_cpu(',STACKMAX,',',nthread,')'
|
||||||
|
print *, 'Allocating stack_index(',nthread,')'
|
||||||
endif"""
|
endif"""
|
||||||
txt +="""
|
txt +="""
|
||||||
$2
|
$2
|
||||||
@ -90,25 +102,41 @@ subroutine irp_enter_f(irp_where)
|
|||||||
use irp_stack_mod
|
use irp_stack_mod
|
||||||
integer :: ithread
|
integer :: ithread
|
||||||
character*(*) :: irp_where
|
character*(*) :: irp_where
|
||||||
!$ integer, external :: omp_get_thread_num
|
"""
|
||||||
!$ integer, external :: omp_get_num_threads
|
if do_openmp:
|
||||||
ithread = 0
|
txt += """
|
||||||
!$ ithread = omp_get_thread_num()
|
integer, external :: omp_get_thread_num
|
||||||
|
integer, external :: omp_get_num_threads
|
||||||
|
ithread = omp_get_thread_num()
|
||||||
|
"""
|
||||||
|
else:
|
||||||
|
txt += """
|
||||||
|
ithread = 0
|
||||||
|
"""
|
||||||
|
txt += """
|
||||||
$1
|
$1
|
||||||
"""
|
"""
|
||||||
if command_line.do_memory:
|
if do_memory:
|
||||||
txt+="""
|
txt+="""
|
||||||
if (.not.alloc) then
|
if (.not.alloc) then
|
||||||
|
"""
|
||||||
|
if do_openmp:
|
||||||
|
txt += """
|
||||||
!$OMP PARALLEL
|
!$OMP PARALLEL
|
||||||
!$OMP SINGLE
|
!$OMP SINGLE
|
||||||
!$ nthread = omp_get_num_threads()
|
nthread = omp_get_num_threads()
|
||||||
|
!$OMP END SINGLE
|
||||||
|
!$OMP END PARALLEL
|
||||||
|
"""
|
||||||
|
else:
|
||||||
|
txt += """
|
||||||
|
nthread = 1
|
||||||
|
"""
|
||||||
|
txt +="""
|
||||||
print *, 'Allocating irp_stack(',STACKMAX,',',nthread,')'
|
print *, 'Allocating irp_stack(',STACKMAX,',',nthread,')'
|
||||||
print *, 'Allocating irp_cpu(',STACKMAX,',',nthread,')'
|
print *, 'Allocating irp_cpu(',STACKMAX,',',nthread,')'
|
||||||
print *, 'Allocating stack_index(',nthread,')'
|
print *, 'Allocating stack_index(',nthread,')'
|
||||||
!$OMP END SINGLE
|
endif
|
||||||
!$OMP END PARALLEL
|
|
||||||
endif"""
|
|
||||||
txt +="""
|
|
||||||
$2
|
$2
|
||||||
end subroutine
|
end subroutine
|
||||||
|
|
||||||
@ -117,9 +145,17 @@ subroutine irp_leave (irp_where)
|
|||||||
character*(*) :: irp_where
|
character*(*) :: irp_where
|
||||||
integer :: ithread
|
integer :: ithread
|
||||||
double precision :: cpu
|
double precision :: cpu
|
||||||
!$ integer, external :: omp_get_thread_num
|
"""
|
||||||
|
if do_openmp:
|
||||||
|
txt += """
|
||||||
|
integer, external :: omp_get_thread_num
|
||||||
|
ithread = omp_get_thread_num()
|
||||||
|
"""
|
||||||
|
else:
|
||||||
|
txt += """
|
||||||
ithread = 0
|
ithread = 0
|
||||||
!$ ithread = omp_get_thread_num()
|
"""
|
||||||
|
txt += """
|
||||||
$3
|
$3
|
||||||
$4
|
$4
|
||||||
end subroutine
|
end subroutine
|
||||||
@ -127,32 +163,49 @@ end subroutine
|
|||||||
|
|
||||||
# $1
|
# $1
|
||||||
if do_assert or do_debug:
|
if do_assert or do_debug:
|
||||||
txt = txt.replace("$1","""
|
s = """
|
||||||
if (.not.alloc) then
|
if (.not.alloc) then
|
||||||
|
"""
|
||||||
|
if do_openmp:
|
||||||
|
s += """
|
||||||
!$OMP PARALLEL
|
!$OMP PARALLEL
|
||||||
!$OMP SINGLE
|
!$OMP SINGLE
|
||||||
!$ nthread = omp_get_num_threads()
|
nthread = omp_get_num_threads()
|
||||||
!$OMP END SINGLE
|
!$OMP END SINGLE
|
||||||
!$OMP END PARALLEL
|
!$OMP END PARALLEL
|
||||||
!$OMP CRITICAL
|
!$OMP CRITICAL
|
||||||
if (.not.alloc) then
|
if (.not.alloc) then
|
||||||
allocate(irp_stack(0:STACKMAX,nthread+1))
|
allocate(irp_stack(0:STACKMAX,nthread))
|
||||||
allocate(irp_cpu(0:STACKMAX,nthread+1))
|
allocate(irp_cpu(0:STACKMAX,nthread))
|
||||||
allocate(stack_index(nthread+1))
|
allocate(stack_index(nthread))
|
||||||
stack_index = 0
|
stack_index = 0
|
||||||
alloc = .True.
|
alloc = .True.
|
||||||
endif
|
endif
|
||||||
!$OMP END CRITICAL
|
!$OMP END CRITICAL
|
||||||
endif
|
endif
|
||||||
stack_index(ithread+1) = mod(stack_index(ithread+1)+1,STACKMAX)
|
stack_index(ithread+1) = mod(stack_index(ithread+1)+1,STACKMAX)
|
||||||
irp_stack(stack_index(ithread+1),ithread+1) = irp_where""")
|
irp_stack(stack_index(ithread+1),ithread+1) = irp_where"""
|
||||||
if command_line.do_memory:
|
else:
|
||||||
|
s += """
|
||||||
|
nthread = 1
|
||||||
|
if (.not.alloc) then
|
||||||
|
allocate(irp_stack(0:STACKMAX,1))
|
||||||
|
allocate(irp_cpu(0:STACKMAX,1))
|
||||||
|
allocate(stack_index(2))
|
||||||
|
stack_index = 0
|
||||||
|
alloc = .True.
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
stack_index(1) = mod(stack_index(1)+1,STACKMAX)
|
||||||
|
irp_stack(stack_index(1),1) = irp_where"""
|
||||||
|
if do_memory:
|
||||||
txt+="""
|
txt+="""
|
||||||
print *, 'Allocating irp_stack(',STACKMAX,','nthread,')'
|
print *, 'Allocating irp_stack(',STACKMAX,','nthread,')'
|
||||||
print *, 'Allocating irp_cpu(',STACKMAX,','nthread,')'
|
print *, 'Allocating irp_cpu(',STACKMAX,','nthread,')'
|
||||||
print *, 'Allocating stack_index(',nthread,')'"""
|
print *, 'Allocating stack_index(',nthread,')'"""
|
||||||
else:
|
else:
|
||||||
txt = txt.replace("$1","")
|
s = ""
|
||||||
|
txt = txt.replace("$1",s)
|
||||||
|
|
||||||
# $2
|
# $2
|
||||||
if do_debug:
|
if do_debug:
|
||||||
@ -184,9 +237,17 @@ subroutine irp_trace
|
|||||||
use irp_stack_mod
|
use irp_stack_mod
|
||||||
integer :: ithread
|
integer :: ithread
|
||||||
integer :: i
|
integer :: i
|
||||||
|
"""
|
||||||
|
if do_openmp:
|
||||||
|
txt += """
|
||||||
!$ integer, external :: omp_get_thread_num
|
!$ integer, external :: omp_get_thread_num
|
||||||
ithread = 0
|
|
||||||
!$ ithread = omp_get_thread_num()
|
!$ ithread = omp_get_thread_num()
|
||||||
|
"""
|
||||||
|
else:
|
||||||
|
txt += """
|
||||||
|
ithread = 0
|
||||||
|
"""
|
||||||
|
txt += """
|
||||||
if (.not.alloc) return
|
if (.not.alloc) return
|
||||||
print *, 'Stack trace: ', ithread
|
print *, 'Stack trace: ', ithread
|
||||||
print *, '-------------------------'
|
print *, '-------------------------'
|
||||||
|
@ -100,6 +100,9 @@ def main():
|
|||||||
import touches
|
import touches
|
||||||
touches.create()
|
touches.create()
|
||||||
|
|
||||||
|
import checkpoint
|
||||||
|
checkpoint.create()
|
||||||
|
|
||||||
import create_man
|
import create_man
|
||||||
create_man.run()
|
create_man.run()
|
||||||
|
|
||||||
|
@ -91,6 +91,7 @@ def run():
|
|||||||
result += "\n"
|
result += "\n"
|
||||||
result += "SRC += %sirp_stack.irp.F90"%(irpdir)
|
result += "SRC += %sirp_stack.irp.F90"%(irpdir)
|
||||||
result += " %sirp_touches.irp.F90"%(irpdir)
|
result += " %sirp_touches.irp.F90"%(irpdir)
|
||||||
|
result += " %sirp_checkpoint.irp.F90"%(irpdir)
|
||||||
if command_line.do_openmp:
|
if command_line.do_openmp:
|
||||||
result += " %sirp_locks.irp.F90"%(irpdir)
|
result += " %sirp_locks.irp.F90"%(irpdir)
|
||||||
if command_line.do_profile:
|
if command_line.do_profile:
|
||||||
@ -107,7 +108,7 @@ def run():
|
|||||||
result += " %s%s.irp.module.o"%(irpdir,m.filename)
|
result += " %s%s.irp.module.o"%(irpdir,m.filename)
|
||||||
print >>file, result
|
print >>file, result
|
||||||
|
|
||||||
print >>file, "OBJ1 = $(OBJ_IRP) $(OBJ) %sirp_touches.irp.o"%(irpdir),
|
print >>file, "OBJ1 = $(OBJ_IRP) $(OBJ) %sirp_touches.irp.o %sirp_checkpoint.irp.o"%(irpdir,irpdir),
|
||||||
if command_line.do_profile:
|
if command_line.do_profile:
|
||||||
print >>file, " %sirp_profile.irp.o"%(irpdir), " irp_rdtsc.o",
|
print >>file, " %sirp_profile.irp.o"%(irpdir), " irp_rdtsc.o",
|
||||||
if command_line.do_codelet:
|
if command_line.do_codelet:
|
||||||
@ -150,7 +151,7 @@ def run():
|
|||||||
print >>file, filename," ".join(mds)," ".join(m.includes)
|
print >>file, filename," ".join(mds)," ".join(m.includes)
|
||||||
if not m.is_main:
|
if not m.is_main:
|
||||||
buffer += "\t - @echo '"+filename+" ".join(mds)+"' >> %sdist_Makefile\n"%(irpdir)
|
buffer += "\t - @echo '"+filename+" ".join(mds)+"' >> %sdist_Makefile\n"%(irpdir)
|
||||||
print >>file, "%sirp_touches.irp.o: $(OBJ) "%(irpdir),
|
print >>file, "%sirp_touches.irp.o %sirp_checkpoint.irp.o: $(OBJ) "%(irpdir,irpdir),
|
||||||
mds = filter(lambda x: not x.is_main,mod)
|
mds = filter(lambda x: not x.is_main,mod)
|
||||||
mds = map(lambda x: " %s%s.irp.o %s%s.irp.o"%(irpdir,x.filename,irpdir,x.filename),mds)
|
mds = map(lambda x: " %s%s.irp.o %s%s.irp.o"%(irpdir,x.filename,irpdir,x.filename),mds)
|
||||||
print >>file," ".join(mds)
|
print >>file," ".join(mds)
|
||||||
@ -162,33 +163,6 @@ def run():
|
|||||||
print >>file," ".join(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) $(OBJ) irp_touches.irp.o' >> %sdist_Makefile"%(irpdir)
|
|
||||||
# print >>file, "\t- @echo '\t$$(FC) -o $$(EXE) $$(EXE).irp.F90 $(OBJ_IRP) $(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_IRP) $(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"
|
|
||||||
|
|
||||||
for dir in [ irpdir ] + map(lambda x: irpdir+x, command_line.include_dir):
|
for dir in [ irpdir ] + map(lambda x: irpdir+x, command_line.include_dir):
|
||||||
print >>file, dir+"%.irp.module.o: $(OBJ) "+dir+"%.irp.module.F90"
|
print >>file, dir+"%.irp.module.o: $(OBJ) "+dir+"%.irp.module.F90"
|
||||||
print >>file, "\t$(FC) $(FCFLAGS) -c "+dir+"$*.irp.module.F90 -o "+dir+"$*.irp.module.o"
|
print >>file, "\t$(FC) $(FCFLAGS) -c "+dir+"$*.irp.module.F90 -o "+dir+"$*.irp.module.o"
|
||||||
|
@ -522,6 +522,8 @@ def irp_simple_statements(text):
|
|||||||
def process_assert(line):
|
def process_assert(line):
|
||||||
assert type(line) == Assert
|
assert type(line) == Assert
|
||||||
if command_line.do_assert:
|
if command_line.do_assert:
|
||||||
|
if '(' not in line.text or ')' not in line.text:
|
||||||
|
error.fail(line,"Syntax error in ASSERT statement (parentheses)")
|
||||||
condition = "(%s"%(line.text.split('(',1)[1])
|
condition = "(%s"%(line.text.split('(',1)[1])
|
||||||
if condition == "":
|
if condition == "":
|
||||||
error.fail(line,"Error in Assert statement")
|
error.fail(line,"Error in Assert statement")
|
||||||
|
@ -136,8 +136,8 @@ subroutine irp_print_timer()
|
|||||||
call profile_sort()
|
call profile_sort()
|
||||||
print '(A24,A8,A17,A20,A13,A20)', '', 'N.Calls', 'Tot Cycles', 'Avg Cycles', &
|
print '(A24,A8,A17,A20,A13,A20)', '', 'N.Calls', 'Tot Cycles', 'Avg Cycles', &
|
||||||
'Tot Secs', 'Avg Secs'
|
'Tot Secs', 'Avg Secs'
|
||||||
print '(A)', '----------------------------------------------'// &
|
print '(A)', '---------------------------------------------------'// &
|
||||||
'----------------------------------------------'
|
'---------------------------------------------------'
|
||||||
do ii=1,%(n)d
|
do ii=1,%(n)d
|
||||||
i = irp_order(ii)
|
i = irp_order(ii)
|
||||||
if (irp_profile(3,i) > 0.) then
|
if (irp_profile(3,i) > 0.) then
|
||||||
|
@ -110,9 +110,9 @@ def dimsize(x):
|
|||||||
if b0.replace('-','').isdigit():
|
if b0.replace('-','').isdigit():
|
||||||
size = "%s - (%d)"%(b1,int(b0)-1)
|
size = "%s - (%d)"%(b1,int(b0)-1)
|
||||||
elif b1.replace('-','').isdigit():
|
elif b1.replace('-','').isdigit():
|
||||||
size = "%d - %s"%(int(b1)+1,b0)
|
size = "%d - (%s)"%(int(b1)+1,b0)
|
||||||
else:
|
else:
|
||||||
size = "%s - %s + 1"%(b1,b0)
|
size = "%s - (%s) + 1"%(b1,b0)
|
||||||
return size
|
return size
|
||||||
|
|
||||||
def put_info(text,filename):
|
def put_info(text,filename):
|
||||||
|
@ -464,17 +464,6 @@ class Variable(object):
|
|||||||
name = self.name
|
name = self.name
|
||||||
same_as = self.same_as
|
same_as = self.same_as
|
||||||
|
|
||||||
def check_openmp():
|
|
||||||
if not command_line.do_openmp:
|
|
||||||
result = [ "!$ nthreads = omp_get_num_threads()" ,
|
|
||||||
"!$ if (nthreads > 1) then" ,
|
|
||||||
"!$ print *, irp_here//': Error: Provider in an openMP section'" ,
|
|
||||||
"!$ stop 1",
|
|
||||||
"!$ endif" ]
|
|
||||||
else:
|
|
||||||
result = []
|
|
||||||
return result
|
|
||||||
|
|
||||||
def build_alloc(name):
|
def build_alloc(name):
|
||||||
self = variables[name]
|
self = variables[name]
|
||||||
if self.dim == []:
|
if self.dim == []:
|
||||||
@ -547,7 +536,8 @@ class Variable(object):
|
|||||||
result += [ "!DEC$ ATTRIBUTES FORCEINLINE :: provide_%s"%(name) ]
|
result += [ "!DEC$ ATTRIBUTES FORCEINLINE :: provide_%s"%(name) ]
|
||||||
result += [ "subroutine provide_%s"%(name) ]
|
result += [ "subroutine provide_%s"%(name) ]
|
||||||
result += build_use( [same_as]+self.to_provide )
|
result += build_use( [same_as]+self.to_provide )
|
||||||
result += ["!$ use omp_lib"]
|
if command_line.do_openmp:
|
||||||
|
result += [" use omp_lib"]
|
||||||
result.append(" implicit none")
|
result.append(" implicit none")
|
||||||
length = len("provide_%s"%(name))
|
length = len("provide_%s"%(name))
|
||||||
result += [\
|
result += [\
|
||||||
@ -557,8 +547,6 @@ class Variable(object):
|
|||||||
"!$ integer :: nthreads"]
|
"!$ integer :: nthreads"]
|
||||||
if command_line.do_openmp:
|
if command_line.do_openmp:
|
||||||
result.append(" call irp_lock_%s(.True.)"%(same_as))
|
result.append(" call irp_lock_%s(.True.)"%(same_as))
|
||||||
else:
|
|
||||||
result += check_openmp()
|
|
||||||
if command_line.do_assert or command_line.do_debug:
|
if command_line.do_assert or command_line.do_debug:
|
||||||
result.append(" call irp_enter(irp_here)")
|
result.append(" call irp_enter(irp_here)")
|
||||||
result += call_provides(self.to_provide)
|
result += call_provides(self.to_provide)
|
||||||
|
@ -1 +1 @@
|
|||||||
version = "1.5.0"
|
version = "1.6.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user