File size: 31,630 Bytes
f415c73
 
 
 
56fab60
f415c73
 
 
 
 
ebc6805
f415c73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56fab60
f415c73
 
 
 
 
ebc6805
f415c73
ebc6805
f415c73
 
 
 
 
 
 
 
 
 
 
 
ebc6805
f415c73
ebc6805
f415c73
 
 
 
 
 
 
 
 
 
 
 
ebc6805
f415c73
ebc6805
f415c73
 
 
 
 
 
 
 
 
 
 
 
ebc6805
f415c73
ebc6805
5624d67
 
 
 
 
 
 
 
 
 
 
 
ebc6805
5624d67
ebc6805
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f415c73
 
 
 
 
 
 
 
 
 
 
 
 
5624d67
7bd72fd
5624d67
f415c73
 
 
 
 
 
aac0cfe
f415c73
 
 
 
 
aac0cfe
 
 
f415c73
aac0cfe
f415c73
 
 
 
 
 
 
aac0cfe
 
 
f415c73
aac0cfe
f415c73
 
 
 
 
 
 
aac0cfe
 
 
f415c73
aac0cfe
f415c73
 
 
 
 
 
 
aac0cfe
5624d67
 
 
 
 
 
 
 
 
ebc6805
 
 
 
 
 
 
 
 
 
 
 
5624d67
 
 
 
aac0cfe
f415c73
aac0cfe
f415c73
 
 
 
 
 
 
aac0cfe
 
 
f415c73
aac0cfe
f415c73
 
 
 
 
 
 
aac0cfe
 
 
f415c73
aac0cfe
f415c73
 
aac0cfe
f415c73
 
 
 
7bd72fd
56fab60
aac0cfe
 
 
 
5624d67
7bd72fd
5624d67
aac0cfe
 
00054e0
f415c73
aac0cfe
f415c73
 
 
 
2621518
 
f415c73
2621518
f415c73
 
 
 
 
 
 
 
 
 
846a33f
f415c73
00054e0
 
 
 
 
 
aac0cfe
 
00054e0
aac0cfe
 
f415c73
00054e0
5624d67
 
 
 
 
 
 
 
 
 
f415c73
5624d67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
846a33f
5624d67
 
 
 
 
 
 
 
 
 
7bd72fd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ebc6805
7bd72fd
 
 
 
 
 
 
 
 
 
 
 
 
5624d67
7bd72fd
 
 
 
 
 
 
 
 
5624d67
f415c73
aac0cfe
f415c73
 
 
 
 
5624d67
2621518
f415c73
 
 
 
 
 
846a33f
f415c73
 
 
 
 
 
 
 
 
846a33f
f415c73
 
 
 
 
00054e0
 
 
 
 
 
 
aac0cfe
 
00054e0
aac0cfe
00054e0
aac0cfe
00054e0
 
f415c73
aac0cfe
f415c73
 
 
 
 
5624d67
2621518
f415c73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
00054e0
 
 
 
 
 
 
 
aac0cfe
 
00054e0
 
f415c73
aac0cfe
f415c73
 
 
 
5624d67
 
2621518
 
5624d67
f415c73
 
 
 
aac0cfe
 
 
 
 
f415c73
aac0cfe
f415c73
 
aac0cfe
 
 
 
