Debian Codegraph @

dev/tools/run_speed_tests.py

raw
1 from brian2 import *
2 from brian2.tests.features import *
3 from brian2.tests.features.base import *
4 from brian2.tests.features.speed import *
5 #from brian2genn.correctness_testing import GeNNConfiguration
6 import os, pickle
7
8 use_cached_results = True
9
10 if use_cached_results and os.path.exists('cached_speed_test_results.pkl'):
11 with open('cached_speed_test_results.pkl', 'rb') as f:
12 res = pickle.load(f)
13 else:
14 # Full testing
15 # res = run_speed_tests()
16
17 # Quick testing
18 res = run_speed_tests(configurations=[NumpyConfiguration,
19 CythonConfiguration,
20 #LocalConfiguration,
21 CPPStandaloneConfiguration,
22 #CPPStandaloneConfigurationOpenMP,
23 # GeNNConfiguration,
24 ],
25 speed_tests=[
26 LinearNeuronsOnly,
27 HHNeuronsOnly,
28 CUBAFixedConnectivity,
29 COBAHHFixedConnectivity,
30 VerySparseMediumRateSynapsesOnly,
31 SparseMediumRateSynapsesOnly,
32 DenseMediumRateSynapsesOnly,
33 SparseLowRateSynapsesOnly,
34 SparseHighRateSynapsesOnly,
35 STDP,
36 ],
37 #n_slice=slice(None, None, 3),
38 # n_slice=slice(None, -3),
39 run_twice=False,
40 maximum_run_time=1*second,
41 )
42
43 with open('cached_speed_test_results.pkl', 'wb') as f:
44 pickle.dump(res, f, -1)
45
46 res.plot_all_tests()
47 # res.plot_all_tests(profiling_minimum=0.15)
48 res.plot_all_tests(relative=True)
49 show()