Skip to content

Commit

Permalink
Merge pull request #26 from bamsumit/main
Browse files Browse the repository at this point in the history
Fix Lava-DL out of memory overflow issue
  • Loading branch information
biphasic authored Aug 13, 2023
2 parents eebdd82 + d374b3a commit b167181
Show file tree
Hide file tree
Showing 7 changed files with 3,196 additions and 76 deletions.
79 changes: 63 additions & 16 deletions content/post/framework-benchmarking/data-generation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -36,7 +36,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -73,7 +73,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -110,7 +110,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -146,7 +146,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -182,7 +182,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -221,7 +221,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -270,7 +270,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -353,7 +353,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -369,8 +369,9 @@
" 'voltage_decay' : 0.1,\n",
" 'requires_grad' : True, \n",
" }\n",
"\n",
" model = slayer.block.cuba.Dense(neuron_params, n_neurons, n_neurons).to(device)\n",
" # slayer.block automatically add quantization.\n",
" # They can be disabled by setting pre_hook_fx=None\n",
" model = slayer.block.cuba.Dense(neuron_params, n_neurons, n_neurons, pre_hook_fx=None).to(device)\n",
" input_static = torch.randn(batch_size, n_neurons, n_steps).to(device)\n",
" with torch.no_grad():\n",
" model(input_static)\n",
Expand All @@ -391,7 +392,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -403,9 +404,55 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 11,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Benchmarking SpikingJelly CuPy<br>v0.0.0.0.15 with n_neurons = 512\n",
"Benchmarking SpikingJelly CuPy<br>v0.0.0.0.15 with n_neurons = 4096\n",
"Benchmarking SpikingJelly CuPy<br>v0.0.0.0.15 with n_neurons = 16384\n",
"Benchmarking Rockpool<br>v2.6 with n_neurons = 512\n",
"Benchmarking Rockpool<br>v2.6 with n_neurons = 4096\n",
"Benchmarking Rockpool<br>v2.6 with n_neurons = 16384\n",
"Benchmarking Rockpool EXODUS<br>v2.6 with n_neurons = 512\n",
"Benchmarking Rockpool EXODUS<br>v2.6 with n_neurons = 4096\n",
"Benchmarking Rockpool EXODUS<br>v2.6 with n_neurons = 16384\n",
"Benchmarking Sinabs<br>v1.2.8 with n_neurons = 512\n",
"Benchmarking Sinabs<br>v1.2.8 with n_neurons = 4096\n",
"Benchmarking Sinabs<br>v1.2.8 with n_neurons = 16384\n",
"Benchmarking Sinabs EXODUS<br>v1.1.2 with n_neurons = 512\n",
"Benchmarking Sinabs EXODUS<br>v1.1.2 with n_neurons = 4096\n",
"Benchmarking Sinabs EXODUS<br>v1.1.2 with n_neurons = 16384\n",
"Benchmarking snnTorch<br>v0.7.0 with n_neurons = 512\n",
"Benchmarking snnTorch<br>v0.7.0 with n_neurons = 4096\n",
"Benchmarking snnTorch<br>v0.7.0 with n_neurons = 16384\n",
"Benchmarking Norse<br>v1.0.0 with n_neurons = 512\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/workspace/issues/benchmark_env/lib/python3.8/site-packages/norse/torch/functional/lif.py:391: UserWarning: operator() profile_node %71 : int = prim::profile_ivalue(%69)\n",
" does not have profile information (Triggered internally at ../third_party/nvfuser/csrc/graph_fuser.cpp:104.)\n",
" z, state = _lif_feed_forward_step_jit(input_spikes, state, LIFParametersJIT(*p), dt)\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Benchmarking Norse<br>v1.0.0 with n_neurons = 4096\n",
"Benchmarking Norse<br>v1.0.0 with n_neurons = 16384\n",
"Benchmarking Lava DL<br>v0.4.0.dev0 with n_neurons = 512\n",
"Benchmarking Lava DL<br>v0.4.0.dev0 with n_neurons = 4096\n",
"Benchmarking Lava DL<br>v0.4.0.dev0 with n_neurons = 16384\n"
]
}
],
"source": [
"data = []\n",
"for benchmark in [spikingjelly_cupy, rockpool_torch, rockpool_exodus, sinabs, sinabs_exodus, snntorch, norse, lava,]: # spikingjelly\n",
Expand Down Expand Up @@ -436,7 +483,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -476,7 +523,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.8.10"
}
},
"nbformat": 4,
Expand Down
96 changes: 48 additions & 48 deletions content/post/framework-benchmarking/data.csv
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
,framework,neurons,pass,time [s]
0,SpikingJelly CuPy<br>v0.0.0.0.15,512,forward,0.0007805065210099058
1,SpikingJelly CuPy<br>v0.0.0.0.15,4096,forward,0.0124769107795056
2,SpikingJelly CuPy<br>v0.0.0.0.15,16384,forward,0.027920798821882767
3,Rockpool<br>v2.6,512,forward,0.37688859303792316
4,Rockpool<br>v2.6,4096,forward,0.39487791061401367
5,Rockpool<br>v2.6,16384,forward,0.8107947508494059
6,Rockpool EXODUS<br>v2.6,512,forward,0.002076975900683695
7,Rockpool EXODUS<br>v2.6,4096,forward,0.06692159175872803
8,Rockpool EXODUS<br>v2.6,16384,forward,0.5919832587242126
9,Sinabs<br>v1.2.8,512,forward,0.06987739431446996
10,Sinabs<br>v1.2.8,4096,forward,0.0824661922454834
11,Sinabs<br>v1.2.8,16384,forward,0.5325368642807007
12,Sinabs EXODUS<br>v1.1.2,512,forward,0.0015409472176033101
13,Sinabs EXODUS<br>v1.1.2,4096,forward,0.05830531120300293
14,Sinabs EXODUS<br>v1.1.2,16384,forward,0.596237301826477
15,snnTorch<br>v0.7.0,512,forward,0.12985163927078247
16,snnTorch<br>v0.7.0,4096,forward,0.20558152198791504
17,snnTorch<br>v0.7.0,16384,forward,2.07729172706604
18,Norse<br>v1.0.0,512,forward,0.12789078056812286
19,Norse<br>v1.0.0,4096,forward,0.12744338810443878
20,Norse<br>v1.0.0,16384,forward,0.5510208606719971
21,Lava DL<br>v0.4.0.dev0,512,forward,0.00212576589472869
22,Lava DL<br>v0.4.0.dev0,4096,forward,0.06678892771402994
23,Lava DL<br>v0.4.0.dev0,16384,forward,
24,SpikingJelly CuPy<br>v0.0.0.0.15,512,backward,0.000706080198708752
25,SpikingJelly CuPy<br>v0.0.0.0.15,4096,backward,0.030669746976910217
26,SpikingJelly CuPy<br>v0.0.0.0.15,16384,backward,0.4747912883758545
27,Rockpool<br>v2.6,512,backward,0.21001343727111815
28,Rockpool<br>v2.6,4096,backward,0.9924057324727377
29,Rockpool<br>v2.6,16384,backward,4.060965855916341
30,Rockpool EXODUS<br>v2.6,512,backward,0.003395784911462816
31,Rockpool EXODUS<br>v2.6,4096,backward,0.04521534177992079
32,Rockpool EXODUS<br>v2.6,16384,backward,0.10865803559621175
33,Sinabs<br>v1.2.8,512,backward,0.11612474918365479
34,Sinabs<br>v1.2.8,4096,backward,0.7617576917012533
35,Sinabs<br>v1.2.8,16384,backward,3.246778726577759
36,Sinabs EXODUS<br>v1.1.2,512,backward,0.004442035755402762
37,Sinabs EXODUS<br>v1.1.2,4096,backward,0.04086161613464356
38,Sinabs EXODUS<br>v1.1.2,16384,backward,0.09781840214362511
39,snnTorch<br>v0.7.0,512,backward,0.08350504438082378
40,snnTorch<br>v0.7.0,4096,backward,0.3494421641031901
41,snnTorch<br>v0.7.0,16384,backward,5.430537621180217
42,Norse<br>v1.0.0,512,backward,0.1313396394252777
43,Norse<br>v1.0.0,4096,backward,0.4413779258728027
44,Norse<br>v1.0.0,16384,backward,2.0151825745900473
45,Lava DL<br>v0.4.0.dev0,512,backward,0.002021573529098973
46,Lava DL<br>v0.4.0.dev0,4096,backward,0.049568972936490686
47,Lava DL<br>v0.4.0.dev0,16384,backward,
0,SpikingJelly CuPy<br>v0.0.0.0.15,512,forward,0.0006135691894344025
1,SpikingJelly CuPy<br>v0.0.0.0.15,4096,forward,0.006756678976193823
2,SpikingJelly CuPy<br>v0.0.0.0.15,16384,forward,0.021720967341944116
3,Rockpool<br>v2.6,512,forward,0.3910966714223226
4,Rockpool<br>v2.6,4096,forward,0.3723260958989461
5,Rockpool<br>v2.6,16384,forward,0.5532882809638977
6,Rockpool EXODUS<br>v2.6,512,forward,0.0015773353892545971
7,Rockpool EXODUS<br>v2.6,4096,forward,0.021149432031731856
8,Rockpool EXODUS<br>v2.6,16384,forward,0.208259654045105
9,Sinabs<br>v1.2.8,512,forward,0.06968937249019228
10,Sinabs<br>v1.2.8,4096,forward,0.06567606618327479
11,Sinabs<br>v1.2.8,16384,forward,0.19781132177873093
12,Sinabs EXODUS<br>v1.1.2,512,forward,0.0007536293603283351
13,Sinabs EXODUS<br>v1.1.2,4096,forward,0.019232586451939173
14,Sinabs EXODUS<br>v1.1.2,16384,forward,0.19810709086331454
15,snnTorch<br>v0.7.0,512,forward,0.1372397263844808
16,snnTorch<br>v0.7.0,4096,forward,0.1441298382622855
17,snnTorch<br>v0.7.0,16384,forward,0.810722827911377
18,Norse<br>v1.0.0,512,forward,0.13558193842569988
19,Norse<br>v1.0.0,4096,forward,0.13515655199686685
20,Norse<br>v1.0.0,16384,forward,0.2118306875228882
21,Lava DL<br>v0.4.0.dev0,512,forward,0.001036392468862583
22,Lava DL<br>v0.4.0.dev0,4096,forward,0.013559699058532715
23,Lava DL<br>v0.4.0.dev0,16384,forward,0.130571186542511
24,SpikingJelly CuPy<br>v0.0.0.0.15,512,backward,0.0005310264037526948
25,SpikingJelly CuPy<br>v0.0.0.0.15,4096,backward,0.009100131555037066
26,SpikingJelly CuPy<br>v0.0.0.0.15,16384,backward,0.15093968595777238
27,Rockpool<br>v2.6,512,backward,0.22014141082763672
28,Rockpool<br>v2.6,4096,backward,0.48990139961242674
29,Rockpool<br>v2.6,16384,backward,1.8858092625935872
30,Rockpool EXODUS<br>v2.6,512,backward,0.0014320471155361866
31,Rockpool EXODUS<br>v2.6,4096,backward,0.01833481571891091
32,Rockpool EXODUS<br>v2.6,16384,backward,0.06904829781630943
33,Sinabs<br>v1.2.8,512,backward,0.12154525869032916
34,Sinabs<br>v1.2.8,4096,backward,0.3723318576812744
35,Sinabs<br>v1.2.8,16384,backward,1.4768603642781575
36,Sinabs EXODUS<br>v1.1.2,512,backward,0.0020558245993101583
37,Sinabs EXODUS<br>v1.1.2,4096,backward,0.01907735097975958
38,Sinabs EXODUS<br>v1.1.2,16384,backward,0.063108891248703
39,snnTorch<br>v0.7.0,512,backward,0.08307052612304687
40,snnTorch<br>v0.7.0,4096,backward,0.17454524834950766
41,snnTorch<br>v0.7.0,16384,backward,2.5700149536132812
42,Norse<br>v1.0.0,512,backward,0.12878863513469696
43,Norse<br>v1.0.0,4096,backward,0.21144869327545165
44,Norse<br>v1.0.0,16384,backward,0.8892718156178793
45,Lava DL<br>v0.4.0.dev0,512,backward,0.0012431368463301673
46,Lava DL<br>v0.4.0.dev0,4096,backward,0.01054878360346744
47,Lava DL<br>v0.4.0.dev0,16384,backward,0.13196541368961334
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3,097 changes: 3,085 additions & 12 deletions content/post/framework-benchmarking/plotting.ipynb

Large diffs are not rendered by default.

0 comments on commit b167181

Please sign in to comment.