Spaces:
Runtime error
Runtime error
File size: 19,961 Bytes
f415c73 56fab60 f415c73 aac0cfe f415c73 56fab60 f415c73 aac0cfe f415c73 aac0cfe f415c73 aac0cfe f415c73 aac0cfe f415c73 aac0cfe f415c73 aac0cfe f415c73 aac0cfe f415c73 aac0cfe f415c73 aac0cfe f415c73 aac0cfe f415c73 aac0cfe f415c73 aac0cfe f415c73 aac0cfe f415c73 aac0cfe f415c73 aac0cfe f415c73 aac0cfe f415c73 aac0cfe f415c73 aac0cfe f415c73 aac0cfe f415c73 aac0cfe f415c73 aac0cfe f415c73 aac0cfe f415c73 aac0cfe 56fab60 aac0cfe 00054e0 f415c73 aac0cfe f415c73 aac0cfe f415c73 2dd4184 f415c73 00054e0 aac0cfe 00054e0 aac0cfe f415c73 00054e0 f415c73 aac0cfe f415c73 aac0cfe f415c73 2dd4184 f415c73 2dd4184 f415c73 00054e0 aac0cfe 00054e0 aac0cfe 00054e0 aac0cfe 00054e0 f415c73 aac0cfe f415c73 aac0cfe f415c73 00054e0 aac0cfe 00054e0 f415c73 aac0cfe f415c73 aac0cfe 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 |
{
"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-rand1f48ec37\"\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\": \"2073b2d0f53c4be78e4c863f62e80b56\",\n \"code_uid\": \"Checkbox.0.40.11.1-rand5d2df859\",\n \"url_key\": \"\",\n \"disabled\": false,\n \"hidden\": false\n}",
"application/vnd.jupyter.widget-view+json": {
"model_id": "2073b2d0f53c4be78e4c863f62e80b56",
"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 1 vs 1\",\n \"model_id\": \"eefa42462b9546a78db57d8309ac8ea8\",\n \"code_uid\": \"Checkbox.0.40.11.2-rand2b41d5cc\",\n \"url_key\": \"\",\n \"disabled\": false,\n \"hidden\": false\n}",
"application/vnd.jupyter.widget-view+json": {
"model_id": "eefa42462b9546a78db57d8309ac8ea8",
"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\": \"eb82bc25d2374bfd9144f0f4488e3a8b\",\n \"code_uid\": \"Checkbox.0.40.11.3-randc061c203\",\n \"url_key\": \"\",\n \"disabled\": false,\n \"hidden\": false\n}",
"application/vnd.jupyter.widget-view+json": {
"model_id": "eb82bc25d2374bfd9144f0f4488e3a8b",
"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\": \"d1fe855e04f742b78eda6f1ed98fb418\",\n \"code_uid\": \"Checkbox.0.40.11.4-rand17d5047e\",\n \"url_key\": \"\",\n \"disabled\": false,\n \"hidden\": false\n}",
"application/vnd.jupyter.widget-view+json": {
"model_id": "d1fe855e04f742b78eda6f1ed98fb418",
"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",
"ovo_flag = mr.Checkbox(value=False, label=\"Compare 1 vs 1\")\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 1 vs 1: 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, 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 1 vs 1: 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",
" import sys\n",
" sys.path.append('/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'])\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 ovo_flag.value == True:\n",
" \n",
" import numpy as np\n",
" import h5py\n",
" import os\n",
"\n",
" import sys\n",
" sys.path.append('/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'])\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'])\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",
" sys.path.append('/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",
" sys.path.append('/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
}
|