Skip to content

Commit b5c5e35

Browse files
committed
Update benchmarks
1 parent 66724b1 commit b5c5e35

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

brainpy/_src/math/event/tests/event_csrmv_taichi_VS_event_csrmv.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def test_event_ell_gpu(s, p, values_type, events_type, transpose):
161161
heter_data = bm.as_jax(rng.random(csr_indices.shape))
162162
weight = heter_data
163163

164-
groundtruth = bm.as_jax(vector, dtype=float) @ bm.as_jax(dense)
164+
# groundtruth = bm.as_jax(vector, dtype=float) @ bm.as_jax(dense)
165165

166166

167167

@@ -261,6 +261,8 @@ def test_event_ell_gpu(s, p, values_type, events_type, transpose):
261261
return taichi_aot_time1, taichi_aot_time2, taichi_aot_time3, taichi_aot_time4, taichi_aot_time5,\
262262
brainpy_time1, brainpy_time2, brainpy_time3, brainpy_time4, brainpy_time5, speedup
263263

264+
PATH = os.path.dirname(os.path.abspath(__file__))
265+
264266
# init dataframe
265267
df = pd.DataFrame(columns=['s', 'p', 'backend', 'values type', 'events type', 'transpose',
266268
'taichi aot time1(ms)', 'taichi aot time2(ms)', 'taichi aot time3(ms)', 'taichi aot time4(ms)', 'taichi aot time5(ms)',
@@ -279,7 +281,7 @@ def test_event_ell_gpu(s, p, values_type, events_type, transpose):
279281
df.loc[df.shape[0]] = [_s, _p, 'cpu', _values_type, _events_type, _transpose,
280282
taichi_aot_time_1, taichi_aot_time_2, taichi_aot_time_3, taichi_aot_time_4, taichi_aot_time_5,
281283
brainpy_time_1, brainpy_time_2, brainpy_time_3, brainpy_time_4, brainpy_time_5, speedup]
282-
df.to_csv('event_csrmv_cpu.csv', index=False)
284+
df.to_csv(f'{PATH}/event_csrmv_cpu.csv', index=False)
283285

284286
if (bm.get_platform() == 'gpu'):
285287
for _s in s:
@@ -293,7 +295,7 @@ def test_event_ell_gpu(s, p, values_type, events_type, transpose):
293295
df.loc[df.shape[0]] = [_s, _p, 'gpu', _values_type, _events_type, transpose,
294296
taichi_aot_time_1, taichi_aot_time_2, taichi_aot_time_3, taichi_aot_time_4, taichi_aot_time_5,
295297
brainpy_time_1, brainpy_time_2, brainpy_time_3, brainpy_time_4, brainpy_time_5, speedup]
296-
df.to_csv('event_csrmv_gpu.csv', index=False)
298+
df.to_csv(f'{PATH}/event_csrmv_gpu.csv', index=False)
297299

298300
# if (bm.get_platform() == 'gpu'):
299301
# for _s in s:

brainpy/_src/math/sparse/tests/csrmv_taichi_VS_csrmv.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,8 @@ def test_event_ell_gpu(s, p, values_type, events_type, transpose):
250250
return taichi_aot_time1, taichi_aot_time2, taichi_aot_time3, taichi_aot_time4, taichi_aot_time5,\
251251
brainpy_time1, brainpy_time2, brainpy_time3, brainpy_time4, brainpy_time5, speedup
252252

253-
bm.set_platform('cpu')
254-
block_dim = 64
253+
PATH = os.path.dirname(os.path.abspath(__file__))
254+
255255
# init dataframe
256256
df = pd.DataFrame(columns=['s', 'p', 'backend', 'values type', 'events type', 'transpose',
257257
'taichi aot time1(ms)', 'taichi aot time2(ms)', 'taichi aot time3(ms)', 'taichi aot time4(ms)', 'taichi aot time5(ms)',
@@ -270,7 +270,7 @@ def test_event_ell_gpu(s, p, values_type, events_type, transpose):
270270
df.loc[df.shape[0]] = [_s, _p, 'cpu', _values_type, _events_type, _transpose,
271271
taichi_aot_time_1, taichi_aot_time_2, taichi_aot_time_3, taichi_aot_time_4, taichi_aot_time_5,
272272
brainpy_time_1, brainpy_time_2, brainpy_time_3, brainpy_time_4, brainpy_time_5, speedup]
273-
df.to_csv('event_csrmv_cpu.csv', index=False)
273+
df.to_csv(f'{PATH}/event_csrmv_cpu.csv', index=False)
274274

275275
if (bm.get_platform() == 'gpu'):
276276
for _s in s:
@@ -284,7 +284,7 @@ def test_event_ell_gpu(s, p, values_type, events_type, transpose):
284284
df.loc[df.shape[0]] = [_s, _p, 'gpu', _values_type, _events_type, transpose,
285285
taichi_aot_time_1, taichi_aot_time_2, taichi_aot_time_3, taichi_aot_time_4, taichi_aot_time_5,
286286
brainpy_time_1, brainpy_time_2, brainpy_time_3, brainpy_time_4, brainpy_time_5, speedup]
287-
df.to_csv('event_csrmv_gpu.csv', index=False)
287+
df.to_csv(f'{PATH}/event_csrmv_gpu.csv', index=False)
288288

289289
# if (bm.get_platform() == 'gpu'):
290290
# for _s in s:

0 commit comments

Comments
 (0)