Skip to content

Commit 42a4907

Browse files
committed
Changed test_store_output_file to use real cachefile, added timestamps to cachefile, simplified imports in test_runners
1 parent 8a059aa commit 42a4907

File tree

3 files changed

+331
-58
lines changed

3 files changed

+331
-58
lines changed

test/test_cache_file.json

Lines changed: 312 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,313 @@
11
{
2-
"device_name": "NVIDIA RTX A4000",
3-
"kernel_name": "vector_add",
4-
"tune_params_keys": [
5-
"block_size_x"
6-
],
7-
"tune_params": {
8-
"block_size_x": [
9-
128,
10-
192,
11-
256,
12-
320,
13-
384,
14-
448,
15-
512,
16-
576,
17-
640,
18-
704,
19-
768,
20-
832,
21-
896,
22-
960,
23-
1024
24-
]
25-
},
26-
"cache": {
27-
"128": {"block_size_x": 128, "time": 0.04073600071881499, "times": [0.1268800050020218, 0.031072000041604042, 0.027295999228954315, 0.025472000241279602, 0.025119999423623085, 0.025248000398278236, 0.024064000695943832], "compile_time": 440.9545585513115, "verification_time": 0, "benchmark_time": 1.091592013835907, "strategy_time": 0, "framework_time": 0.8587837219238281},
28-
"192": {"block_size_x": 192, "time": 0.04095085710287094, "times": [0.12908799946308136, 0.03046399913728237, 0.027744000777602196, 0.025151999667286873, 0.024960000067949295, 0.024992000311613083, 0.02425600029528141], "compile_time": 436.15153804421425, "verification_time": 0, "benchmark_time": 1.0972395539283752, "strategy_time": 0, "framework_time": 1.6656816005706787},
29-
"256": {"block_size_x": 256, "time": 0.04189257137477398, "times": [0.13180799782276154, 0.031136000528931618, 0.028095999732613564, 0.027008000761270523, 0.025087999179959297, 0.02505600079894066, 0.02505600079894066], "compile_time": 436.5839697420597, "verification_time": 0, "benchmark_time": 1.0691732168197632, "strategy_time": 0, "framework_time": 1.6054585576057434},
30-
"320": {"block_size_x": 320, "time": 0.04208914376795292, "times": [0.1358720064163208, 0.030688000842928886, 0.02768000029027462, 0.02582399919629097, 0.025087999179959297, 0.025312000885605812, 0.024159999564290047], "compile_time": 438.9761835336685, "verification_time": 0, "benchmark_time": 1.0976120829582214, "strategy_time": 0, "framework_time": 1.4494173228740692},
31-
"384": {"block_size_x": 384, "time": 0.04174171467976911, "times": [0.13251200318336487, 0.03167999908328056, 0.027871999889612198, 0.025312000885605812, 0.024671999737620354, 0.02505600079894066, 0.025087999179959297], "compile_time": 440.71199372410774, "verification_time": 0, "benchmark_time": 1.0499358177185059, "strategy_time": 0, "framework_time": 1.682564616203308},
32-
"448": {"block_size_x": 448, "time": 0.03249828570655414, "times": [0.0647680014371872, 0.03167999908328056, 0.028255999088287354, 0.025280000641942024, 0.027103999629616737, 0.02550400048494339, 0.02489599958062172], "compile_time": 449.13655519485474, "verification_time": 0, "benchmark_time": 1.1196956038475037, "strategy_time": 0, "framework_time": 1.5890561044216156},
33-
"512": {"block_size_x": 512, "time": 0.04139885599059718, "times": [0.13023999333381653, 0.031136000528931618, 0.02831999957561493, 0.02595200017094612, 0.024607999250292778, 0.025151999667286873, 0.024383999407291412], "compile_time": 440.5844733119011, "verification_time": 0, "benchmark_time": 1.09076127409935, "strategy_time": 0, "framework_time": 1.853298395872116},
34-
"576": {"block_size_x": 576, "time": 0.04189257137477398, "times": [0.12995199859142303, 0.03200000151991844, 0.028511999174952507, 0.026623999699950218, 0.025760000571608543, 0.02537599951028824, 0.02502400055527687], "compile_time": 442.16764718294144, "verification_time": 0, "benchmark_time": 1.1038780212402344, "strategy_time": 0, "framework_time": 1.8403716385364532},
35-
"640": {"block_size_x": 640, "time": 0.0411702852163996, "times": [0.12796799838542938, 0.03081599995493889, 0.02969600073993206, 0.025439999997615814, 0.02409599907696247, 0.02582399919629097, 0.024351999163627625], "compile_time": 437.98910081386566, "verification_time": 0, "benchmark_time": 1.0496266186237335, "strategy_time": 0, "framework_time": 1.8264725804328918},
36-
"704": {"block_size_x": 704, "time": 0.04184228580977235, "times": [0.1343040019273758, 0.03094400092959404, 0.02908799983561039, 0.025151999667286873, 0.02486399933695793, 0.024447999894618988, 0.02409599907696247], "compile_time": 443.51235404610634, "verification_time": 0, "benchmark_time": 1.1033527553081512, "strategy_time": 0, "framework_time": 1.6709677875041962},
37-
"768": {"block_size_x": 768, "time": 0.03175771422684193, "times": [0.06230400130152702, 0.0315839983522892, 0.02831999957561493, 0.02672000043094158, 0.023679999634623528, 0.023903999477624893, 0.02579200081527233], "compile_time": 450.4409395158291, "verification_time": 0, "benchmark_time": 1.101326197385788, "strategy_time": 0, "framework_time": 1.7531625926494598},
38-
"832": {"block_size_x": 832, "time": 0.040941715240478516, "times": [0.12998400628566742, 0.03094400092959404, 0.027103999629616737, 0.024768000468611717, 0.025439999997615814, 0.023903999477624893, 0.024447999894618988], "compile_time": 439.9200603365898, "verification_time": 0, "benchmark_time": 1.0421127080917358, "strategy_time": 0, "framework_time": 2.1368376910686493},
39-
"896": {"block_size_x": 896, "time": 0.04177371359297207, "times": [0.12931199371814728, 0.03731200098991394, 0.02812799997627735, 0.02502400055527687, 0.02412799932062626, 0.024768000468611717, 0.023744000121951103], "compile_time": 439.23527002334595, "verification_time": 0, "benchmark_time": 1.0946877300739288, "strategy_time": 0, "framework_time": 2.03637033700943},
40-
"960": {"block_size_x": 960, "time": 0.042189714631864, "times": [0.1335040032863617, 0.031039999797940254, 0.02876799926161766, 0.02579200081527233, 0.025119999423623085, 0.02566399984061718, 0.025439999997615814], "compile_time": 441.7596235871315, "verification_time": 0, "benchmark_time": 1.1166557669639587, "strategy_time": 0, "framework_time": 1.7383433878421783},
41-
"1024": {"block_size_x": 1024, "time": 0.04114742816558906, "times": [0.13087999820709229, 0.03049599938094616, 0.027936000376939774, 0.02486399933695793, 0.0244159996509552, 0.024320000782608986, 0.025119999423623085], "compile_time": 442.8337663412094, "verification_time": 0, "benchmark_time": 1.0683201253414154, "strategy_time": 0, "framework_time": 1.9918642938137054}}
42-
}
2+
"device_name": "NVIDIA RTX A4000",
3+
"kernel_name": "vector_add",
4+
"tune_params_keys": [
5+
"block_size_x"
6+
],
7+
"tune_params": {
8+
"block_size_x": [
9+
128,
10+
192,
11+
256,
12+
320,
13+
384,
14+
448,
15+
512,
16+
576,
17+
640,
18+
704,
19+
768,
20+
832,
21+
896,
22+
960,
23+
1024
24+
]
25+
},
26+
"cache": {
27+
"128": {
28+
"block_size_x": 128,
29+
"time": 0.04073600071881499,
30+
"times": [
31+
0.1268800050020218,
32+
0.031072000041604042,
33+
0.027295999228954315,
34+
0.025472000241279602,
35+
0.025119999423623085,
36+
0.025248000398278236,
37+
0.024064000695943832
38+
],
39+
"compile_time": 440.9545585513115,
40+
"verification_time": 0,
41+
"benchmark_time": 1.091592013835907,
42+
"strategy_time": 0,
43+
"framework_time": 0.8587837219238281,
44+
"timestamp": "2022-12-23 12:11:26.411558+00:00"
45+
},
46+
"192": {
47+
"block_size_x": 192,
48+
"time": 0.04095085710287094,
49+
"times": [
50+
0.12908799946308136,
51+
0.03046399913728237,
52+
0.027744000777602196,
53+
0.025151999667286873,
54+
0.024960000067949295,
55+
0.024992000311613083,
56+
0.02425600029528141
57+
],
58+
"compile_time": 436.15153804421425,
59+
"verification_time": 0,
60+
"benchmark_time": 1.0972395539283752,
61+
"strategy_time": 0,
62+
"framework_time": 1.6656816005706787,
63+
"timestamp": "2022-12-23 12:11:26.411558+00:00"
64+
},
65+
"256": {
66+
"block_size_x": 256,
67+
"time": 0.04189257137477398,
68+
"times": [
69+
0.13180799782276154,
70+
0.031136000528931618,
71+
0.028095999732613564,
72+
0.027008000761270523,
73+
0.025087999179959297,
74+
0.02505600079894066,
75+
0.02505600079894066
76+
],
77+
"compile_time": 436.5839697420597,
78+
"verification_time": 0,
79+
"benchmark_time": 1.0691732168197632,
80+
"strategy_time": 0,
81+
"framework_time": 1.6054585576057434,
82+
"timestamp": "2022-12-23 12:11:26.411558+00:00"
83+
},
84+
"320": {
85+
"block_size_x": 320,
86+
"time": 0.04208914376795292,
87+
"times": [
88+
0.1358720064163208,
89+
0.030688000842928886,
90+
0.02768000029027462,
91+
0.02582399919629097,
92+
0.025087999179959297,
93+
0.025312000885605812,
94+
0.024159999564290047
95+
],
96+
"compile_time": 438.9761835336685,
97+
"verification_time": 0,
98+
"benchmark_time": 1.0976120829582214,
99+
"strategy_time": 0,
100+
"framework_time": 1.4494173228740692,
101+
"timestamp": "2022-12-23 12:11:26.411558+00:00"
102+
},
103+
"384": {
104+
"block_size_x": 384,
105+
"time": 0.04174171467976911,
106+
"times": [
107+
0.13251200318336487,
108+
0.03167999908328056,
109+
0.027871999889612198,
110+
0.025312000885605812,
111+
0.024671999737620354,
112+
0.02505600079894066,
113+
0.025087999179959297
114+
],
115+
"compile_time": 440.71199372410774,
116+
"verification_time": 0,
117+
"benchmark_time": 1.0499358177185059,
118+
"strategy_time": 0,
119+
"framework_time": 1.682564616203308,
120+
"timestamp": "2022-12-23 12:11:26.411558+00:00"
121+
},
122+
"448": {
123+
"block_size_x": 448,
124+
"time": 0.03249828570655414,
125+
"times": [
126+
0.0647680014371872,
127+
0.03167999908328056,
128+
0.028255999088287354,
129+
0.025280000641942024,
130+
0.027103999629616737,
131+
0.02550400048494339,
132+
0.02489599958062172
133+
],
134+
"compile_time": 449.13655519485474,
135+
"verification_time": 0,
136+
"benchmark_time": 1.1196956038475037,
137+
"strategy_time": 0,
138+
"framework_time": 1.5890561044216156,
139+
"timestamp": "2022-12-23 12:11:26.411558+00:00"
140+
},
141+
"512": {
142+
"block_size_x": 512,
143+
"time": 0.04139885599059718,
144+
"times": [
145+
0.13023999333381653,
146+
0.031136000528931618,
147+
0.02831999957561493,
148+
0.02595200017094612,
149+
0.024607999250292778,
150+
0.025151999667286873,
151+
0.024383999407291412
152+
],
153+
"compile_time": 440.5844733119011,
154+
"verification_time": 0,
155+
"benchmark_time": 1.09076127409935,
156+
"strategy_time": 0,
157+
"framework_time": 1.853298395872116,
158+
"timestamp": "2022-12-23 12:11:26.411558+00:00"
159+
},
160+
"576": {
161+
"block_size_x": 576,
162+
"time": 0.04189257137477398,
163+
"times": [
164+
0.12995199859142303,
165+
0.03200000151991844,
166+
0.028511999174952507,
167+
0.026623999699950218,
168+
0.025760000571608543,
169+
0.02537599951028824,
170+
0.02502400055527687
171+
],
172+
"compile_time": 442.16764718294144,
173+
"verification_time": 0,
174+
"benchmark_time": 1.1038780212402344,
175+
"strategy_time": 0,
176+
"framework_time": 1.8403716385364532,
177+
"timestamp": "2022-12-23 12:11:26.411558+00:00"
178+
},
179+
"640": {
180+
"block_size_x": 640,
181+
"time": 0.0411702852163996,
182+
"times": [
183+
0.12796799838542938,
184+
0.03081599995493889,
185+
0.02969600073993206,
186+
0.025439999997615814,
187+
0.02409599907696247,
188+
0.02582399919629097,
189+
0.024351999163627625
190+
],
191+
"compile_time": 437.98910081386566,
192+
"verification_time": 0,
193+
"benchmark_time": 1.0496266186237335,
194+
"strategy_time": 0,
195+
"framework_time": 1.8264725804328918,
196+
"timestamp": "2022-12-23 12:11:26.411558+00:00"
197+
},
198+
"704": {
199+
"block_size_x": 704,
200+
"time": 0.04184228580977235,
201+
"times": [
202+
0.1343040019273758,
203+
0.03094400092959404,
204+
0.02908799983561039,
205+
0.025151999667286873,
206+
0.02486399933695793,
207+
0.024447999894618988,
208+
0.02409599907696247
209+
],
210+
"compile_time": 443.51235404610634,
211+
"verification_time": 0,
212+
"benchmark_time": 1.1033527553081512,
213+
"strategy_time": 0,
214+
"framework_time": 1.6709677875041962,
215+
"timestamp": "2022-12-23 12:11:26.411558+00:00"
216+
},
217+
"768": {
218+
"block_size_x": 768,
219+
"time": 0.03175771422684193,
220+
"times": [
221+
0.06230400130152702,
222+
0.0315839983522892,
223+
0.02831999957561493,
224+
0.02672000043094158,
225+
0.023679999634623528,
226+
0.023903999477624893,
227+
0.02579200081527233
228+
],
229+
"compile_time": 450.4409395158291,
230+
"verification_time": 0,
231+
"benchmark_time": 1.101326197385788,
232+
"strategy_time": 0,
233+
"framework_time": 1.7531625926494598,
234+
"timestamp": "2022-12-23 12:11:26.411558+00:00"
235+
},
236+
"832": {
237+
"block_size_x": 832,
238+
"time": 0.040941715240478516,
239+
"times": [
240+
0.12998400628566742,
241+
0.03094400092959404,
242+
0.027103999629616737,
243+
0.024768000468611717,
244+
0.025439999997615814,
245+
0.023903999477624893,
246+
0.024447999894618988
247+
],
248+
"compile_time": 439.9200603365898,
249+
"verification_time": 0,
250+
"benchmark_time": 1.0421127080917358,
251+
"strategy_time": 0,
252+
"framework_time": 2.1368376910686493,
253+
"timestamp": "2022-12-23 12:11:26.411558+00:00"
254+
},
255+
"896": {
256+
"block_size_x": 896,
257+
"time": 0.04177371359297207,
258+
"times": [
259+
0.12931199371814728,
260+
0.03731200098991394,
261+
0.02812799997627735,
262+
0.02502400055527687,
263+
0.02412799932062626,
264+
0.024768000468611717,
265+
0.023744000121951103
266+
],
267+
"compile_time": 439.23527002334595,
268+
"verification_time": 0,
269+
"benchmark_time": 1.0946877300739288,
270+
"strategy_time": 0,
271+
"framework_time": 2.03637033700943,
272+
"timestamp": "2022-12-23 12:11:26.411558+00:00"
273+
},
274+
"960": {
275+
"block_size_x": 960,
276+
"time": 0.042189714631864,
277+
"times": [
278+
0.1335040032863617,
279+
0.031039999797940254,
280+
0.02876799926161766,
281+
0.02579200081527233,
282+
0.025119999423623085,
283+
0.02566399984061718,
284+
0.025439999997615814
285+
],
286+
"compile_time": 441.7596235871315,
287+
"verification_time": 0,
288+
"benchmark_time": 1.1166557669639587,
289+
"strategy_time": 0,
290+
"framework_time": 1.7383433878421783,
291+
"timestamp": "2022-12-23 12:11:26.411558+00:00"
292+
},
293+
"1024": {
294+
"block_size_x": 1024,
295+
"time": 0.04114742816558906,
296+
"times": [
297+
0.13087999820709229,
298+
0.03049599938094616,
299+
0.027936000376939774,
300+
0.02486399933695793,
301+
0.0244159996509552,
302+
0.024320000782608986,
303+
0.025119999423623085
304+
],
305+
"compile_time": 442.8337663412094,
306+
"verification_time": 0,
307+
"benchmark_time": 1.0683201253414154,
308+
"strategy_time": 0,
309+
"framework_time": 1.9918642938137054,
310+
"timestamp": "2022-12-23 12:11:26.411558+00:00"
311+
}
312+
}
313+
}

test/test_file_utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
from kernel_tuner.file_utils import store_output_file, store_metadata_file, output_file_schema, validate
22
from .test_integration import fake_results
3+
from .test_runners import env, cache_filename, tune_kernel
34
import pytest
45
import json
56
import os
67

78

8-
def test_store_output_file(fake_results):
9+
def test_store_output_file(env):
910
# setup variables
1011
filename = "test_output_file.json"
11-
_, _, tune_params, _, _, results, _ = fake_results
12+
results, _ = tune_kernel(*env, cache=cache_filename, simulation_mode=True)
13+
tune_params = env[-1]
1214

1315
# run store_output_file
1416
store_output_file(filename, results, tune_params)

0 commit comments

Comments
 (0)