Closed rmlarose closed 4 years ago
Tracing down, the tensor::_copy()
method reports a memory leak when trying to copy a tensor which has a non-null data pointer but no indices.
When running auto-ordering, it uses two cuts by default. On a 2x2 grid, it's possible that this produces a 1-qubit region, i.e. a zero-rank tensor. When qFlex attempts to copy this tensor, it hits the error above.
There are two steps to resolve this:
max_cuts=0
in your circuit_to_ordering
call.Setting max_cuts=0
in the call to circuit_to_ordering
results in a different error with read_circuit.cpp:
ERROR (read_circuit.cpp: operator():230) --> Left hand side of pair not found: (0,0),(0,1).
Result: []
Setting max_cuts=1
works.
I'm trying to simulate a circuit through the Cirq interface without reading in files. I'm able to run qflex_cirq_example.py with no issues. I modified this to construct the same circuit and grid used in the rectangular 2x2 example (see inline comments in code below).
I find that the circuit and grid don't have to be read in from files, but when the ordering is not read in from a file, I get a memory leak.
The specific example I'm running (from the same directory as
qflex_cirq_example.py
) is below:The output of this code is:
While if I uncomment the line
and comment the next two lines, everything works fine and produces the expected output:
The same error occurs when no explicit
qflex_order
argument is input to theQFlexCircuit
.