mirror of
https://gitlab.com/scemama/irpf90.git
synced 2024-12-30 16:15:41 +01:00
Merge branch 'master' of ssh://git.code.sf.net/p/irpf90/code
Conflicts: man/man1/irpf90.1.gz
This commit is contained in:
commit
a7bffaffcc
4
Makefile
4
Makefile
@ -1,10 +1,10 @@
|
|||||||
.PHONY: all src man
|
.PHONY: all src man
|
||||||
|
|
||||||
all: src man
|
|
||||||
|
|
||||||
src:
|
src:
|
||||||
$(MAKE) -C $@
|
$(MAKE) -C $@
|
||||||
|
|
||||||
man:
|
man:
|
||||||
- $(MAKE) -C $@
|
- $(MAKE) -C $@
|
||||||
|
|
||||||
|
all: src man
|
||||||
|
|
||||||
|
5
README
5
README
@ -7,7 +7,7 @@ Dependencies
|
|||||||
|
|
||||||
- GNU make (>= 3.81 recommended)
|
- GNU make (>= 3.81 recommended)
|
||||||
- Python > 2.3
|
- Python > 2.3
|
||||||
- Any Fortran 90 compiler (Intel recommended, for example)
|
- Any Fortran 90 compiler (Intel recommended)
|
||||||
|
|
||||||
Installing IRPF90
|
Installing IRPF90
|
||||||
-----------------
|
-----------------
|
||||||
@ -21,6 +21,7 @@ ${IRPF90_HOME} is the location of your irpf90 directory::
|
|||||||
export PATH=${IRPF90_HOME}/bin:${PATH}
|
export PATH=${IRPF90_HOME}/bin:${PATH}
|
||||||
export MANPATH=${IRPF90_HOME}/man:${MANPATH}
|
export MANPATH=${IRPF90_HOME}/man:${MANPATH}
|
||||||
EOF
|
EOF
|
||||||
|
. ${HOME}/.bash_profile
|
||||||
|
|
||||||
|
|
||||||
Using IRPF90
|
Using IRPF90
|
||||||
@ -43,6 +44,6 @@ Author
|
|||||||
------
|
------
|
||||||
|
|
||||||
| Anthony Scemama, LCPQ-IRSAMC, CNRS-Universite Paul Sabatier
|
| Anthony Scemama, LCPQ-IRSAMC, CNRS-Universite Paul Sabatier
|
||||||
| scemama@irsamc.ups-tlse.fr
|
| <scemama@irsamc.ups-tlse.fr>
|
||||||
| http://scemama.mooo.com
|
| http://scemama.mooo.com
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
../src/irpf90.exe
|
../src/irpf90_python.exe
|
Binary file not shown.
45
src/codelet.py
Normal file
45
src/codelet.py
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
from command_line import command_line
|
||||||
|
import irpf90_t
|
||||||
|
|
||||||
|
def run():
|
||||||
|
template = """
|
||||||
|
program codelet_%(name)s
|
||||||
|
implicit none
|
||||||
|
integer :: i
|
||||||
|
double precision :: ticks_0, ticks_1, cpu_0, cpu_1
|
||||||
|
integer, parameter :: irp_imax = %(NMAX)d
|
||||||
|
|
||||||
|
%(precondition)s
|
||||||
|
|
||||||
|
call provide_%(name)s
|
||||||
|
|
||||||
|
double precision :: irp_rdtsc
|
||||||
|
|
||||||
|
call cpu_time(cpu_0)
|
||||||
|
ticks_0 = irp_rdtsc()
|
||||||
|
do i=1,irp_imax
|
||||||
|
call bld_%(name)s
|
||||||
|
enddo
|
||||||
|
ticks_1 = irp_rdtsc()
|
||||||
|
call cpu_time(cpu_1)
|
||||||
|
print *, '%(name)s'
|
||||||
|
print *, '-----------'
|
||||||
|
print *, 'Cycles:'
|
||||||
|
print *, (ticks_1-ticks_0)/dble(irp_imax)
|
||||||
|
print *, 'Seconds:'
|
||||||
|
print *, (cpu_1-cpu_0)/dble(irp_imax)
|
||||||
|
end
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
name, NMAX, precondition, filename = command_line.codelet
|
||||||
|
if precondition is None:
|
||||||
|
precondition = ""
|
||||||
|
else:
|
||||||
|
precondition = "PROVIDE "+precondition
|
||||||
|
file = open(filename,'w')
|
||||||
|
file.write(template%locals())
|
||||||
|
file.close()
|
||||||
|
|
||||||
|
|
@ -49,6 +49,7 @@ options['r'] = [ 'no_directives', 'Ignore all compiler directives !DEC$ and !DIR
|
|||||||
options['n'] = [ 'inline' , 'all|providers|builders : Force inlining of providers or builders', 1 ]
|
options['n'] = [ 'inline' , 'all|providers|builders : Force inlining of providers or builders', 1 ]
|
||||||
options['u'] = [ 'unused' , 'Print unused providers', 0 ]
|
options['u'] = [ 'unused' , 'Print unused providers', 0 ]
|
||||||
options['I'] = [ 'include' , 'Include directory', 1 ]
|
options['I'] = [ 'include' , 'Include directory', 1 ]
|
||||||
|
options['c'] = [ 'codelet' , 'entity:NMAX or entity:precondition:NMAX : Generate a codelet to profile a provider running NMAX times', 1 ]
|
||||||
|
|
||||||
class CommandLine(object):
|
class CommandLine(object):
|
||||||
|
|
||||||
@ -73,6 +74,8 @@ class CommandLine(object):
|
|||||||
self._include_dir = []
|
self._include_dir = []
|
||||||
for o,a in self.opts:
|
for o,a in self.opts:
|
||||||
if o in [ "-I", '--'+options['I'][0] ]:
|
if o in [ "-I", '--'+options['I'][0] ]:
|
||||||
|
if len(a) < 1:
|
||||||
|
print "Error: -I option needs a directory"
|
||||||
if a[-1] != '/':
|
if a[-1] != '/':
|
||||||
a = a+'/'
|
a = a+'/'
|
||||||
self._include_dir.append(a)
|
self._include_dir.append(a)
|
||||||
@ -100,6 +103,28 @@ class CommandLine(object):
|
|||||||
return self._substituted
|
return self._substituted
|
||||||
substituted = property(fget=substituted)
|
substituted = property(fget=substituted)
|
||||||
|
|
||||||
|
def codelet(self):
|
||||||
|
if '_codelet' not in self.__dict__:
|
||||||
|
self._codelet = []
|
||||||
|
for o,a in self.opts:
|
||||||
|
if o in [ "-c", '--'+options['c'][0] ]:
|
||||||
|
buffer = a.split(':')
|
||||||
|
filename = 'codelet_'+buffer[0]+'.irp.f'
|
||||||
|
if len(buffer) == 2:
|
||||||
|
self._codelet = [buffer[0], int(buffer[1]), None, filename]
|
||||||
|
elif len(buffer) == 3:
|
||||||
|
self._codelet = [buffer[0], int(buffer[2]), buffer[1], filename]
|
||||||
|
else:
|
||||||
|
print """
|
||||||
|
Error in codelet definition. Use:
|
||||||
|
--codelet=provider:NMAX
|
||||||
|
or
|
||||||
|
--codelet=provider:precondition:NMAX
|
||||||
|
"""
|
||||||
|
sys.exit(1)
|
||||||
|
return self._codelet
|
||||||
|
codelet = property(fget=codelet)
|
||||||
|
|
||||||
def preprocessed(self):
|
def preprocessed(self):
|
||||||
if '_preprocessed' not in self.__dict__:
|
if '_preprocessed' not in self.__dict__:
|
||||||
self._preprocessed = []
|
self._preprocessed = []
|
||||||
|
@ -64,9 +64,14 @@ def init():
|
|||||||
|
|
||||||
# Copy current files in the irpdir
|
# Copy current files in the irpdir
|
||||||
for dir in ['./']+command_line.include_dir:
|
for dir in ['./']+command_line.include_dir:
|
||||||
|
try:
|
||||||
|
os.stat(dir)
|
||||||
|
except:
|
||||||
|
print dir,'not in dir'
|
||||||
|
continue
|
||||||
for filename in os.listdir(dir):
|
for filename in os.listdir(dir):
|
||||||
filename = dir+filename
|
filename = dir+filename
|
||||||
if not filename[0].startswith(".") and not os.path.isdir(filename):
|
if not filename.startswith(".") and not os.path.isdir(filename):
|
||||||
try:
|
try:
|
||||||
file = open(filename,"r")
|
file = open(filename,"r")
|
||||||
except IOError:
|
except IOError:
|
||||||
|
@ -35,8 +35,9 @@ except:
|
|||||||
pass
|
pass
|
||||||
sys.setcheckinterval(1000)
|
sys.setcheckinterval(1000)
|
||||||
|
|
||||||
|
from command_line import command_line
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
from command_line import command_line
|
|
||||||
|
|
||||||
vim.install()
|
vim.install()
|
||||||
|
|
||||||
@ -72,9 +73,14 @@ def main():
|
|||||||
for x in parents:
|
for x in parents:
|
||||||
print "- %s"%(x,)
|
print "- %s"%(x,)
|
||||||
|
|
||||||
if not command_line.do_run:
|
if command_line.do_codelet:
|
||||||
return
|
import profile
|
||||||
|
profile.build_rdtsc()
|
||||||
|
import codelet
|
||||||
|
codelet.run()
|
||||||
|
|
||||||
|
if not command_line.do_run:
|
||||||
|
return
|
||||||
|
|
||||||
init()
|
init()
|
||||||
|
|
||||||
@ -102,3 +108,4 @@ def main():
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
@ -350,7 +350,13 @@ def create_irpf90_files():
|
|||||||
return filename.endswith(".irp.f") and not filename.startswith('.')
|
return filename.endswith(".irp.f") and not filename.startswith('.')
|
||||||
result = filter ( is_irpf90_file, os.listdir(os.getcwd()) )
|
result = filter ( is_irpf90_file, os.listdir(os.getcwd()) )
|
||||||
for dir in command_line.include_dir:
|
for dir in command_line.include_dir:
|
||||||
result += map(lambda x: dir+x, filter ( is_irpf90_file, os.listdir(dir) ) )
|
try:
|
||||||
|
os.stat(dir)
|
||||||
|
result += map(lambda x: dir+x, filter ( is_irpf90_file, os.listdir(dir) ) )
|
||||||
|
except:
|
||||||
|
continue
|
||||||
|
if command_line.do_codelet:
|
||||||
|
result += [command_line.codelet[3]]
|
||||||
return result
|
return result
|
||||||
irpf90_files = create_irpf90_files()
|
irpf90_files = create_irpf90_files()
|
||||||
|
|
||||||
|
@ -61,8 +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.values():
|
for m in modules.values():
|
||||||
mod.append(m)
|
mod.append(m)
|
||||||
@ -94,6 +93,8 @@ def run():
|
|||||||
print >>file, "OBJ1 = $(OBJ) %sirp_touches.irp.o"%(irpdir),
|
print >>file, "OBJ1 = $(OBJ) %sirp_touches.irp.o"%(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:
|
||||||
|
print >>file, " irp_rdtsc.o",
|
||||||
if command_line.do_openmp:
|
if command_line.do_openmp:
|
||||||
print >>file, " %sirp_locks.irp.o"%(irpdir),
|
print >>file, " %sirp_locks.irp.o"%(irpdir),
|
||||||
else:
|
else:
|
||||||
@ -191,4 +192,3 @@ 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)
|
|
||||||
|
@ -47,7 +47,7 @@ class Fmodule(object):
|
|||||||
def __init__(self,text,filename):
|
def __init__(self,text,filename):
|
||||||
self.text = put_info(text,filename)
|
self.text = put_info(text,filename)
|
||||||
self.filename = filename[:-6]
|
self.filename = filename[:-6]
|
||||||
self.name = "%s_mod"%(self.filename).replace('/','__')
|
self.name = "%s_mod"%(self.filename).replace('/','__').replace('.','Dot')
|
||||||
|
|
||||||
def is_main(self):
|
def is_main(self):
|
||||||
if '_is_main' not in self.__dict__:
|
if '_is_main' not in self.__dict__:
|
||||||
|
@ -788,6 +788,7 @@ def check_begin_end(text):
|
|||||||
error.fail(text[begin],"Missing 'end%s'"%(x,))
|
error.fail(text[begin],"Missing 'end%s'"%(x,))
|
||||||
|
|
||||||
def find_matching_end_subfunpro(begin,x):
|
def find_matching_end_subfunpro(begin,x):
|
||||||
|
line = text[begin]
|
||||||
for i in range(begin+1,len(text)):
|
for i in range(begin+1,len(text)):
|
||||||
line = text[i]
|
line = text[i]
|
||||||
if type(line) == x:
|
if type(line) == x:
|
||||||
|
@ -20,7 +20,6 @@ import subprocess
|
|||||||
import tempfile
|
import tempfile
|
||||||
import os
|
import os
|
||||||
import threading
|
import threading
|
||||||
from variables import variables
|
|
||||||
|
|
||||||
def build_rdtsc():
|
def build_rdtsc():
|
||||||
file,filename = tempfile.mkstemp()
|
file,filename = tempfile.mkstemp()
|
||||||
@ -36,6 +35,7 @@ def build_rdtsc():
|
|||||||
threading.Thread(target=t).start()
|
threading.Thread(target=t).start()
|
||||||
|
|
||||||
def build_module():
|
def build_module():
|
||||||
|
from variables import variables
|
||||||
data = """
|
data = """
|
||||||
module irp_timer
|
module irp_timer
|
||||||
double precision :: irp_profile(3,%(n)d)
|
double precision :: irp_profile(3,%(n)d)
|
||||||
|
@ -1 +1 @@
|
|||||||
version = "1.3.1"
|
version = "1.3.3"
|
||||||
|
Loading…
Reference in New Issue
Block a user