mirror of
https://gitlab.com/scemama/irpf90.git
synced 2024-12-21 20:03:33 +01:00
Bugs
This commit is contained in:
parent
1bda8f00e0
commit
3f2d536c65
@ -66,10 +66,6 @@ def main():
|
||||
for x in parents:
|
||||
print "- %s"%(x,)
|
||||
|
||||
if command_line.do_profile:
|
||||
import profile
|
||||
profile.run()
|
||||
|
||||
if not command_line.do_run:
|
||||
return
|
||||
|
||||
@ -94,5 +90,9 @@ def main():
|
||||
import create_man
|
||||
create_man.run()
|
||||
|
||||
if command_line.do_profile:
|
||||
import profile
|
||||
profile.run()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
@ -1,18 +1,17 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
rdtsc = """
|
||||
#define uint64_t unsigned long
|
||||
#ifdef __i386
|
||||
uint64_t irp_rdtsc_() {
|
||||
uint64_t x;
|
||||
double irp_rdtsc_(void) {
|
||||
unsigned long long x;
|
||||
__asm__ volatile ("rdtsc" : "=A" (x));
|
||||
return x;
|
||||
return (double) x;
|
||||
}
|
||||
#elif __amd64
|
||||
uint64_t irp_rdtsc_() {
|
||||
uint64_t a, d;
|
||||
double irp_rdtsc_(void) {
|
||||
unsigned long long a, d;
|
||||
__asm__ volatile ("rdtsc" : "=a" (a), "=d" (d));
|
||||
return (d<<32) | a;
|
||||
return (double)((d<<32) | a);
|
||||
}
|
||||
#endif
|
||||
"""
|
||||
@ -20,6 +19,7 @@ uint64_t irp_rdtsc_() {
|
||||
import subprocess
|
||||
import tempfile
|
||||
import os
|
||||
import threading
|
||||
from variables import variables
|
||||
|
||||
def build_rdtsc():
|
||||
@ -28,10 +28,14 @@ def build_rdtsc():
|
||||
file = open(filename,'w')
|
||||
file.write(rdtsc)
|
||||
file.close()
|
||||
p = subprocess.Popen(["gcc","-O3",filename,"-c","-o","IRPF90_temp/irp_rdtsc.o"])
|
||||
def t():
|
||||
p = subprocess.Popen(["gcc","-O2",filename,"-c","-o","IRPF90_temp/irp_rdtsc.o"])
|
||||
|
||||
p.communicate()
|
||||
os.remove(filename)
|
||||
|
||||
threading.Thread(target=t).start()
|
||||
|
||||
def build_module():
|
||||
data = """
|
||||
module irp_timer
|
||||
@ -50,20 +54,23 @@ subroutine irp_set_timer(i,value)
|
||||
use irp_timer
|
||||
implicit none
|
||||
integer, intent(in) :: i
|
||||
integer*8, intent(in) :: value
|
||||
irp_profile(1,i) = dble(value)
|
||||
irp_profile(2,i) = irp_profile(2,i)+1.d0
|
||||
double precision, intent(in) :: value
|
||||
irp_profile(1,i) = irp_profile(1,i) + value
|
||||
irp_profile(2,i) = irp_profile(2,i) + 1.d0
|
||||
end
|
||||
|
||||
subroutine irp_print_timer()
|
||||
use irp_timer
|
||||
implicit none
|
||||
integer :: i
|
||||
print '(16X,5(2X,A16))', 'Num Calls', 'Tot Cycles', 'Avge Cycles', &
|
||||
print '(A24,A8,4(X,A14))', 'Calls', 'Tot Cycles', 'Avge Cycles', &
|
||||
'Tot Secs(1GHz)', 'Avge Secs(1GHz)'
|
||||
print '(A)', '----------------------------------------------'// &
|
||||
'----------------------------------------------'
|
||||
do i=1,%(n)d
|
||||
if (irp_profile(2,i) > 0.) then
|
||||
print '(A16,5(2X,F16.4))', irp_profile_label(i), irp_profile(2,i), &
|
||||
print '(A24,F8.0,2(X,F14.0),2(X,F14.8))', &
|
||||
irp_profile_label(i), irp_profile(2,i), &
|
||||
irp_profile(1,i), irp_profile(1,i)/irp_profile(2,i), &
|
||||
irp_profile(1,i)*1.d-9, 1.d-9*irp_profile(1,i)/irp_profile(2,i)
|
||||
endif
|
||||
@ -75,11 +82,13 @@ end
|
||||
vi = variables[i]
|
||||
label[vi.label] = vi.name
|
||||
text = []
|
||||
lmax = 0
|
||||
for l in label:
|
||||
text.append(" irp_profile_label(%d) = '%s'"%(l,label[l]))
|
||||
lmax = max(lmax,l)
|
||||
text.sort()
|
||||
text = '\n'.join(text)
|
||||
data = data%{'text': text, 'n':len(label.keys())}
|
||||
data = data%{'text': text, 'n':lmax}
|
||||
file = open("IRPF90_temp/irp_profile.irp.F90",'w')
|
||||
file.write(data)
|
||||
file.close()
|
||||
|
@ -558,7 +558,7 @@ class Variable(object):
|
||||
text.append( (vars,line) )
|
||||
text += map( lambda x: ([],Simple_line(line.i,x,line.filename)), call_provides(vars) )
|
||||
if command_line.do_profile and type(line) == Begin_provider:
|
||||
text.append( ( [], Declaration(line.i," integer*8 :: irp_rdtsc, irp_rdtsc1, irp_rdtsc2",line.filename) ) )
|
||||
text.append( ( [], Declaration(line.i," double precision :: irp_rdtsc, irp_rdtsc1, irp_rdtsc2",line.filename) ) )
|
||||
text.append( ( [], Simple_line(line.i," irp_rdtsc1 = irp_rdtsc()",line.filename) ) )
|
||||
if type(line) == End_provider:
|
||||
if inside:
|
||||
|
Loading…
Reference in New Issue
Block a user