f415c73
 
 
 
 
 
 
 
 
00054e0
 
 
 
 
 
 
 
 
 
 
f415c73
 
 
 
 
 
 
00054e0
 
 
 
 
f415c73
00054e0
 
 
 
 
f415c73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "4f22a659",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/mercury+json": "{\n    \"widget\": \"App\",\n    \"title\": \"Performance Benchmarks\",\n    \"description\": \"Collated Performance Benchmarks\",\n    \"show_code\": false,\n    \"show_prompt\": false,\n    \"output\": \"app\",\n    \"schedule\": \"\",\n    \"notify\": \"{}\",\n    \"continuous_update\": true,\n    \"static_notebook\": false,\n    \"show_sidebar\": true,\n    \"full_screen\": true,\n    \"allow_download\": true,\n    \"model_id\": \"mercury-app\",\n    \"code_uid\": \"App.0.40.24.2-rand6ab06af5\"\n}",
      "text/html": [
       "<h3>Mercury Application</h3><small>This output won't appear in the web app.</small>"
      ],
      "text/plain": [
       "mercury.App"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import mercury as mr\n",
    "app = mr.App(title=\"Performance Benchmarks\", description=\"Collated Performance Benchmarks\", show_code=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "5f385b19",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/mercury+json": "{\n    \"widget\": \"Checkbox\",\n    \"value\": false,\n    \"label\": \"Compare all\",\n    \"model_id\": \"7835f9036ce3498f97e52ea76c23d024\",\n    \"code_uid\": \"Checkbox.0.40.11.1-rand3a52d4f8\",\n    \"url_key\": \"\",\n    \"disabled\": false,\n    \"hidden\": false\n}",
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "7835f9036ce3498f97e52ea76c23d024",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "mercury.Checkbox"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/mercury+json": "{\n    \"widget\": \"Checkbox\",\n    \"value\": false,\n    \"label\": \"Compare across compute capabilities\",\n    \"model_id\": \"4b9f0bc68f2f4c018ec4be0fb41b5ea8\",\n    \"code_uid\": \"Checkbox.0.40.11.2-rand96a14bb7\",\n    \"url_key\": \"\",\n    \"disabled\": false,\n    \"hidden\": false\n}",
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "4b9f0bc68f2f4c018ec4be0fb41b5ea8",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "mercury.Checkbox"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/mercury+json": "{\n    \"widget\": \"Checkbox\",\n    \"value\": false,\n    \"label\": \"Compare across precision\",\n    \"model_id\": \"e3381e5e2c4f4c63a284230d2f69055f\",\n    \"code_uid\": \"Checkbox.0.40.11.3-rand4bc78cbc\",\n    \"url_key\": \"\",\n    \"disabled\": false,\n    \"hidden\": false\n}",
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "e3381e5e2c4f4c63a284230d2f69055f",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "mercury.Checkbox"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/mercury+json": "{\n    \"widget\": \"Checkbox\",\n    \"value\": false,\n    \"label\": \"Compare one-on-one\",\n    \"model_id\": \"2a39943b849c453f81cf513c5af87efd\",\n    \"code_uid\": \"Checkbox.0.40.11.4-rand4b127455\",\n    \"url_key\": \"\",\n    \"disabled\": false,\n    \"hidden\": false\n}",
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "2a39943b849c453f81cf513c5af87efd",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "mercury.Checkbox"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/mercury+json": "{\n    \"widget\": \"Checkbox\",\n    \"value\": false,\n    \"label\": \"Compare between tasks\",\n    \"model_id\": \"2cb81fd3152f46ea8605df67ecc39f6f\",\n    \"code_uid\": \"Checkbox.0.40.11.5-rand852c5407\",\n    \"url_key\": \"\",\n    \"disabled\": false,\n    \"hidden\": false\n}",
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "2cb81fd3152f46ea8605df67ecc39f6f",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "mercury.Checkbox"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/mercury+json": "{\n    \"widget\": \"Checkbox\",\n    \"value\": false,\n    \"label\": \"Multi-GPU\",\n    \"model_id\": \"5135bd3a7fff4a22889496727aa63f11\",\n    \"code_uid\": \"Checkbox.0.40.11.6-rand5c1d04aa\",\n    \"url_key\": \"\",\n    \"disabled\": false,\n    \"hidden\": false\n}",
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "5135bd3a7fff4a22889496727aa63f11",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "mercury.Checkbox"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "all_flag = mr.Checkbox(value=False, label=\"Compare all\")\n",
    "cc_flag = mr.Checkbox(value=False, label=\"Compare across compute capabilities\")\n",
    "pr_flag = mr.Checkbox(value=False, label=\"Compare across precision\")\n",
    "ovo_flag = mr.Checkbox(value=False, label=\"Compare one-on-one\")\n",
    "com_task_flag = mr.Checkbox(value=False, label=\"Compare between tasks\")\n",
    "mgpu_flag = mr.Checkbox(value=False, label=\"Multi-GPU\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "2ce780ab",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "### Performance Benchmarks of quantum simulators"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/markdown": [
       "Options on the left include (please select only one):"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/markdown": [
       "- Compare all: Compare the TtS of all packages and also the performance relative to a given package"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/markdown": [
       "- Compare across compute capabilities: Compare the performance of package(s) with different compute capabilities"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/markdown": [
       "- Compare across different precision: Compare the performance of package(s) with different precision with fixed compute capability"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/markdown": [
       "- Compare one-on-one: Compare the performance by selecting two different set of parameters"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/markdown": [
       "- Compare between tasks: Compare the performance between two tasks with respect to ratio of gates applied"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/markdown": [
       "- Multi-GPU: Compare the performance between different parameters as a function of the number of GPUs"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "flag_arr = [all_flag.value, cc_flag.value, pr_flag.value, ovo_flag.value, com_task_flag.value, mgpu_flag.value]\n",
    "\n",
    "if flag_arr.count(True) == 0 or flag_arr.count(True) > 1:\n",
    "    mr.Md(\"### Performance Benchmarks of quantum simulators\")\n",
    "    mr.Md(\"Options on the left include (please select only one):\")\n",
    "    mr.Md(\"- Compare all: Compare the TtS of all packages and also the performance relative to a given package\")\n",
    "    mr.Md(\"- Compare across compute capabilities: Compare the performance of package(s) with different compute capabilities\")\n",
    "    mr.Md(\"- Compare across different precision: Compare the performance of package(s) with different precision with fixed compute capability\")\n",
    "    mr.Md(\"- Compare one-on-one: Compare the performance by selecting two different set of parameters\")\n",
    "    mr.Md(\"- Compare between tasks: Compare the performance between two tasks with respect to ratio of gates applied\")\n",
    "    mr.Md(\"- Multi-GPU: Compare the performance between different parameters as a function of the number of GPUs\")\n",
    "\n",
    "elif all_flag.value == True:\n",
    "    \n",
    "    import numpy as np\n",
    "    import h5py\n",
    "    import os\n",
    "\n",
    "    _p = os.getcwd()\n",
    "    \n",
    "    import sys\n",
    "    sys.path.append(_p + '/plot_scripts/')\n",
    "    from map_packages_colors_all import *\n",
    "    from plot_scripts_all import *\n",
    "    from plot_display_all import *\n",
    "    \n",
    "    task = mr.Select(label=\"Select Task: \", value=\"Heisenberg dynamics\", choices=[\"Heisenberg dynamics\", \"Random Quantum Circuit\", \"Quantum Fourier Transform\"])\n",
    "    \n",
    "    com_cap = mr.Select(label=\"Select Compute Capability: \", value=\"Singlethread\", choices=[\"Singlethread\", \"Multithread\", \"GPU\"])\n",
    "    \n",
    "    prec = mr.Select(label=\"Select Precision : \", value=\"Single\", choices=[\"Single\", \"Double\"])\n",
    "    \n",
    "    com_pack = mr.Select(label=\"Select Package to compare: \", value=\"qsimcirq\", choices=['qiskit' , 'cirq', 'qsimcirq', 'pennylane', 'pennylane_l', 'qibo', 'qibojit', 'yao', 'quest', 'qulacs', 'intel_qs_cpp', 'projectq', 'svsim',  'hybridq', 'hiq', 'qcgpu', 'qrack_sch', 'cuquantum_qiskit', 'cuquantum_qsimcirq', 'qpanda', 'qpp', 'myqlm', 'myqlm_cpp', 'braket'])\n",
    "    \n",
    "    # if task.value == \"Heisenberg dynamics\" or task.value == \"Quantum Fourier Transform\":\n",
    "    #     N_slider = mr.Slider(value=36, min=6, max=36, label=\"Select System size: \", step=2)\n",
    "    # elif task.value == \"Random Quantum Circuit\":\n",
    "    #     N_slider = mr.Slider(value=N_slider.value, min=12, max=36, label=\"Select System size: \", step=2)\n",
    "    N_slider = mr.Slider(value=36, min=6, max=36, label=\"Select System size: \", step=2)\n",
    "    if task.value == \"Random Quantum Circuit\" and N_slider.value < 12:\n",
    "        # print(\"Please select a different final N value\")\n",
    "        mr.Md(\"### Please select a different final N value\")\n",
    "    else:\n",
    "        # print('Performance benchmarks of task: {}, with compute capability: {}, precision: {}'.format(task.value, com_cap.value, prec.value))\n",
    "        mr.Md(f\"Performance benchmarks of task: {task.value}, with compute capability: {com_cap.value}, precision: {prec.value}\")\n",
    "    \n",
    "        abs_time(task.value, com_cap.value, prec.value, com_pack.value, N_slider.value+2)\n",
    "        \n",
    "elif cc_flag.value == True:\n",
    "    \n",
    "    import numpy as np\n",
    "    import h5py\n",
    "    import os\n",
    "    \n",
    "    cc_packages_flag = mr.Checkbox(value=False, label=\"Compare across packages\")\n",
    "    \n",
    "    cc_pack_flag = mr.Checkbox(value=False, label=\"Compare a single package\")\n",
    "    \n",
    "    if (cc_packages_flag.value == False and cc_pack_flag.value == False) or (cc_packages_flag.value == True and cc_pack_flag.value == True):\n",
    "        mr.Md(\"The options on the left include:\")\n",
    "        mr.Md(\"- Performance benchmark across packages with different compute capabilities\")\n",
    "        mr.Md(\"- Performance benchmark of a package with different compute capabilites\")\n",
    "        \n",
    "    elif cc_packages_flag.value == True:\n",
    "\n",
    "        import sys\n",
    "        \n",
    "        _p = os.getcwd()\n",
    "        \n",
    "        sys.path.append(_p + '/plot_scripts/')\n",
    "        from map_packages_colors_all import *\n",
    "        from plot_scripts_all import *\n",
    "        from plot_display_com_cap_all import *\n",
    "        \n",
    "        # params = {'figure.figsize': (5, 5)}\n",
    "        # plt.rcParams.update(params)\n",
    "        \n",
    "        mr.Md(\"Ratio of different compute capabilities for different packages\")\n",
    "        \n",
    "        task = mr.Select(label=\"Select Task: \", value=\"Heisenberg dynamics\", choices=[\"Heisenberg dynamics\", \"Random Quantum Circuit\", \"Quantum Fourier Transform\"])\n",
    "        \n",
    "        prec = mr.Select(label=\"Select Precision : \", value=\"Single\", choices=[\"Single\", \"Double\"])\n",
    "        \n",
    "        N_slider = mr.Slider(value=36, min=6, max=36, label=\"Select System size: \", step=2)\n",
    "        \n",
    "        com_cap_1 = mr.Select(label=\"Select Compute Capability: \", value=\"Singlethread\", choices=[\"Singlethread\", \"Multithread\", \"GPU\"])\n",
    "        com_cap_2 = mr.Select(label=\"Select Compute Capability: \", value=\"Multithread\", choices=[\"Singlethread\", \"Multithread\", \"GPU\"])        \n",
    "        \n",
    "        abs_time_pack(task.value, prec.value, N_slider.value+2, com_cap_1.value, com_cap_2.value)        \n",
    "        \n",
    "        compare_task_flag = mr.Checkbox(value=False, label=\"Compare to other task (ratio):\")\n",
    "        if compare_task_flag.value == True:\n",
    "            mr.Md(\"___\")\n",
    "            mr.Md(\"Comparison to different tasks\")\n",
    "            task2 = mr.Select(label=\"Select Task: \", value=\"Heisenberg dynamics\", choices=[\"Heisenberg dynamics\", \"Random Quantum Circuit\", \"Quantum Fourier Transform\"])\n",
    "            comp_time_pack(task.value, task2.value, prec.value, N_slider.value+2, com_cap_1.value, com_cap_2.value)\n",
    "            \n",
    "    elif cc_pack_flag.value == True:\n",
    "        \n",
    "        import sys\n",
    "        \n",
    "        _p = os.getcwd()\n",
    "        \n",
    "        sys.path.append(_p + '/plot_scripts/')\n",
    "        from map_packages_colors_1v1 import *\n",
    "        from plot_scripts_1v1 import *\n",
    "        from plot_display_com_cap import *\n",
    "    \n",
    "        task = mr.Select(label=\"Select Task: \", value=\"Heisenberg dynamics\", choices=[\"Heisenberg dynamics\", \"Random Quantum Circuit\", \"Quantum Fourier Transform\"])\n",
    "\n",
    "        com_pack = mr.Select(label=\"Select Package to compare: \", value=\"qsimcirq\", choices=['qiskit' , 'cirq', 'qsimcirq', 'pennylane', 'pennylane_l', 'qibo', 'qibojit', 'yao', 'quest', 'qulacs', 'intel_qs_cpp', 'projectq', 'svsim',  'hybridq', 'hiq', 'qcgpu', 'qrack_sch', 'cuquantum_qiskit', 'cuquantum_qsimcirq', 'qpanda', 'qpp', 'myqlm', 'myqlm_cpp', 'braket'])\n",
    "    \n",
    "        prec = mr.Select(label=\"Select Precision : \", value=\"Single\", choices=[\"Single\", \"Double\"])\n",
    "    \n",
    "        N_slider = mr.Slider(value=36, min=6, max=36, label=\"Select System size: \", step=2)\n",
    "    \n",
    "        if task.value == \"Random Quantum Circuit\" and N_slider.value < 12:\n",
    "            mr.Md(\"### Please select a different final N value\")\n",
    "        else:\n",
    "            abs_time_pack(task.value, com_pack.value, prec.value, N_slider.value+2)\n",
    "            \n",
    "\n",
    "elif pr_flag.value == True:\n",
    "    \n",
    "    import numpy as np\n",
    "    import h5py\n",
    "    import os\n",
    "    \n",
    "    pr_packages_flag = mr.Checkbox(value=False, label=\"Compare across packages\")\n",
    "    \n",
    "    pr_pack_flag = mr.Checkbox(value=False, label=\"Compare a single package\")\n",
    "    \n",
    "    if (pr_packages_flag.value == False and pr_pack_flag.value == False) or (pr_packages_flag.value == True and pr_pack_flag.value == True):\n",
    "        mr.Md(\"The options on the left include:\")\n",
    "        mr.Md(\"- Performance benchmark across packages with different precision\")\n",
    "        mr.Md(\"- Performance benchmark of a package with different precision\")\n",
    "        \n",
    "    elif pr_packages_flag.value == True:\n",
    "\n",
    "        import sys\n",
    "        \n",
    "        _p = os.getcwd()\n",
    "        \n",
    "        sys.path.append(_p + '/plot_scripts/')\n",
    "        from map_packages_colors_all import *\n",
    "        from plot_scripts_all import *\n",
    "        from plot_display_com_prec_all import *\n",
    "        \n",
    "        # params = {'figure.figsize': (5, 5)}\n",
    "        # plt.rcParams.update(params)\n",
    "        \n",
    "        mr.Md(\"Ratio of different precision for different packages\")\n",
    "        \n",
    "        task = mr.Select(label=\"Select Task: \", value=\"Heisenberg dynamics\", choices=[\"Heisenberg dynamics\", \"Random Quantum Circuit\", \"Quantum Fourier Transform\"])\n",
    "        \n",
    "        cc = mr.Select(label=\"Select Compute Capability : \", value=\"Singlethread\", choices=[\"Singlethread\", \"Multithread\", \"GPU\"])\n",
    "        \n",
    "        N_slider = mr.Slider(value=36, min=6, max=36, label=\"Select System size: \", step=2)\n",
    "        \n",
    "        com_pr_1 = mr.Select(label=\"Select Precision I: \", value=\"Double\", choices=[\"Single\", \"Double\"])\n",
    "        com_pr_2 = mr.Select(label=\"Select Precision II: \", value=\"Single\", choices=[\"Single\", \"Double\"])        \n",
    "        \n",
    "        abs_time_pack(task.value, cc.value, N_slider.value+2, com_pr_1.value, com_pr_2.value)        \n",
    "        \n",
    "        compare_task_flag = mr.Checkbox(value=False, label=\"Compare to other task (ratio):\")\n",
    "        if compare_task_flag.value == True:\n",
    "            mr.Md(\"___\")\n",
    "            mr.Md(\"Comparison to different tasks\")\n",
    "            task2 = mr.Select(label=\"Select Task: \", value=\"Heisenberg dynamics\", choices=[\"Heisenberg dynamics\", \"Random Quantum Circuit\", \"Quantum Fourier Transform\"])\n",
    "            comp_time_pack(task.value, task2.value, cc.value, N_slider.value+2, com_pr_1.value, com_pr_2.value)\n",
    "            \n",
    "    elif pr_pack_flag.value == True:\n",
    "        \n",
    "        import sys\n",
    "        \n",
    "        _p = os.getcwd()\n",
    "        \n",
    "        sys.path.append(_p + '/plot_scripts/')\n",
    "        from map_packages_colors_1v1 import *\n",
    "        from plot_scripts_1v1 import *\n",
    "        from plot_display_com_prec import *\n",
    "    \n",
    "        task = mr.Select(label=\"Select Task: \", value=\"Heisenberg dynamics\", choices=[\"Heisenberg dynamics\", \"Random Quantum Circuit\", \"Quantum Fourier Transform\"])\n",
    "\n",
    "        com_pack = mr.Select(label=\"Select Package to compare: \", value=\"qsimcirq\", choices=['qiskit' , 'cirq', 'qsimcirq', 'pennylane', 'pennylane_l', 'qibo', 'qibojit', 'yao', 'quest', 'qulacs', 'intel_qs_cpp', 'projectq', 'svsim',  'hybridq', 'hiq', 'qcgpu', 'qrack_sch', 'cuquantum_qiskit', 'cuquantum_qsimcirq', 'qpanda', 'qpp', 'myqlm', 'myqlm_cpp', 'braket'])\n",
    "    \n",
    "        cc = mr.Select(label=\"Select Compute Capability : \", value=\"Singlethread\", choices=[\"Singlethread\", \"Multithread\", \"GPU\"])\n",
    "    \n",
    "        N_slider = mr.Slider(value=36, min=6, max=36, label=\"Select System size: \", step=2)\n",
    "    \n",
    "        if task.value == \"Random Quantum Circuit\" and N_slider.value < 12:\n",
    "            mr.Md(\"### Please select a different final N value\")\n",
    "        else:\n",
    "            abs_time_pack(task.value, com_pack.value, cc.value, N_slider.value+2)\n",
    "            \n",
    "        \n",
    "elif ovo_flag.value == True:\n",
    "    \n",
    "    import numpy as np\n",
    "    import h5py\n",
    "    import os\n",
    "\n",
    "    import sys\n",
    "    _p = os.getcwd()\n",
    "    sys.path.append(_p + '/plot_scripts/')\n",
    "    from map_packages_colors_1v1 import *\n",
    "    from plot_scripts_1v1 import *\n",
    "    from plot_display_1v1 import *\n",
    "    \n",
    "    task = mr.Select(label=\"Select Task I:\", value=\"Heisenberg dynamics\", choices=[\"Heisenberg dynamics\", \"Random Quantum Circuit\", \"Quantum Fourier Transform\"])\n",
    "    \n",
    "    pack = mr.Select(label=\"Select Package I:\", value=\"qsimcirq\", choices=['qiskit' , 'cirq', 'qsimcirq', 'pennylane', 'pennylane_l', 'qibo', 'qibojit', 'yao', 'quest', 'qulacs', 'intel_qs_cpp', 'projectq', 'svsim',  'hybridq', 'hiq', 'qcgpu', 'qrack_sch', 'cuquantum_qiskit', 'cuquantum_qsimcirq', 'qpanda', 'qpp', 'myqlm', 'myqlm_cpp', 'braket'])\n",
    "    \n",
    "    com_cap = mr.Select(label=\"Select Compute Capability I:\", value=\"Singlethread\", choices=[\"Singlethread\", \"Multithread\", \"GPU\"])\n",
    "    \n",
    "    prec = mr.Select(label=\"Select Precision I:\", value=\"Single\", choices=[\"Single\", \"Double\"])\n",
    "        \n",
    "    # print(\"----------------------------------------------------------------\")\n",
    "    \n",
    "    task_2 = mr.Select(label=\"Select Task II:\", value=\"Random Quantum Circuit\", choices=[\"Heisenberg dynamics\", \"Random Quantum Circuit\", \"Quantum Fourier Transform\"])\n",
    "\n",
    "    pack_2 = mr.Select(label=\"Select Package to compare: \", value=\"qsimcirq\", choices=['qiskit' , 'cirq', 'qsimcirq', 'pennylane', 'pennylane_l', 'qibo', 'qibojit', 'yao', 'quest', 'qulacs', 'intel_qs_cpp', 'projectq', 'svsim',  'hybridq', 'hiq', 'qcgpu', 'qrack_sch', 'cuquantum_qiskit', 'cuquantum_qsimcirq', 'qpanda', 'qpp', 'myqlm', 'myqlm_cpp', 'braket'])\n",
    "    \n",
    "    com_cap_2 = mr.Select(label=\"Select Compute Capability II:\", value=\"Singlethread\", choices=[\"Singlethread\", \"Multithread\", \"GPU\"])\n",
    "    \n",
    "    prec_2 = mr.Select(label=\"Select Precision II:\", value=\"Single\", choices=[\"Single\", \"Double\"])\n",
    "    \n",
    "    # if task.value == \"Heisenberg dynamics\" or task.value == \"Quantum Fourier Transform\":\n",
    "    #     N_slider = mr.Slider(value=slider_glob, min=6, max=36, label=\"Select System size: \", step=2)\n",
    "    # elif task.value == \"Random Quantum Circuit\":\n",
    "    #     N_slider = mr.Slider(value=slider_glob, min=12, max=36, label=\"Select System size: \", step=2)\n",
    "\n",
    "    N_slider = mr.Slider(value=36, min=6, max=36, label=\"Select System size: \", step=2)\n",
    "    if (task.value == \"Random Quantum Circuit\" or task_2.value == \"Random Quantum Circuit\") and N_slider.value < 12:\n",
    "        # print(\"Please select a different final N value\")\n",
    "        mr.Md(\"### Please select a different final N value\")\n",
    "    else:\n",
    "        # print(\"Absolute Time\")\n",
    "        abs_time(task.value, pack.value, com_cap.value, prec.value, task_2.value, pack_2.value, com_cap_2.value, prec_2.value, N_slider.value+2)\n",
    "        # print(\"Relative Time\")\n",
    "        relative_time_wrt_pack(task.value, pack.value, com_cap.value, prec.value, task_2.value, pack_2.value, com_cap_2.value, prec_2.value, N_slider.value+2)\n",
    "    \n",
    "elif com_task_flag.value == True:\n",
    "    \n",
    "    import numpy as np\n",
    "    import h5py\n",
    "    import os\n",
    "\n",
    "    import sys\n",
    "    _p = os.getcwd()\n",
    "    sys.path.append(_p + '/plot_scripts/')\n",
    "    from map_packages_colors_all import *\n",
    "    from plot_scripts_all import *\n",
    "    from plot_display_com_pack import *\n",
    "    \n",
    "    task_1 = mr.Select(label=\"Select Task I:\", value=\"Heisenberg dynamics\", choices=[\"Heisenberg dynamics\", \"Random Quantum Circuit\", \"Quantum Fourier Transform\"]) \n",
    "    task_2 = mr.Select(label=\"Select Task II:\", value=\"Random Quantum Circuit\", choices=[\"Heisenberg dynamics\", \"Random Quantum Circuit\", \"Quantum Fourier Transform\"])\n",
    "    \n",
    "    # print(task_1.value)\n",
    "    # print(task_2.value)\n",
    "    \n",
    "    com_cap = mr.Select(label=\"Select Compute Capability:\", value=\"Singlethread\", choices=[\"Singlethread\", \"Multithread\", \"GPU\"]) \n",
    "    \n",
    "    prec = mr.Select(label=\"Select Precision:\", value=\"Single\", choices=[\"Single\", \"Double\"])\n",
    "    \n",
    "    # if task_1.value == \"Heisenberg dynamics\" or task_1.value == \"Quantum Fourier Transform\":\n",
    "    #     N_slider = mr.Slider(value=36, min=6, max=36, label=\"Select System size: \", step=2)\n",
    "    # elif task_1.value == \"Random Quantum Circuit\":\n",
    "    #     N_slider = mr.Slider(value=36, min=12, max=36, label=\"Select System size: \", step=2)\n",
    "    \n",
    "    # if task_2.value == \"Heisenberg dynamics\" or task_2.value == \"Quantum Fourier Transform\":\n",
    "    #     N_slider = mr.Slider(value=36, min=6, max=36, label=\"Select System size: \", step=2)\n",
    "    # elif task_2.value == \"Random Quantum Circuit\":\n",
    "    #     N_slider = mr.Slider(value=N_slider.value, min=12, max=36, label=\"Select System size: \", step=2)\n",
    "    \n",
    "    N_slider = mr.Slider(value=36, min=6, max=36, label=\"Select System size: \", step=2)\n",
    "    if task_2.value == \"Random Quantum Circuit\" and N_slider.value < 12:\n",
    "        mr.Md(\"### Please select a different final N value\")\n",
    "    else:    \n",
    "        abs_time_pack(task_1.value, task_2.value, com_cap.value, prec.value, N_slider.value+2)\n",
    "    \n",
    "elif mgpu_flag.value == True:\n",
    "    \n",
    "    import numpy as np\n",
    "    import h5py\n",
    "    import os\n",
    "\n",
    "    import sys\n",
    "    \n",
    "    _p = os.getcwd()\n",
    "    \n",
    "    sys.path.append(_p + '/plot_scripts/')\n",
    "    from map_packages_colors_mgpu import *\n",
    "    from plot_scripts_mgpu import *\n",
    "    from plot_display_mgpu import *\n",
    "    \n",
    "    mr.Md(\"### Performance Benchmarks of quantum simulators using multiple GPUs\")\n",
    "    mr.Md(\"Options on the left include (please select only one):\")\n",
    "    mr.Md(\"- Compare all: Compare the TtS of all packages and also the performance relative to a given package\")\n",
    "    mr.Md(\"- Scaling with N GPUs: Compare the TtS with respect to different number of GPUs and also the relative performace with respect to a given number of GPUs\")\n",
    "    \n",
    "    gpu_all_flag = mr.Checkbox(value=False, label=\"Compare all\")\n",
    "    ngpu_flag = mr.Checkbox(value=False, label=\"Scaling with N GPUs\")\n",
    "\n",
    "    if gpu_all_flag.value == True and ngpu_flag.value == True:\n",
    "        mr.Md(\"### Performance Benchmarks of quantum simulators using multiple GPUs\")\n",
    "        mr.Md(\"Options on the left include (please select only one):\")\n",
    "        mr.Md(\"- Compare all: Compare the TtS of all packages and also the performance relative to a given package\")\n",
    "        mr.Md(\"- Scaling with N GPUs: Compare the TtS with respect to different number of GPUs and also the relative performace with respect to a given number of GPUs\")\n",
    "    \n",
    "    elif gpu_all_flag.value == True:\n",
    "        \n",
    "        task = mr.Select(label=\"Select Task:\", value=\"Heisenberg dynamics\", choices=[\"Heisenberg dynamics\", \"Random Quantum Circuit\", \"Quantum Fourier Transform\"])\n",
    "        prec = mr.Select(label=\"Select Precision:\", value=\"Single\", choices=[\"Single\", \"Double\"])\n",
    "        n_gpu = mr.Select(label=\"Select no. of GPUs:\", value=1, choices=[1, 2, 4, 8])\n",
    "        \n",
    "        compare_to = mr.Select(label=\"Select package to compare to:\", choices=[\"cuquantum_qiskit\", \"cuquantum_qsimcirq\", \"qibojit\"])\n",
    "\n",
    "        # if task.value == \"Heisenberg dynamics\" or task.value == \"Quantum Fourier Transform\":\n",
    "        #     N_slider = mr.Slider(value=36, min=6, max=36, label=\"Select System size: \", step=2)\n",
    "        # elif task.value == \"Random Quantum Circuit\":\n",
    "        #     N_slider = mr.Slider(value=N_slider.value, min=12, max=36, label=\"Select System size: \", step=2)\n",
    "\n",
    "        N_slider = mr.Slider(value=36, min=6, max=36, label=\"Select System size: \", step=2)\n",
    "        if task.value == \"Random Quantum Circuit\" and N_slider.value < 12:\n",
    "            print(\"Please select a different final N value\")\n",
    "        else:\n",
    "            abs_time(task.value, prec.value, n_gpu.value, compare_to.value, N_slider.value+2)\n",
    "        \n",
    "        \n",
    "    elif ngpu_flag.value == True:\n",
    "        pack = mr.Select(label=\"Select package:\", value=\"cuquantum_qiskit\", choices=[\"cuquantum_qiskit\", \"cuquantum_qsimcirq\", \"qibojit\"])\n",
    "        task = mr.Select(label=\"Select Task:\", value=\"Heisenberg dynamics\", choices=[\"Heisenberg dynamics\", \"Random Quantum Circuit\", \"Quantum Fourier Transform\"])\n",
    "        prec = mr.Select(label=\"Select Precision:\", value=\"Single\", choices=[\"Single\", \"Double\"])\n",
    "        \n",
    "        compare_n_gpu = mr.Select(label=\"Compare to no. of GPUs:\", value=1, choices=[1, 2, 4, 8])\n",
    "\n",
    "        # if task.value == \"Heisenberg dynamics\" or task.value == \"Quantum Fourier Transform\":\n",
    "        #     N_slider = mr.Slider(value=36, min=6, max=36, label=\"Select System size: \", step=2)\n",
    "        # elif task.value == \"Random Quantum Circuit\":\n",
    "        #     N_slider = mr.Slider(value=N_slider.value, min=12, max=36, label=\"Select System size: \", step=2)\n",
    "        \n",
    "        N_slider = mr.Slider(value=36, min=6, max=36, label=\"Select System size: \", step=2)\n",
    "        if task.value == \"Random Quantum Circuit\" and N_slider.value < 12:\n",
    "            print(\"Please select a different final N value\")\n",
    "        else:\n",
    "            abs_time_ngpus(task.value, prec.value, pack.value, compare_n_gpu.value, N_slider.value+2)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e41b2e81",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}