10
0
mirror of https://gitlab.com/scemama/irpf90.git synced 2024-11-08 15:13:42 +01:00

Added irp_rdtsc to ninja

This commit is contained in:
Anthony Scemama 2015-12-02 16:20:50 +01:00
parent 3729312876
commit f68f16fcc3
2 changed files with 12 additions and 13 deletions

View File

@ -369,8 +369,8 @@ def run():
l_common_s += [ "irp_locks.irp.F90" ]
if command_line.do_profile:
l_common_o += [ "irp_profile.irp.o", "rdtsc.o" ]
l_common_s += [ "irp_profile.irp.F90", "rdtsc.c" ]
l_common_o += [ "irp_profile.irp.o", "irp_rdtsc.o" ]
l_common_s += [ "irp_profile.irp.F90", "irp_rdtsc.c" ]
l_common_o = map(dress,l_common_o) + map(lambda x: dress(x,in_root=True), OBJ)
l_common_s = map(dress,l_common_s) + map(lambda x: dress(x,in_root=True), SRC)

View File

@ -45,19 +45,19 @@ import subprocess
import tempfile
import os
import threading
from irpf90_t import irpdir
def build_rdtsc():
file,filename = tempfile.mkstemp()
filename += ".c"
filename = irpdir+"irp_rdtsc.c"
file = open(filename,'w')
file.write(rdtsc)
file.close()
def t():
p = subprocess.Popen(["gcc","-O2",filename,"-c","-o","irp_rdtsc.o"])
p.communicate()
os.remove(filename)
threading.Thread(target=t).start()
# def t():
# p = subprocess.Popen(["gcc","-O2",filename,"-c","-o","irp_rdtsc.o"])
# p.communicate()
# os.remove(filename)
#
# threading.Thread(target=t).start()
def build_module():
from variables import variables
@ -104,11 +104,10 @@ subroutine irp_init_timer
double precision :: irp_rdtsc, t0
irp_profile = 0.d0
irp_rdtsc_shift = 0.d0
do i=1,1000
do i=1,1000000
t0 = irp_rdtsc()
irp_rdtsc_shift = irp_rdtsc_shift + (irp_rdtsc()-t0)
enddo
irp_rdtsc_shift = 1.d-3*irp_rdtsc_shift
irp_rdtsc_shift = 1.d-6*(irp_rdtsc()-t0)
%(text)s
end