You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ideally, a null.qubit device should be able to estimate resource requirements for a large-scale circuit (30Q+) measured with a Hamiltonian obs target at any wires.
Actual behavior
The following error message was thrown out when running a 29 qubit QAOA application with null.qubit: numpy._core._exceptions._ArrayMemoryError: Unable to allocate 256. PiB for an array with shape (134217728, 134217728) and data type complex128
Additional information
No response
Source code
import pennylane as qml
from pennylane import numpy as np
from typing import List, Optional, Tuple
import networkx as nx
def clustered_chain_graph(
n: int, r: int, k: int, q1: float, q2: float, seed: Optional[int] = None
) -> Tuple[nx.Graph, List[List[int]], List[List[int]]]:
""" Function to build clustered chain graph Args: n (int): number of nodes in each cluster r (int): number of clusters k (int): number of vertex separators between each cluster pair q1 (float): probability of an edge connecting any two nodes in a cluster q2 (float): probability of an edge connecting a vertex separator to any node in a cluster seed (Optional[int]=None): seed for fixing edge generation Returns: nx.Graph: clustered chain graph"""if r <= 0 or not isinstance(r, int):
raise ValueError("Number of clusters must be an integer greater than 0")
clusters = []
foriin range(r):
_seed = seed * i if seed is not None else None
cluster = nx.erdos_renyi_graph(n, q1, seed=_seed)
nx.set_node_attributes(cluster, f"cluster_{i}", "subgraph")
clusters.append(cluster)
separators = []
foriin range(r - 1):
separator = nx.empty_graph(k)
nx.set_node_attributes(separator, f"separator_{i}", "subgraph")
separators.append(separator)
G = nx.disjoint_union_all(clusters + separators)
cluster_nodes = [
[n[0] fornin G.nodes(data="subgraph") if n[1] == f"cluster_{i}"] foriin range(r)
]
separator_nodes = [
[n[0] fornin G.nodes(data="subgraph") if n[1] == f"separator_{i}"] foriin range(r - 1)
]
rng = np.random.default_rng(seed)
fori, separatorin enumerate(separator_nodes):
forsin separator:
forcin cluster_nodes[i] + cluster_nodes[i + 1]:
ifrng.random() < q2:
G.add_edge(s, c)
return G, cluster_nodes, separator_nodes
def get_clustered_chain_graph():
r = 2 # number of clusters
n = 13 # nodes in clusters
k = 1 # vertex separators
q1 = 0.7
q2 = 0.3
seed = 1967
G, _, _ = clustered_chain_graph(n, r, k, q1, q2, seed=seed)
return G
def workload_QAOA_layers_scaling():
G = get_clustered_chain_graph()
wires = len(G)
dev = qml.device("null.qubit", wires=wires)
cost, _ = qml.qaoa.maxcut(G)
@qml.qnode(dev)
def circuit():
qml.Hadamard(wires=0)
return qml.expval(cost)
with qml.Tracker(dev) as tracker1:
circuit()
print(tracker1.history["resources"][0])
workload_QAOA_layers_scaling()
Expected behavior
Ideally, a
null.qubit
device should be able to estimate resource requirements for a large-scale circuit (30Q+) measured with a Hamiltonian obs target at any wires.Actual behavior
The following error message was thrown out when running a 29 qubit QAOA application with
null.qubit
:numpy._core._exceptions._ArrayMemoryError: Unable to allocate 256. PiB for an array with shape (134217728, 134217728) and data type complex128
Additional information
No response
Source code
Tracebacks
No response
System information
Existing GitHub issues
The text was updated successfully, but these errors were encountered: