{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# QPU access time" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import random\n", "import dimod\n", "\n", "\n", "N = 50\n", "\n", "h = {}\n", "J = {(i, j): random.gauss(0, 1) for i in range(N) for j in range(i + 1, N)}\n", "\n", "bqm = dimod.BinaryQuadraticModel.from_ising(h, J)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "iteration: 0\n", "iteration: 1\n", "iteration: 2\n", "iteration: 3\n", "iteration: 4\n" ] } ], "source": [ "from dwave.system import DWaveSampler, EmbeddingComposite\n", "\n", "\n", "info_hists_dw2000q = []\n", "info_hists_dwadv = []\n", "for i in range(5):\n", " print('iteration:', i)\n", "\n", " dw2000q_sampler = EmbeddingComposite(DWaveSampler(profile='sigu-2000q'))\n", " dwadv_sampler = EmbeddingComposite(DWaveSampler(profile='sigu-adv'))\n", "\n", " sampleset_dw2000q = dw2000q_sampler.sample(bqm, num_reads=1000)\n", " sampleset_dwadv = dwadv_sampler.sample(bqm, num_reads=1000)\n", "\n", " info_hists_dw2000q.append(list(sampleset_dw2000q.info['timing'].values()))\n", " info_hists_dwadv.append(list(sampleset_dwadv.info['timing'].values()))" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
2000Q(mean)2000Q(std)Advantage(mean)Advantage(std)
qpu_sampling_time238940.00.000000128852.012294.425403
qpu_anneal_time_per_sample20.00.00000020.00.000000
qpu_readout_time_per_sample198.00.00000088.012.083046
qpu_access_time250181.614.263239154888.012294.912655
qpu_access_overhead_time6863.4424.893210129140.0140525.454538
qpu_programming_time11241.614.26323926036.03.633180
qpu_delay_time_per_sample21.00.00000021.00.000000
post_processing_overhead_time1921.6385.0613469138.83283.009802
total_post_processing_time5579.2457.483289294.0160.278508
total_real_time250181.614.263239154888.012294.912655
run_time_chip238940.00.000000128852.012294.425403
anneal_time_per_run20.00.00000020.00.000000
readout_time_per_run198.00.00000088.012.083046
\n", "
" ], "text/plain": [ " 2000Q(mean) 2000Q(std) Advantage(mean) \\\n", "qpu_sampling_time 238940.0 0.000000 128852.0 \n", "qpu_anneal_time_per_sample 20.0 0.000000 20.0 \n", "qpu_readout_time_per_sample 198.0 0.000000 88.0 \n", "qpu_access_time 250181.6 14.263239 154888.0 \n", "qpu_access_overhead_time 6863.4 424.893210 129140.0 \n", "qpu_programming_time 11241.6 14.263239 26036.0 \n", "qpu_delay_time_per_sample 21.0 0.000000 21.0 \n", "post_processing_overhead_time 1921.6 385.061346 9138.8 \n", "total_post_processing_time 5579.2 457.483289 294.0 \n", "total_real_time 250181.6 14.263239 154888.0 \n", "run_time_chip 238940.0 0.000000 128852.0 \n", "anneal_time_per_run 20.0 0.000000 20.0 \n", "readout_time_per_run 198.0 0.000000 88.0 \n", "\n", " Advantage(std) \n", "qpu_sampling_time 12294.425403 \n", "qpu_anneal_time_per_sample 0.000000 \n", "qpu_readout_time_per_sample 12.083046 \n", "qpu_access_time 12294.912655 \n", "qpu_access_overhead_time 140525.454538 \n", "qpu_programming_time 3.633180 \n", "qpu_delay_time_per_sample 0.000000 \n", "post_processing_overhead_time 3283.009802 \n", "total_post_processing_time 160.278508 \n", "total_real_time 12294.912655 \n", "run_time_chip 12294.425403 \n", "anneal_time_per_run 0.000000 \n", "readout_time_per_run 12.083046 " ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import numpy as np\n", "import pandas as pd\n", "\n", "\n", "timing_infos = {}\n", "timing_infos['2000Q(mean)'] = np.mean(info_hists_dw2000q, axis=0)\n", "timing_infos['2000Q(std)'] = np.std(info_hists_dw2000q, axis=0)\n", "timing_infos['Advantage(mean)'] = np.mean(info_hists_dwadv, axis=0)\n", "timing_infos['Advantage(std)'] = np.std(info_hists_dwadv, axis=0)\n", "\n", "index = sampleset_dw2000q.info['timing'].keys()\n", "df_timing_info = pd.DataFrame(timing_infos, index=index)\n", "df_timing_info" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[238940 20 198 250172 6316 11232 21 1378 5101 250172\n", " 238940 20 198]\n", " [238940 20 198 250193 6997 11253 21 2467 5326 250193\n", " 238940 20 198]\n", " [238940 20 198 250204 6592 11264 21 2163 6150 250204\n", " 238940 20 198]\n", " [238940 20 198 250170 6834 11230 21 1626 6115 250170\n", " 238940 20 198]\n", " [238940 20 198 250169 7578 11229 21 1974 5204 250169\n", " 238940 20 198]]\n" ] } ], "source": [ "print(np.array(info_hists_dw2000q))" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[130900 20 90 156942 23032 26042 21 14514 110 156942\n", " 130900 20 90]\n", " [108540 20 68 134572 8441 26032 21 4390 96 134572\n", " 108540 20 68]\n", " [122700 20 82 148738 332056 26038 21 9770 355 148738\n", " 122700 20 82]\n", " [139820 20 99 165855 15687 26035 21 9303 463 165855\n", " 139820 20 99]\n", " [142300 20 101 168333 266484 26033 21 7717 446 168333\n", " 142300 20 101]]\n" ] } ], "source": [ "print(np.array(info_hists_dwadv))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.1" } }, "nbformat": 4, "nbformat_minor": 4 }