mirror of https://github.com/silx-kit/pyFAI.git
Enhancement of the benchmark
This commit is contained in:
parent
f7f72ad84c
commit
bf504af6f0
|
@ -1,31 +1,5 @@
|
|||
PixelSize1: 1.5e-05
|
||||
PixelSize2: 1.5e-05
|
||||
Distance: 0.0868264123853
|
||||
Poni1: 0.0311368265212
|
||||
Poni2: -0.000518106703984
|
||||
Rot1: -0.99381934818
|
||||
Rot2: 0.00712810496134
|
||||
Rot3: -2.9447148132e-06
|
||||
PixelSize1: 1.5e-05
|
||||
PixelSize2: 1.5e-05
|
||||
Distance: 0.0882065396596
|
||||
Poni1: 0.0302286347503
|
||||
Poni2: 0.0449457803015
|
||||
Rot1: -0.506766875792
|
||||
Rot2: 0.0167069809441
|
||||
Rot3: -1.13774685128e-05
|
||||
SplineFile: None
|
||||
PixelSize1: 1.5e-05
|
||||
PixelSize2: 1.5e-05
|
||||
Distance: 0.0882091575037
|
||||
Poni1: 0.030222979528
|
||||
Poni2: 0.0449355243275
|
||||
Rot1: -0.506885423869
|
||||
Rot2: 0.016758534758
|
||||
Rot3: -1.13855975813e-05
|
||||
SplineFile: None
|
||||
PixelSize1: 1.5e-05
|
||||
PixelSize2: 1.5e-05
|
||||
Distance: 0.0882065396596
|
||||
Poni1: 0.0302286347503
|
||||
Poni2: 0.0449457803015
|
||||
|
|
|
@ -1,46 +1,6 @@
|
|||
# Nota: C-Order, 1 refers to the Y axis, 2 to the X axis
|
||||
PixelSize1: 0.000172
|
||||
PixelSize2: 0.000172
|
||||
Distance: 1.57244978939
|
||||
Poni1: 0.00867965669497
|
||||
Poni2: -0.111815479711
|
||||
Rot1: -0.0905190032593
|
||||
Rot2: 0.0232332591893
|
||||
Rot3: -0.00177145091372
|
||||
SplineFile: None
|
||||
# Nota: C-Order, 1 refers to the Y axis, 2 to the X axis
|
||||
PixelSize1: 0.000172
|
||||
PixelSize2: 0.000172
|
||||
Distance: 1.58335615602
|
||||
Poni1: 0.045423415811
|
||||
Poni2: 0.030873975843
|
||||
Rot1: -5.01441303538e-05
|
||||
Rot2: -2.26940287422e-05
|
||||
Rot3: 8.0432729242e-11
|
||||
SplineFile: None
|
||||
# Nota: C-Order, 1 refers to the Y axis, 2 to the X axis
|
||||
PixelSize1: 0.000172
|
||||
PixelSize2: 0.000172
|
||||
Distance: 1.58335263365
|
||||
Poni1: 0.0454330511336
|
||||
Poni2: 0.0308764386575
|
||||
Rot1: -4.85951429731e-05
|
||||
Rot2: -2.87817276971e-05
|
||||
Rot3: 6.47470159625e-09
|
||||
SplineFile: None
|
||||
# Nota: C-Order, 1 refers to the Y axis, 2 to the X axis
|
||||
PixelSize1: 0.000172
|
||||
PixelSize2: 0.000172
|
||||
Distance: 1.58317737936
|
||||
Poni1: 0.0312856378805
|
||||
Poni2: 0.044647392771
|
||||
Rot1: 0.00864672449879
|
||||
Rot2: 0.00890391504745
|
||||
Rot3: -3.40216939338e-09
|
||||
SplineFile: None
|
||||
# Nota: C-Order, 1 refers to the Y axis, 2 to the X axis
|
||||
PixelSize1: 0.000172
|
||||
PixelSize2: 0.000172
|
||||
Distance: 1.58323111834
|
||||
Poni1: 0.0334170169115
|
||||
Poni2: 0.0412277798782
|
||||
|
|
|
@ -1,18 +1,37 @@
|
|||
#!/usr/bin/python
|
||||
import fabio, pyFAI, sys, time, timeit
|
||||
import fabio, sys, time, timeit
|
||||
from os.path import abspath, join, abspath, dirname
|
||||
|
||||
datasets = {"Fairchild.poni":"Fairchild.edf",
|
||||
"halfccd.poni":"halfccd.edf",
|
||||
"Frelon2k.poni":"Frelon2k.edf",
|
||||
"Pilatus6M.poni":"Pilatus6M.cbf",
|
||||
"Pilatus1M.poni":"Pilatus1M.edf"
|
||||
sys.path.append(join(dirname(dirname(abspath(__file__))), "test"))
|
||||
import utilstest
|
||||
pyFAI = utilstest.UtilsTest.pyFAI
|
||||
|
||||
datasets = {"Fairchild.poni":utilstest.UtilsTest.getimage("1880/Fairchild.edf"),
|
||||
"halfccd.poni":utilstest.UtilsTest.getimage("1882/halfccd.edf"),
|
||||
"Frelon2k.poni":utilstest.UtilsTest.getimage("1881/Frelon2k.edf"),
|
||||
"Pilatus6M.poni":utilstest.UtilsTest.getimage("1884/Pilatus6M.cbf"),
|
||||
"Pilatus1M.poni":utilstest.UtilsTest.getimage("1883/Pilatus1M.edf"),
|
||||
}
|
||||
|
||||
print pyFAI
|
||||
class Bench(object):
|
||||
|
||||
def get_cpu(self):
|
||||
return [i.split(": ", 1)[1] for i in open("/proc/cpuinfo") if i.startswith("model name")][0].strip()
|
||||
|
||||
|
||||
def print_init(self, t):
|
||||
print(" * Initialization time: %.1f ms" % (1000.*t))
|
||||
|
||||
|
||||
def print_exec(self, t):
|
||||
print(" * Execution time rep : %.1f ms" % (t * 1000))
|
||||
|
||||
|
||||
def print_sep(self):
|
||||
print("*"*80)
|
||||
|
||||
|
||||
def bench_cpu1d(self, n=10):
|
||||
print("Working on processor: %s" % self.get_cpu())
|
||||
for param, fn in datasets.items():
|
||||
|
@ -23,7 +42,7 @@ class Bench(object):
|
|||
t0 = time.time()
|
||||
_ = ai.xrpd(data, N)
|
||||
t1 = time.time()
|
||||
print(" * Initialization time: %.3fs" % (t1 - t0))
|
||||
self.print_init(t1 - t0)
|
||||
setup = """
|
||||
import pyFAI,fabio
|
||||
ai=pyFAI.load("%s")
|
||||
|
@ -32,9 +51,10 @@ N=min(data.shape)
|
|||
out=ai.xrpd(data,N)""" % (param, fn)
|
||||
t = timeit.Timer("ai.xrpd(data,N)", setup)
|
||||
tmin = min([i / n for i in t.repeat(repeat=5, number=n)])
|
||||
print(" * Execution time rep : %.3fs" % (tmin))
|
||||
self.print_exec(tmin)
|
||||
print("")
|
||||
print("*"*80)
|
||||
self.print_sep()
|
||||
|
||||
|
||||
def bench_cpu2d(self, n=10):
|
||||
print("Working on processor: %s" % self.get_cpu())
|
||||
|
@ -46,7 +66,7 @@ out=ai.xrpd(data,N)""" % (param, fn)
|
|||
t0 = time.time()
|
||||
_ = ai.xrpd2(data, N[0], N[1])
|
||||
t1 = time.time()
|
||||
print(" * Initialization time: %.3fs" % (t1 - t0))
|
||||
self.print_init(t1 - t0)
|
||||
setup = """
|
||||
import pyFAI,fabio
|
||||
ai=pyFAI.load("%s")
|
||||
|
@ -54,18 +74,19 @@ data = fabio.open("%s").data
|
|||
out=ai.xrpd2(data,500,360)""" % (param, fn)
|
||||
t = timeit.Timer("ai.xrpd2(data,500,360)", setup)
|
||||
tmin = min([i / n for i in t.repeat(repeat=5, number=n)])
|
||||
print(" * Execution time rep : %.3fs" % (tmin))
|
||||
self.print_exec(tmin)
|
||||
print("")
|
||||
print("*"*80)
|
||||
self.print_sep()
|
||||
|
||||
|
||||
def bench_gpu1d(self, n=10, useFp64=True):
|
||||
print("Working on default GPU: ")
|
||||
print("Working on default GPU, in " + ("64 bits mode" if useFp64 else"32 bits mode"))
|
||||
|
||||
for param, fn in datasets.items():
|
||||
ai = pyFAI.load(param)
|
||||
data = fabio.open(fn).data
|
||||
N = min(data.shape)
|
||||
print("1D integration of %s %.1f Mpixel -> %i bins" % (fn, data.size / 1e6, N))
|
||||
print("1D integration of %s %.1f Mpixel -> %i bins (%s)" % (fn, data.size / 1e6, N, ("64 bits mode" if useFp64 else"32 bits mode")))
|
||||
|
||||
try:
|
||||
t0 = time.time()
|
||||
|
@ -78,7 +99,7 @@ out=ai.xrpd2(data,500,360)""" % (param, fn)
|
|||
ai._ocl.print_devices()
|
||||
|
||||
ai = None
|
||||
print(" * Initialization time: %.3fs" % (t1 - t0))
|
||||
self.print_init(t1 - t0)
|
||||
setup = """
|
||||
import pyFAI,fabio
|
||||
ai=pyFAI.load("%s")
|
||||
|
@ -87,9 +108,9 @@ N=min(data.shape)
|
|||
out=ai.xrpd_OpenCL(data,N,devicetype="gpu", useFp64=%s)""" % (param, fn, useFp64)
|
||||
t = timeit.Timer("ai.xrpd_OpenCL(data,N,safe=False)", setup)
|
||||
tmin = min([i / n for i in t.repeat(repeat=5, number=n)])
|
||||
print(" * Execution time rep : %.3fs" % (tmin))
|
||||
self.print_exec(tmin)
|
||||
print("")
|
||||
print("*"*80)
|
||||
self.print_sep()
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) > 1 and sys.argv[1].isdigit():
|
||||
|
@ -98,8 +119,8 @@ if __name__ == "__main__":
|
|||
n = 1
|
||||
print("Averaging over %i repetitions (best of 5)." % n)
|
||||
b = Bench()
|
||||
b.bench_cpu1d(n)
|
||||
b.bench_cpu2d(n)
|
||||
b.bench_gpu1d(n, True)
|
||||
# b.bench_cpu1d(n)
|
||||
# b.bench_cpu2d(n)
|
||||
# b.bench_gpu1d(n, True)
|
||||
b.bench_gpu1d(n, False)
|
||||
|
||||
|
|
|
@ -0,0 +1,111 @@
|
|||
SPATIAL DISTORTION SPLINE INTERPOLATION COEFFICIENTS
|
||||
|
||||
VALID REGION
|
||||
0.0000000E+00 0.0000000E+00 0.2048000E+04 0.2048000E+04
|
||||
|
||||
GRID SPACING, X-PIXEL SIZE, Y-PIXEL SIZE
|
||||
0.2500000E+04 0.4722438E+02 0.4683152E+02
|
||||
|
||||
X-DISTORTION
|
||||
14 15
|
||||
0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.2246664E+03
|
||||
0.4432536E+03 0.9552079E+03 0.1259764E+04 0.1544394E+04 0.1804408E+04
|
||||
0.2048000E+04 0.2048000E+04 0.2048000E+04 0.2048000E+04
|
||||
0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.2236768E+03
|
||||
0.4762803E+03 0.7684895E+03 0.1026443E+04 0.1292742E+04 0.1538168E+04
|
||||
0.1795113E+04 0.2048000E+04 0.2048000E+04 0.2048000E+04 0.2048000E+04
|
||||
0.1535083E+02 0.1076493E+02 0.6949357E+01 0.1744561E+01-0.2366039E+01
|
||||
-0.7318740E+01-0.1048896E+02-0.1414034E+02-0.1492735E+02-0.1603363E+02
|
||||
-0.1537288E+02 0.1055121E+02 0.8498821E+01 0.5076883E+01 0.1075899E+01
|
||||
-0.3848288E+01-0.8233279E+01-0.1119111E+02-0.1330700E+02-0.1600157E+02
|
||||
-0.1579050E+02-0.1504840E+02 0.5135085E+01 0.4818080E+01 0.1713162E+01
|
||||
-0.2424825E+01-0.6476648E+01-0.1176909E+02-0.1401328E+02-0.1575502E+02
|
||||
-0.1625523E+02-0.1656010E+02-0.1729388E+02 0.2765728E+00-0.2441251E+01
|
||||
-0.5373812E+01-0.8672507E+01-0.1392906E+02-0.1661235E+02-0.1907617E+02
|
||||
-0.1897881E+02-0.1905490E+02-0.1739466E+02-0.1637078E+02-0.8740438E+01
|
||||
-0.9962314E+01-0.9372566E+01-0.1320323E+02-0.1385027E+02-0.1693191E+02
|
||||
-0.1686093E+02-0.1782914E+02-0.1712085E+02-0.1684618E+02-0.1654652E+02
|
||||
-0.1347715E+02-0.1351849E+02-0.1467949E+02-0.1265138E+02-0.1200397E+02
|
||||
-0.1045458E+02-0.1037438E+02-0.1155401E+02-0.1169861E+02-0.1286409E+02
|
||||
-0.1347511E+02-0.1678791E+02-0.1687479E+02-0.1450373E+02-0.1285583E+02
|
||||
-0.9863098E+01-0.6797175E+01-0.5570945E+01-0.4636785E+01-0.7563279E+01
|
||||
-0.7846806E+01-0.9231987E+01-0.1614220E+02-0.1746137E+02-0.1666732E+02
|
||||
-0.1244886E+02-0.8453421E+01-0.3659370E+01-0.1906948E+01-0.5241284E+00
|
||||
-0.2072738E+01-0.3316919E+01-0.4907596E+01-0.1936429E+02-0.1846539E+02
|
||||
-0.1564166E+02-0.1239654E+02-0.7820510E+01-0.3014074E+01 0.1134945E+01
|
||||
0.3394253E+01 0.2581735E+01-0.2083005E+00 0.5007012E+00-0.2047620E+02
|
||||
-0.1978745E+02-0.1568741E+02-0.1417389E+02-0.5996676E+01-0.5171342E+01
|
||||
0.2520380E+01 0.1477036E+01 0.2805888E+01 0.8579645E+00-0.1563653E+00
|
||||
|
||||
Y-DISTORTION
|
||||
23 20
|
||||
0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.1496108E+03
|
||||
0.2721863E+03 0.4178987E+03 0.5381306E+03 0.6858331E+03 0.8162679E+03
|
||||
0.9413753E+03 0.1036221E+04 0.1163577E+04 0.1290432E+04 0.1418143E+04
|
||||
0.1548779E+04 0.1692615E+04 0.1799250E+04 0.1910604E+04 0.2048000E+04
|
||||
0.2048000E+04 0.2048000E+04 0.2048000E+04
|
||||
0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.1964187E+03
|
||||
0.4012936E+03 0.6049906E+03 0.8115546E+03 0.9986447E+03 0.1047219E+04
|
||||
0.1142422E+04 0.1284335E+04 0.1455113E+04 0.1604464E+04 0.1740667E+04
|
||||
0.1882658E+04 0.2048000E+04 0.2048000E+04 0.2048000E+04 0.2048000E+04
|
||||
-0.2716451E+00-0.3955641E+01-0.7666947E+01-0.1686779E+02-0.1467337E+02
|
||||
-0.2432359E+02-0.2249255E+02-0.2259957E+02-0.2271049E+02-0.1228782E+02
|
||||
-0.1383092E+02-0.1087492E+02-0.1042861E+01-0.1363810E+01 0.5757740E+00
|
||||
-0.1263283E+01-0.1949329E+01-0.3543243E+01-0.7619351E+01-0.1650790E+02
|
||||
-0.2028738E+02-0.2089124E+02-0.2119374E+02-0.2030268E+02-0.1796068E+02
|
||||
-0.1951789E+02-0.1411706E+02-0.9309854E+01-0.8405408E+01-0.1035324E+01
|
||||
0.2090590E+01-0.1525929E+01 0.9764974E+00-0.3405032E+01-0.9164116E+01
|
||||
-0.1246337E+02-0.1997486E+02-0.2258389E+02-0.2115727E+02-0.2167421E+02
|
||||
-0.2172004E+02-0.1778706E+02-0.1546574E+02-0.1155363E+02-0.6310937E+01
|
||||
-0.2668082E+01-0.1507349E+01 0.2981390E+01 0.1817601E+01-0.3744610E+00
|
||||
-0.6823599E+01-0.1540060E+02-0.1921754E+02-0.2292349E+02-0.2253362E+02
|
||||
-0.2230992E+02-0.1898765E+02-0.2042705E+02-0.1523873E+02-0.1237613E+02
|
||||
-0.1020463E+02-0.3647907E+01-0.3504143E+01 0.5384005E+01 0.3171129E+01
|
||||
-0.1556188E+01-0.7485898E+01-0.1532609E+02-0.2023733E+02-0.2436352E+02
|
||||
-0.2342232E+02-0.2248796E+02-0.2246512E+02-0.1996547E+02-0.1622370E+02
|
||||
-0.1330054E+02-0.8676906E+01-0.6155024E+01-0.9598348E+00-0.4334534E+01
|
||||
0.1656793E+01-0.2400740E+01-0.6461067E+01-0.1611795E+02-0.2198001E+02
|
||||
-0.2433141E+02-0.2350370E+02-0.2370953E+02-0.2165659E+02-0.1821856E+02
|
||||
-0.1713248E+02-0.1280059E+02-0.1034634E+02-0.5550316E+01-0.4686250E+01
|
||||
-0.2060861E+00-0.8928451E+00 0.2689514E+00-0.1026333E+02-0.1651597E+02
|
||||
-0.2218092E+02-0.2496817E+02-0.2594951E+02-0.2268470E+02-0.2329237E+02
|
||||
-0.2019594E+02-0.1610755E+02-0.1316627E+02-0.8797893E+01-0.7035689E+01
|
||||
-0.3115985E+01-0.2687772E+01 0.2134094E+01-0.3804123E+01-0.7763778E+01
|
||||
-0.1868864E+02-0.2388659E+02-0.2658305E+02-0.2431343E+02-0.2400622E+02
|
||||
-0.2223056E+02-0.1836829E+02-0.1753368E+02-0.1314925E+02-0.9406507E+01
|
||||
-0.5641295E+01-0.2928677E+01-0.6400106E+01 0.9705959E-01-0.2381162E+01
|
||||
-0.1194868E+02-0.1820900E+02-0.2502245E+02-0.2695257E+02-0.2657343E+02
|
||||
-0.2440788E+02-0.2233183E+02-0.2068457E+02-0.1532943E+02-0.1290945E+02
|
||||
-0.9051538E+01-0.6718315E+01-0.3269133E+01-0.2798177E+01 0.4242986E+00
|
||||
-0.4450462E+01-0.1019799E+02-0.2012140E+02-0.2496608E+02-0.2790155E+02
|
||||
-0.2528891E+02-0.2537887E+02-0.2312382E+02-0.1892443E+02-0.1788561E+02
|
||||
-0.1127047E+02-0.9607083E+01-0.5037954E+01-0.1904939E+01-0.5691902E+01
|
||||
-0.1724934E+01-0.3837998E+01-0.1371775E+02-0.1942342E+02-0.2586945E+02
|
||||
-0.2770358E+02-0.2733786E+02-0.2477837E+02-0.2261342E+02-0.2109080E+02
|
||||
-0.1584147E+02-0.1216737E+02-0.9277504E+01-0.4975915E+01-0.6487498E+01
|
||||
0.9042882E+00-0.3891124E+01-0.6618149E+01-0.1036867E+02-0.2094296E+02
|
||||
-0.2661712E+02-0.2821557E+02-0.2660996E+02-0.2488844E+02-0.2318477E+02
|
||||
-0.2099893E+02-0.1494376E+02-0.1341716E+02-0.8414506E+01-0.5516052E+01
|
||||
-0.3585117E+00-0.2587947E+01-0.3393908E+01-0.5587323E+01-0.1464974E+02
|
||||
-0.2056468E+02-0.2678521E+02-0.2780731E+02-0.2705853E+02-0.2483073E+02
|
||||
-0.2270437E+02-0.1990776E+02-0.1713709E+02-0.1143918E+02-0.9034024E+01
|
||||
-0.5959493E+01-0.3626589E+01-0.3565216E+01-0.5774873E+01-0.6693549E+01
|
||||
-0.1387624E+02-0.2153587E+02-0.2557198E+02-0.2794456E+02-0.2612663E+02
|
||||
-0.2537648E+02-0.2437642E+02-0.1923620E+02-0.1648068E+02-0.1166780E+02
|
||||
-0.7550184E+01-0.3979607E+01-0.3600461E+01 0.3170965E+01-0.6253194E+01
|
||||
-0.9451828E+01-0.1494513E+02-0.2148710E+02-0.2740032E+02-0.2864543E+02
|
||||
-0.2697890E+02-0.2450190E+02-0.2303167E+02-0.1843495E+02-0.1770224E+02
|
||||
-0.1102322E+02-0.1055902E+02-0.3757998E+01-0.1739585E+01-0.1714017E+01
|
||||
-0.8305224E+01-0.8687256E+01-0.1575142E+02-0.2269292E+02-0.2613925E+02
|
||||
-0.2781220E+02-0.2557445E+02-0.2572113E+02-0.2371160E+02-0.2121587E+02
|
||||
-0.1532737E+02-0.1211156E+02-0.6761419E+01-0.3971738E+01-0.2676099E+01
|
||||
0.2522594E+01-0.6481310E+01-0.1155840E+02-0.1929344E+02-0.2189279E+02
|
||||
-0.2705568E+02-0.2839713E+02-0.2540857E+02-0.2424788E+02-0.2253183E+02
|
||||
-0.1755008E+02-0.1735141E+02-0.1253306E+02-0.7411563E+01-0.1722503E+01
|
||||
-0.2308332E+00 0.1379505E+01-0.1138825E+02-0.1126619E+02-0.1492843E+02
|
||||
-0.2559361E+02-0.2603434E+02-0.2641008E+02-0.2577283E+02-0.2495603E+02
|
||||
-0.2274272E+02-0.1805964E+02-0.1553088E+02-0.9971477E+01-0.7325161E+01
|
||||
-0.4279523E+01-0.3795973E+00 0.2459302E+01-0.5401502E+01-0.1710831E+02
|
||||
-0.2114833E+02-0.2084257E+02-0.2983810E+02-0.2965279E+02-0.2490102E+02
|
||||
-0.2266250E+02-0.2117017E+02-0.2377759E+02-0.9965483E+01-0.1205025E+02
|
||||
-0.4265452E+01 0.2264633E+01-0.1348721E+01 0.6010548E+00
|
|
@ -65,7 +65,10 @@ class UtilsTest(object):
|
|||
p = subprocess.Popen([sys.executable, "setup.py", "build"],
|
||||
shell=False, cwd=os.path.dirname(test_home))
|
||||
logger.info("subprocess ended with rc= %s" % p.wait())
|
||||
|
||||
opencl = os.path.join(os.path.dirname(test_home), "openCL")
|
||||
for clf in os.listdir(opencl):
|
||||
if clf.endswith(".cl") and clf not in os.listdir(os.path.join(pyFAI_home, "pyFAI")):
|
||||
os.link(os.path.join(opencl, clf), os.path.join(pyFAI_home, "pyFAI", clf))
|
||||
pyFAI = imp.load_module(*((name,) + imp.find_module(name, [pyFAI_home])))
|
||||
sys.modules[name] = pyFAI
|
||||
logger.info("pyFAI loaded from %s" % pyFAI.__file__)
|
||||
|
|
Loading…
Reference in New Issue