|
899 | 899 | "constraints = Constraints(max_width=num_qubits)\n", |
900 | 900 | "qmod = set_constraints(qmod, constraints)\n", |
901 | 901 | "qmod = set_preferences(qmod, preferences)\n", |
902 | | - "qprog = await synthesize_async(qmod)" |
| 902 | + "qprog = synthesize(qmod)" |
903 | 903 | ] |
904 | 904 | }, |
905 | 905 | { |
|
921 | 921 | }, |
922 | 922 | "outputs": [], |
923 | 923 | "source": [ |
924 | | - "res_proposed = await execute_async(qprog)" |
| 924 | + "res_proposed = execute(qprog)" |
925 | 925 | ] |
926 | 926 | }, |
927 | 927 | { |
|
958 | 958 | "source": [ |
959 | 959 | "# Collected job data by id\n", |
960 | 960 | "print(\"Job ID:\", res_proposed.id)\n", |
961 | | - "restored_job_proposed = await ExecutionJob.from_id_async(res_proposed.id)\n", |
| 961 | + "restored_job_proposed = ExecutionJob.from_id(res_proposed.id)\n", |
962 | 962 | "print(restored_job_proposed.status)" |
963 | 963 | ] |
964 | 964 | }, |
|
981 | 981 | }, |
982 | 982 | "outputs": [], |
983 | 983 | "source": [ |
984 | | - "result_proposed = await restored_job_proposed.result_async()" |
| 984 | + "result_proposed = restored_job_proposed.result()" |
985 | 985 | ] |
986 | 986 | }, |
987 | 987 | { |
|
1294 | 1294 | "constraints = Constraints(max_width=num_qubits) #, optimization_parameter=OptimizationParameter.WIDTH\n", |
1295 | 1295 | "qmod = set_constraints(qmod, constraints)\n", |
1296 | 1296 | "qmod = set_preferences(qmod, preferences)\n", |
1297 | | - "qprog = await synthesize_async(qmod)" |
| 1297 | + "qprog = synthesize(qmod)" |
1298 | 1298 | ] |
1299 | 1299 | }, |
1300 | 1300 | { |
|
1306 | 1306 | }, |
1307 | 1307 | "outputs": [], |
1308 | 1308 | "source": [ |
1309 | | - "res_trotter = await execute_async(qprog)" |
| 1309 | + "res_trotter = execute(qprog)" |
1310 | 1310 | ] |
1311 | 1311 | }, |
1312 | 1312 | { |
|
1343 | 1343 | "source": [ |
1344 | 1344 | "# Collected job data by id\n", |
1345 | 1345 | "print(\"Job ID:\", res_trotter.id)\n", |
1346 | | - "restored_job_trotter = await ExecutionJob.from_id_async(res_trotter.id)\n", |
| 1346 | + "restored_job_trotter = ExecutionJob.from_id(res_trotter.id)\n", |
1347 | 1347 | "print(restored_job_trotter.status)" |
1348 | 1348 | ] |
1349 | 1349 | }, |
|
1366 | 1366 | }, |
1367 | 1367 | "outputs": [], |
1368 | 1368 | "source": [ |
1369 | | - "result_trotter = await res_trotter.result_async()" |
| 1369 | + "result_trotter = res_trotter.result()" |
1370 | 1370 | ] |
1371 | 1371 | }, |
1372 | 1372 | { |
|
1713 | 1713 | "constraints = Constraints(max_width=num_qubits)\n", |
1714 | 1714 | "qmod = set_constraints(qmod, constraints)\n", |
1715 | 1715 | "qmod = set_preferences(qmod, preferences)\n", |
1716 | | - "qprog = await synthesize_async(qmod)\n", |
| 1716 | + "qprog = synthesize(qmod)\n", |
1717 | 1717 | "# show(qprog)" |
1718 | 1718 | ] |
1719 | 1719 | }, |
|
1726 | 1726 | }, |
1727 | 1727 | "outputs": [], |
1728 | 1728 | "source": [ |
1729 | | - "res_proposed_custom = await execute_async(qprog)" |
| 1729 | + "res_proposed_custom = execute(qprog)" |
1730 | 1730 | ] |
1731 | 1731 | }, |
1732 | 1732 | { |
|
1763 | 1763 | "source": [ |
1764 | 1764 | "# Collected job data by id\n", |
1765 | 1765 | "print(\"Job ID:\", res_proposed_custom.id)\n", |
1766 | | - "restored_job_proposed_custom = await ExecutionJob.from_id_async(res_proposed_custom.id)\n", |
| 1766 | + "restored_job_proposed_custom = ExecutionJob.from_id(res_proposed_custom.id)\n", |
1767 | 1767 | "print(restored_job_proposed_custom.status)" |
1768 | 1768 | ] |
1769 | 1769 | }, |
|
1786 | 1786 | }, |
1787 | 1787 | "outputs": [], |
1788 | 1788 | "source": [ |
1789 | | - "result_proposed_custom = await res_proposed_custom.result_async()" |
| 1789 | + "result_proposed_custom = res_proposed_custom.result()" |
1790 | 1790 | ] |
1791 | 1791 | }, |
1792 | 1792 | { |
|
2083 | 2083 | " return main\n", |
2084 | 2084 | "\n", |
2085 | 2085 | "# Function to synthesize circuit and collect CX count and depth\n", |
2086 | | - "async def synthesize_and_collect(main, num_qubits):\n", |
| 2086 | + "def synthesize_and_collect(main, num_qubits):\n", |
2087 | 2087 | " # Define and synthesize model\n", |
2088 | 2088 | " qmod = create_model(main, execution_preferences=ExecutionPreferences(num_shots=1, backend_preferences=backend_preferences))\n", |
2089 | 2089 | " qmod = set_constraints(qmod, Constraints(max_width=num_qubits))\n", |
2090 | 2090 | " qmod = set_preferences(qmod, preferences)\n", |
2091 | | - " qprog = await synthesize_async(qmod)\n", |
| 2091 | + " qprog = synthesize(qmod)\n", |
2092 | 2092 | "\n", |
2093 | 2093 | " # Extract CX count and depth from synthesized circuit\n", |
2094 | 2094 | " circuit = QuantumProgram.from_qprog(qprog)\n", |
|
2155 | 2155 | " main = v_operator(num_qubits, steps)\n", |
2156 | 2156 | "\n", |
2157 | 2157 | " # Collect data for V-circuit\n", |
2158 | | - " cx_count = await synthesize_and_collect(main, num_qubits)\n", |
| 2158 | + " cx_count = synthesize_and_collect(main, num_qubits)\n", |
2159 | 2159 | " cx_counts_proposed.append(cx_count)\n", |
2160 | 2160 | "\n", |
2161 | 2161 | " main = v_operator_custom(num_qubits, steps)\n", |
2162 | 2162 | "\n", |
2163 | 2163 | " # Collect data for V-circuit\n", |
2164 | | - " cx_count = await synthesize_and_collect(main, num_qubits)\n", |
| 2164 | + " cx_count = synthesize_and_collect(main, num_qubits)\n", |
2165 | 2165 | " cx_counts_proposed_custom.append(cx_count)\n", |
2166 | 2166 | "\n", |
2167 | 2167 | " # Define Suzuki-Trotter quantum function\n", |
2168 | 2168 | " main = suzuki_trotter_step(num_qubits, steps)\n", |
2169 | 2169 | "\n", |
2170 | 2170 | " # Collect data for Trotter-circuit\n", |
2171 | | - " cx_count = await synthesize_and_collect(main, num_qubits)\n", |
| 2171 | + " cx_count = synthesize_and_collect(main, num_qubits)\n", |
2172 | 2172 | " cx_counts_trotter.append(cx_count)\n", |
2173 | 2173 | "\n", |
2174 | 2174 | "qubits_analysis_results= {\n", |
|
2388 | 2388 | " main = v_operator(num_qubits, steps)\n", |
2389 | 2389 | "\n", |
2390 | 2390 | " # Collect data for V-circuit\n", |
2391 | | - " cx_count = await synthesize_and_collect(main, num_qubits)\n", |
| 2391 | + " cx_count = synthesize_and_collect(main, num_qubits)\n", |
2392 | 2392 | " cx_counts_proposed.append(cx_count)\n", |
2393 | 2393 | "\n", |
2394 | 2394 | " main = v_operator_custom(num_qubits, steps)\n", |
2395 | 2395 | "\n", |
2396 | 2396 | " # Collect data for V-circuit\n", |
2397 | | - " cx_count = await synthesize_and_collect(main, num_qubits)\n", |
| 2397 | + " cx_count = synthesize_and_collect(main, num_qubits)\n", |
2398 | 2398 | " cx_counts_proposed_custom.append(cx_count)\n", |
2399 | 2399 | "\n", |
2400 | 2400 | " # Define Suzuki-Trotter quantum function\n", |
2401 | 2401 | " main = suzuki_trotter_step(num_qubits, steps)\n", |
2402 | 2402 | "\n", |
2403 | 2403 | " # Collect data for Trotter-circuit\n", |
2404 | | - " cx_count = await synthesize_and_collect(main, num_qubits)\n", |
| 2404 | + " cx_count = synthesize_and_collect(main, num_qubits)\n", |
2405 | 2405 | " cx_counts_trotter.append(cx_count)\n", |
2406 | 2406 | "\n", |
2407 | 2407 | "step_analysis_results = {\n", |
|
2479 | 2479 | "provenance": [] |
2480 | 2480 | }, |
2481 | 2481 | "kernelspec": { |
2482 | | - "display_name": "Python 3", |
| 2482 | + "display_name": "Python 3 (ipykernel)", |
2483 | 2483 | "language": "python", |
2484 | 2484 | "name": "python3" |
2485 | 2485 | }, |
|
2493 | 2493 | "name": "python", |
2494 | 2494 | "nbconvert_exporter": "python", |
2495 | 2495 | "pygments_lexer": "ipython3", |
2496 | | - "version": "3.10.1" |
| 2496 | + "version": "3.11.7" |
2497 | 2497 | } |
2498 | 2498 | }, |
2499 | 2499 | "nbformat": 4, |
|
0 commit comments