File: run_speed_tests.py

package info (click to toggle)
brian 2.9.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,872 kB
  • sloc: python: 51,820; cpp: 2,033; makefile: 108; sh: 72
file content (49 lines) | stat: -rw-r--r-- 2,071 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from brian2 import *
from brian2.tests.features import *
from brian2.tests.features.base import *
from brian2.tests.features.speed import *
#from brian2genn.correctness_testing import GeNNConfiguration
import os, pickle

use_cached_results = True

if use_cached_results and os.path.exists('cached_speed_test_results.pkl'):
    with open('cached_speed_test_results.pkl', 'rb') as f:
        res = pickle.load(f)
else:
    # Full testing
    # res = run_speed_tests()

    # Quick testing
    res = run_speed_tests(configurations=[NumpyConfiguration,
                                          CythonConfiguration,
                                          #LocalConfiguration,
                                          CPPStandaloneConfiguration,
                                          #CPPStandaloneConfigurationOpenMP,
    #                                      GeNNConfiguration,
                                          ],
                          speed_tests=[
                                       LinearNeuronsOnly,
                                       HHNeuronsOnly,
                                       CUBAFixedConnectivity,
                                       COBAHHFixedConnectivity,
                                       VerySparseMediumRateSynapsesOnly,
                                       SparseMediumRateSynapsesOnly,
                                       DenseMediumRateSynapsesOnly,
                                       SparseLowRateSynapsesOnly,
                                       SparseHighRateSynapsesOnly,
                                       STDP,
                                       ],
                          #n_slice=slice(None, None, 3),
                          # n_slice=slice(None, -3),
                          run_twice=False,
                          maximum_run_time=1*second,
                          )

    with open('cached_speed_test_results.pkl', 'wb') as f:
        pickle.dump(res, f, -1)

res.plot_all_tests()
# res.plot_all_tests(profiling_minimum=0.15)
res.plot_all_tests(relative=True)
show()