{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Running germ selection on multiple processors\n", "The code below should be put into a script and run using mpiexec. It's primary function is to pass a MPI Comm object to `pygsti.algorithms.germselection.build_up_breadth`." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "201 available germs\n", "Starting germ set optimization. Lower score is better.\n", "Memory estimate of 13.6 GB (0.5 GB limit) for all-Jac mode.\n", "Memory estimate of 0.2 GB (0.5 GB limit) for single-Jac mode.\n", " Initial germ set computation Iter 1 of 6 []: \n", " Initial germ set computation Iter 2 of 6 Gxpi2:1@(1): \n", " Initial germ set computation Iter 3 of 6 Gypi2:1@(1): \n", " Initial germ set computation Iter 4 of 6 Gxpi2:0@(0): \n", " Initial germ set computation Iter 5 of 6 Gypi2:0@(0): \n", " Initial germ set computation Iter 6 of 6 Gcnot:0:1@(0,1): \n", " Outer iteration: 1 of 1282 amplified, 6 germs\n", " Inner iter over candidate germs Iter 001 of 195 []Gxpi2:1@(1): \n", " Score: major=-114.0 minor=275.7550232560745, N: 194\n", " Inner iter over candidate germs Iter 002 of 195 []Gypi2:1@(1): \n", " Score: major=-114.0 minor=275.75224428270747, N: 194\n", " Inner iter over candidate germs Iter 003 of 195 []Gxpi2:0@(0): \n", " Score: major=-114.0 minor=303.1298571245501, N: 194\n", " Inner iter over candidate germs Iter 004 of 195 []Gypi2:0@(0): \n", " Score: major=-114.0 minor=359.3300959231143, N: 194\n", " Inner iter over candidate germs Iter 005 of 195 []Gcnot:0:1@(0,1): \n", " Score: major=-114.0 minor=276.26872683842305, N: 194\n", " Inner iter over candidate germs Iter 006 of 195 Gxpi2:1Gypi2:1@(1): \n", " Score: major=-114.0 minor=257.44268978798533, N: 194\n", " Inner iter over candidate germs Iter 007 of 195 Gxpi2:1Gxpi2:0@(0,1): \n", " Score: major=-114.0 minor=341.5696468598087, N: 194\n", " Inner iter over candidate germs Iter 008 of 195 Gxpi2:1Gypi2:0@(0,1): \n", " Score: major=-114.0 minor=282.3386744924079, N: 194\n", " Inner iter over candidate germs Iter 009 of 195 Gxpi2:1Gcnot:0:1@(0,1): \n", " Score: major=-114.0 minor=577.5866443200775, N: 194\n", " Inner iter over candidate germs Iter 010 of 195 Gypi2:1Gxpi2:0@(0,1): \n", " Score: major=-114.0 minor=294.8087354034736, N: 194\n", " Inner iter over candidate germs Iter 011 of 195 Gypi2:1Gypi2:0@(0,1): \n", " Score: major=-114.0 minor=274.0138812045365, N: 194\n", " Inner iter over candidate germs Iter 012 of 195 Gypi2:1Gcnot:0:1@(0,1): \n", " Score: major=-114.0 minor=292.41877705096067, N: 194\n", " Inner iter over candidate germs Iter 013 of 195 Gxpi2:0Gypi2:0@(0): \n", " Score: major=-114.0 minor=257.1446980861656, N: 194\n", " Inner iter over candidate germs Iter 014 of 195 Gxpi2:0Gcnot:0:1@(0,1): \n", " Score: major=-114.0 minor=295.1901473400699, N: 194\n", " Inner iter over candidate germs Iter 015 of 195 Gypi2:0Gcnot:0:1@(0,1): \n", " Score: major=-114.0 minor=262.24440122325325, N: 194\n", " Inner iter over candidate germs Iter 016 of 195 [][]Gxpi2:1@(1): \n", " Score: major=-104.0 minor=245.73088449107442, N: 194\n", " Inner iter over candidate germs Iter 017 of 195 [][]Gypi2:1@(1): \n", " Score: major=-104.0 minor=236.10434931549207, N: 194\n", " Inner iter over candidate germs Iter 018 of 195 [][]Gxpi2:0@(0): \n", " Score: major=-104.0 minor=257.48113898508376, N: 194\n", " Inner iter over candidate germs Iter 019 of 195 [][]Gypi2:0@(0): \n", " Score: major=-104.0 minor=295.32017448143483, N: 194\n", " Inner iter over candidate germs Iter 020 of 195 [][]Gcnot:0:1@(0,1): \n", " Score: major=-104.0 minor=274.6074087087524, N: 194\n", " Inner iter over candidate germs Iter 021 of 195 []Gxpi2:1Gxpi2:1@(1): \n", " Score: major=-104.0 minor=453.2493918611687, N: 194\n", " Inner iter over candidate germs Iter 022 of 195 []Gxpi2:1Gypi2:1@(1): \n", " Score: major=-104.0 minor=275.15640639818963, N: 194\n", " Inner iter over candidate germs Iter 023 of 195 []Gxpi2:1Gxpi2:0@(0,1): \n", " Score: major=-104.0 minor=304.47418773769374, N: 194\n", " Inner iter over candidate germs Iter 024 of 195 []Gxpi2:1Gypi2:0@(0,1): \n", " Score: major=-104.0 minor=278.4412022818791, N: 194\n", " Inner iter over candidate germs Iter 025 of 195 []Gxpi2:1Gcnot:0:1@(0,1): \n", " Score: major=-104.0 minor=352.1721810679956, N: 194\n", " Inner iter over candidate germs Iter 026 of 195 []Gypi2:1Gxpi2:1@(1): \n", " Score: major=-104.0 minor=266.5702087056308, N: 194\n", " Inner iter over candidate germs Iter 027 of 195 []Gypi2:1Gypi2:1@(1): \n", " Score: major=-104.0 minor=448.32104717481405, N: 194\n", " Inner iter over candidate germs Iter 028 of 195 []Gypi2:1Gxpi2:0@(0,1): \n", " Score: major=-104.0 minor=297.33168248045934, N: 194\n", " Inner iter over candidate germs Iter 029 of 195 []Gypi2:1Gypi2:0@(0,1): \n", " Score: major=-104.0 minor=283.54615357575045, N: 194\n", " Inner iter over candidate germs Iter 030 of 195 []Gypi2:1Gcnot:0:1@(0,1): \n", " Score: major=-104.0 minor=297.1285459219351, N: 194\n", " Inner iter over candidate germs Iter 031 of 195 []Gxpi2:0Gxpi2:1@(0,1): \n", " Score: major=-104.0 minor=307.7119918376184, N: 194\n", " Inner iter over candidate germs Iter 032 of 195 []Gxpi2:0Gypi2:1@(0,1): \n", " Score: major=-104.0 minor=307.76748417238855, N: 194\n", " Inner iter over candidate germs Iter 033 of 195 []Gxpi2:0Gxpi2:0@(0): \n", " Score: major=-104.0 minor=410.09882553443566, N: 194\n", " Inner iter over candidate germs Iter 034 of 195 []Gxpi2:0Gypi2:0@(0): \n", " Score: major=-104.0 minor=284.31530927417276, N: 194\n", " Inner iter over candidate germs Iter 035 of 195 []Gxpi2:0Gcnot:0:1@(0,1): \n", " Score: major=-104.0 minor=303.81022808541616, N: 194\n", " Inner iter over candidate germs Iter 036 of 195 []Gypi2:0Gxpi2:1@(0,1): \n", " Score: major=-104.0 minor=283.5892520489326, N: 194\n", " Inner iter over candidate germs Iter 037 of 195 []Gypi2:0Gypi2:1@(0,1): \n", " Score: major=-104.0 minor=283.32262065091953, N: 194\n", " Inner iter over candidate germs Iter 038 of 195 []Gypi2:0Gxpi2:0@(0): \n", " Score: major=-104.0 minor=273.5504913809553, N: 194\n", " Inner iter over candidate germs Iter 039 of 195 []Gypi2:0Gypi2:0@(0): \n", " Score: major=-104.0 minor=563.1049081487057, N: 194\n", " Inner iter over candidate germs Iter 040 of 195 []Gypi2:0Gcnot:0:1@(0,1): \n", " Score: major=-104.0 minor=277.18869907206346, N: 194\n", " Inner iter over candidate germs Iter 041 of 195 []Gcnot:0:1Gxpi2:1@(0,1): \n", " Score: major=-104.0 minor=352.33178100632784, N: 194\n", " Inner iter over candidate germs Iter 042 of 195 []Gcnot:0:1Gypi2:1@(0,1): \n", " Score: major=-104.0 minor=298.1019089981338, N: 194\n", " Inner iter over candidate germs Iter 043 of 195 []Gcnot:0:1Gxpi2:0@(0,1): \n", " Score: major=-104.0 minor=309.6778947901512, N: 194\n", " Inner iter over candidate germs Iter 044 of 195 []Gcnot:0:1Gypi2:0@(0,1): \n", " Score: major=-104.0 minor=279.3478112644737, N: 194\n", " Inner iter over candidate germs Iter 045 of 195 []Gcnot:0:1Gcnot:0:1@(0,1): \n", " Score: major=-104.0 minor=375.6548612782148, N: 194\n", " Inner iter over candidate germs Iter 046 of 195 Gxpi2:1Gxpi2:1Gypi2:1@(1): \n", " Score: major=-104.0 minor=327.9840714902062, N: 194\n", " Inner iter over candidate germs Iter 047 of 195 Gxpi2:1Gxpi2:1Gxpi2:0@(0,1): \n", " Score: major=-104.0 minor=755.1272055918788, N: 194\n", " Inner iter over candidate germs Iter 048 of 195 Gxpi2:1Gxpi2:1Gypi2:0@(0,1): \n", " Score: major=-104.0 minor=362.9793447859555, N: 194\n", " Inner iter over candidate germs Iter 049 of 195 Gxpi2:1Gxpi2:1Gcnot:0:1@(0,1): \n", " Score: major=-104.0 minor=532.4198103374404, N: 194\n", " Inner iter over candidate germs Iter 050 of 195 Gxpi2:1Gypi2:1Gypi2:1@(1): \n", " Score: major=-104.0 minor=293.57122809494854, N: 194\n", " Inner iter over candidate germs Iter 051 of 195 Gxpi2:1Gypi2:1Gxpi2:0@(0,1): \n", " Score: major=-104.0 minor=313.06071440109895, N: 194\n", " Inner iter over candidate germs Iter 052 of 195 Gxpi2:1Gypi2:1Gypi2:0@(0,1): \n", " Score: major=-104.0 minor=291.50473798603366, N: 194\n", " Inner iter over candidate germs Iter 053 of 195 Gxpi2:1Gypi2:1Gcnot:0:1@(0,1): \n", " Score: major=-104.0 minor=284.2173572664502, N: 194\n", " Inner iter over candidate germs Iter 054 of 195 Gxpi2:1Gxpi2:0Gypi2:1@(0,1): \n", " Score: major=-104.0 minor=319.0891517686079, N: 194\n", " Inner iter over candidate germs Iter 055 of 195 Gxpi2:1Gxpi2:0Gxpi2:0@(0,1): \n", " Score: major=-104.0 minor=540.3153010508673, N: 194\n", " Inner iter over candidate germs Iter 056 of 195 Gxpi2:1Gxpi2:0Gypi2:0@(0,1): \n", " Score: major=-104.0 minor=336.7157072810016, N: 194\n", " Inner iter over candidate germs Iter 057 of 195 Gxpi2:1Gxpi2:0Gcnot:0:1@(0,1): \n" ] }, { "name": "stdout", "output_type": "stream", "text": [ " Score: major=-104.0 minor=372.19137704629935, N: 194\n", " Inner iter over candidate germs Iter 058 of 195 Gxpi2:1Gypi2:0Gypi2:1@(0,1): \n", " Score: major=-104.0 minor=274.6695769231828, N: 194\n", " Inner iter over candidate germs Iter 059 of 195 Gxpi2:1Gypi2:0Gxpi2:0@(0,1): \n", " Score: major=-104.0 minor=350.2809681409079, N: 194\n", " Inner iter over candidate germs Iter 060 of 195 Gxpi2:1Gypi2:0Gypi2:0@(0,1): \n", " Score: major=-104.0 minor=383.2242705593405, N: 194\n", " Inner iter over candidate germs Iter 061 of 195 Gxpi2:1Gypi2:0Gcnot:0:1@(0,1): \n", " Score: major=-104.0 minor=321.65875931184166, N: 194\n", " Inner iter over candidate germs Iter 062 of 195 Gxpi2:1Gcnot:0:1Gypi2:1@(0,1): \n", " Score: major=-104.0 minor=290.1508560166754, N: 194\n", " Inner iter over candidate germs Iter 063 of 195 Gxpi2:1Gcnot:0:1Gxpi2:0@(0,1): \n", " Score: major=-104.0 minor=360.7166056237831, N: 194\n", " Inner iter over candidate germs Iter 064 of 195 Gxpi2:1Gcnot:0:1Gypi2:0@(0,1): \n", " Score: major=-104.0 minor=308.89004813899106, N: 194\n", " Inner iter over candidate germs Iter 065 of 195 Gxpi2:1Gcnot:0:1Gcnot:0:1@(0,1): \n", " Score: major=-104.0 minor=3769.118016248736, N: 194\n", " Inner iter over candidate germs Iter 066 of 195 Gypi2:1Gypi2:1Gxpi2:0@(0,1): \n", " Score: major=-104.0 minor=452.76438995248947, N: 194\n", " Inner iter over candidate germs Iter 067 of 195 Gypi2:1Gypi2:1Gypi2:0@(0,1): \n", " Score: major=-104.0 minor=374.97038589168767, N: 194\n", " Inner iter over candidate germs Iter 068 of 195 Gypi2:1Gypi2:1Gcnot:0:1@(0,1): \n", " Score: major=-104.0 minor=331.36628515748606, N: 194\n", " Inner iter over candidate germs Iter 069 of 195 Gypi2:1Gxpi2:0Gxpi2:0@(0,1): \n", " Score: major=-104.0 minor=405.6819678323596, N: 194\n", " Inner iter over candidate germs Iter 070 of 195 Gypi2:1Gxpi2:0Gypi2:0@(0,1): \n", " Score: major=-104.0 minor=301.88793301304685, N: 194\n", " Inner iter over candidate germs Iter 071 of 195 Gypi2:1Gxpi2:0Gcnot:0:1@(0,1): \n", " Score: major=-104.0 minor=263.8903625336472, N: 194\n", " Inner iter over candidate germs Iter 072 of 195 Gypi2:1Gypi2:0Gxpi2:0@(0,1): \n", " Score: major=-104.0 minor=294.9421892854783, N: 194\n", " Inner iter over candidate germs Iter 073 of 195 Gypi2:1Gypi2:0Gypi2:0@(0,1): \n", " Score: major=-104.0 minor=375.6699554342841, N: 194\n", " Inner iter over candidate germs Iter 074 of 195 Gypi2:1Gypi2:0Gcnot:0:1@(0,1): \n", " Score: major=-104.0 minor=271.07584551340045, N: 194\n", " Inner iter over candidate germs Iter 075 of 195 Gypi2:1Gcnot:0:1Gxpi2:0@(0,1): \n", " Score: major=-104.0 minor=267.74637805153014, N: 194\n", " Inner iter over candidate germs Iter 076 of 195 Gypi2:1Gcnot:0:1Gypi2:0@(0,1): \n", " Score: major=-104.0 minor=262.38089131433793, N: 194\n", " Inner iter over candidate germs Iter 077 of 195 Gypi2:1Gcnot:0:1Gcnot:0:1@(0,1): \n", " Score: major=-104.0 minor=908.7073076764702, N: 194\n", " Inner iter over candidate germs Iter 078 of 195 Gxpi2:0Gxpi2:0Gypi2:0@(0): \n", " Score: major=-104.0 minor=295.2464245465815, N: 194\n", " Inner iter over candidate germs Iter 079 of 195 Gxpi2:0Gxpi2:0Gcnot:0:1@(0,1): \n", " Score: major=-104.0 minor=362.20948155218986, N: 194\n", " Inner iter over candidate germs Iter 080 of 195 Gxpi2:0Gypi2:0Gypi2:0@(0): \n", " Score: major=-104.0 minor=308.6963511258916, N: 194\n", " Inner iter over candidate germs Iter 081 of 195 Gxpi2:0Gypi2:0Gcnot:0:1@(0,1): \n", " Score: major=-104.0 minor=291.8901699683328, N: 194\n", " Inner iter over candidate germs Iter 082 of 195 Gxpi2:0Gcnot:0:1Gypi2:0@(0,1): \n", " Score: major=-104.0 minor=295.8368173452585, N: 194\n", " Inner iter over candidate germs Iter 083 of 195 Gxpi2:0Gcnot:0:1Gcnot:0:1@(0,1): \n", " Score: major=-104.0 minor=403.68705147623916, N: 194\n", " Inner iter over candidate germs Iter 084 of 195 Gypi2:0Gypi2:0Gcnot:0:1@(0,1): \n", " Score: major=-104.0 minor=298.6783305816109, N: 194\n", " Inner iter over candidate germs Iter 085 of 195 Gypi2:0Gcnot:0:1Gcnot:0:1@(0,1): \n", " Score: major=-104.0 minor=374.60451320307124, N: 194\n", " Inner iter over candidate germs Iter 086 of 195 Gxpi2:1Gcnot:0:1Gxpi2:1Gcnot:0:1@(0,1): \n", " Score: major=-94.0 minor=577.5866443200753, N: 194\n", " Inner iter over candidate germs Iter 087 of 195 Gypi2:1Gxpi2:0Gypi2:0Gxpi2:0@(0,1): \n", " Score: major=-94.0 minor=308.1769913484684, N: 194\n", " Inner iter over candidate germs Iter 088 of 195 Gxpi2:1Gxpi2:1[]Gypi2:0@(0,1): \n", " Score: major=-94.0 minor=320.5257398852357, N: 194\n", " Inner iter over candidate germs Iter 089 of 195 Gypi2:1[]Gcnot:0:1Gxpi2:1@(0,1): \n", " Score: major=-94.0 minor=316.4687253724785, N: 194\n", " Inner iter over candidate germs Iter 090 of 195 Gypi2:1Gxpi2:1Gxpi2:0Gxpi2:0@(0,1): \n", " Score: major=-94.0 minor=392.72591920193776, N: 194\n", " Inner iter over candidate germs Iter 091 of 195 Gxpi2:0Gxpi2:1Gxpi2:1Gxpi2:1@(0,1): \n", " Score: major=-94.0 minor=458.36678688321047, N: 194\n", " Inner iter over candidate germs Iter 092 of 195 Gxpi2:1[][]Gcnot:0:1@(0,1): \n", " Score: major=-94.0 minor=298.16427513311305, N: 194\n", " Inner iter over candidate germs Iter 093 of 195 Gcnot:0:1Gxpi2:1[]Gxpi2:1@(0,1): \n", " Score: major=-94.0 minor=397.3439198571364, N: 194\n", " Inner iter over candidate germs Iter 094 of 195 Gypi2:0Gypi2:0[]Gxpi2:0@(0): \n", " Score: major=-94.0 minor=351.3000547622185, N: 194\n", " Inner iter over candidate germs Iter 095 of 195 []Gxpi2:0Gxpi2:0Gcnot:0:1@(0,1): \n", " Score: major=-94.0 minor=362.9972334806268, N: 194\n", " Inner iter over candidate germs Iter 096 of 195 Gxpi2:1Gypi2:0Gcnot:0:1Gcnot:0:1@(0,1): \n", " Score: major=-94.0 minor=349.39188976936384, N: 194\n", " Inner iter over candidate germs Iter 097 of 195 []Gypi2:1Gcnot:0:1Gypi2:1@(0,1): \n", " Score: major=-94.0 minor=326.817006563793, N: 194\n", " Inner iter over candidate germs Iter 098 of 195 Gypi2:0Gxpi2:0Gypi2:0Gypi2:1@(0,1): \n", " Score: major=-94.0 minor=304.415548277781, N: 194\n", " Inner iter over candidate germs Iter 099 of 195 [][][]Gxpi2:1@(1): \n", " Score: major=-94.0 minor=238.79309659117357, N: 194\n", " Inner iter over candidate germs Iter 100 of 195 Gcnot:0:1Gxpi2:0Gypi2:0Gxpi2:0@(0,1): \n", " Score: major=-94.0 minor=338.52909855451645, N: 194\n", " Inner iter over candidate germs Iter 101 of 195 Gxpi2:0Gypi2:0Gcnot:0:1Gcnot:0:1@(0,1): \n", " Score: major=-94.0 minor=318.03784054681427, N: 194\n", " Inner iter over candidate germs Iter 102 of 195 Gypi2:0[]Gypi2:1[]@(0,1): \n", " Score: major=-94.0 minor=285.29173900315914, N: 194\n", " Inner iter over candidate germs Iter 103 of 195 Gxpi2:0Gypi2:0[]Gxpi2:1@(0,1): \n", " Score: major=-94.0 minor=331.88078535666125, N: 194\n", " Inner iter over candidate germs Iter 104 of 195 Gypi2:1Gxpi2:1Gypi2:0Gypi2:1@(0,1): \n", " Score: major=-94.0 minor=284.45425983306376, N: 194\n", " Inner iter over candidate germs Iter 105 of 195 Gxpi2:0Gypi2:1Gxpi2:0Gcnot:0:1@(0,1): \n", " Score: major=-94.0 minor=309.62766888700594, N: 194\n", " Inner iter over candidate germs Iter 106 of 195 Gcnot:0:1[]Gcnot:0:1Gypi2:1@(0,1): \n", " Score: major=-94.0 minor=411.6446140183919, N: 194\n", " Inner iter over candidate germs Iter 107 of 195 []Gypi2:1Gxpi2:0Gcnot:0:1@(0,1): \n", " Score: major=-94.0 minor=295.37137528505076, N: 194\n", " Inner iter over candidate germs Iter 108 of 195 Gypi2:1[]Gcnot:0:1[]@(0,1): \n" ] }, { "ename": "KeyboardInterrupt", "evalue": "", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 44\u001b[0m \u001b[0mseedStart\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;36m4\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 45\u001b[0m do_greedy_germsel(target_model, forced_germs, candidate_counts,\n\u001b[0;32m---> 46\u001b[0;31m seedStart, \"germs_EXAMPLE.pkl\", comm)\n\u001b[0m", "\u001b[0;32m\u001b[0m in \u001b[0;36mdo_greedy_germsel\u001b[0;34m(target_model, forced_germs, candidate_counts, seedStart, outFilename, comm)\u001b[0m\n\u001b[1;32m 30\u001b[0m \u001b[0mrandomizationStrength\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1e-3\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mnumCopies\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m3\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mseed\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1234\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 31\u001b[0m \u001b[0mopPenalty\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m10.0\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mscoreFunc\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'all'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtol\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1e-6\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mthreshold\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1e5\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 32\u001b[0;31m pretest=False, force=forced_germs, verbosity=5, comm=comm, memLimit=0.5*(1024**3))\n\u001b[0m\u001b[1;32m 33\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 34\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mcomm\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mcomm\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mGet_rank\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m~/pyGSTi/pygsti/algorithms/germselection.py\u001b[0m in \u001b[0;36mbuild_up_breadth\u001b[0;34m(modelList, germsList, randomize, randomizationStrength, numCopies, seed, opPenalty, scoreFunc, tol, threshold, check, force, pretest, memLimit, comm, profiler, verbosity)\u001b[0m\n\u001b[1;32m 1297\u001b[0m \u001b[0mmodel\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mmodelList\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mk\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1298\u001b[0m testDDD += calc_twirled_DDD(\n\u001b[0;32m-> 1299\u001b[0;31m model, germsList[candidateGermIdx], tol)\n\u001b[0m\u001b[1;32m 1300\u001b[0m \u001b[0;31m# (else already checked above)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1301\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m~/pyGSTi/pygsti/algorithms/germselection.py\u001b[0m in \u001b[0;36mcalc_twirled_DDD\u001b[0;34m(model, germ, eps)\u001b[0m\n\u001b[1;32m 498\u001b[0m \u001b[0;31m# twirledDeriv)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 499\u001b[0m twirledDerivDaggerDeriv = _np.tensordot(_np.conjugate(twirledDeriv),\n\u001b[0;32m--> 500\u001b[0;31m twirledDeriv, (0, 0))\n\u001b[0m\u001b[1;32m 501\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 502\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mtwirledDerivDaggerDeriv\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m/usr/local/lib/python3.7/site-packages/numpy/core/numeric.py\u001b[0m in \u001b[0;36mtensordot\u001b[0;34m(a, b, axes)\u001b[0m\n\u001b[1;32m 1312\u001b[0m \u001b[0mat\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0ma\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtranspose\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnewaxes_a\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreshape\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnewshape_a\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1313\u001b[0m \u001b[0mbt\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mb\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtranspose\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnewaxes_b\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreshape\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnewshape_b\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1314\u001b[0;31m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdot\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mat\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbt\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1315\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mres\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreshape\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0molda\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0moldb\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1316\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mKeyboardInterrupt\u001b[0m: " ] } ], "source": [ "from __future__ import print_function\n", "import time\n", "\n", "import pygsti\n", "import pygsti.construction as pc\n", "from pygsti.modelpacks import smq2Q_XYICNOT\n", "from pygsti.algorithms import germselection as germsel\n", "\n", "from mpi4py import MPI\n", "comm = MPI.COMM_WORLD\n", "\n", "def do_greedy_germsel(target_model, forced_germs, candidate_counts,\n", " seedStart, outFilename, comm):\n", " #candidate_counts is a dict of keys = germ lengths, values = # of germs at that length \n", "\n", " tStart = time.time()\n", "\n", " candidate_germs = []\n", " for i,(germLength, count) in enumerate(candidate_counts.items()):\n", " if count == \"all upto\":\n", " candidate_germs.extend( pc.list_all_circuits_without_powers_and_cycles(\n", " target_model.operations.keys(), maxLength=germLength) )\n", " else:\n", " candidate_germs.extend( pc.list_random_circuits_onelen(\n", " target_model.operations.keys(), germLength, count, seed=seedStart+i))\n", "\n", " available_germs = pygsti.tools.remove_duplicates( forced_germs + candidate_germs )\n", " print(\"%d available germs\" % len(available_germs))\n", " germs = germsel.build_up_breadth(target_model, available_germs,\n", " randomizationStrength=1e-3, numCopies=3, seed=1234,\n", " opPenalty=10.0, scoreFunc='all', tol=1e-6, threshold=1e5,\n", " pretest=False, force=forced_germs, verbosity=5, comm=comm, memLimit=0.5*(1024**3))\n", "\n", " if comm is None or comm.Get_rank() == 0:\n", " print(\"Germs (%d) = \\n\" % len(germs), \"\\n\".join(map(str,germs)))\n", " print(\"Total time = %mdl\" % (time.time()-tStart))\n", " pickle.dump(germs,open(outFilename,\"wb\"))\n", " return germs\n", " \n", "#2Q case \n", "target_model = smq2Q_XYICNOT.target_model()\n", "forced_germs = pygsti.construction.circuit_list([(gl,) for gl in target_model.operations.keys()]) #singletons \n", "candidate_counts = { 3:\"all upto\", 4:30, 5:20, 6:20, 7:20, 8:20} # germLength:num_candidates \n", "seedStart = 4\n", "do_greedy_germsel(target_model, forced_germs, candidate_counts,\n", " seedStart, \"germs_EXAMPLE.pkl\", comm)" ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "Above is **keyboard-interrupted on purpose**, as this output was produced with a single processor and it would have taken a very long time.\n" ] }, { "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.7.0" } }, "nbformat": 4, "nbformat_minor": 2 }