Closed ttoktassynov closed 3 years ago
I just ran this test but I'm not getting the error you said, the test is timing out instead.
This is what the log file is reporting for me:
[2021-08-30 23:50:28] [TRACE] [qc] Initialised quantum circuit
[2021-08-30 23:50:28] [TRACE] [cr] Initialised classical register
[2021-08-30 23:50:28] [TRACE] [qr] Initialised quantum register
[2021-08-30 23:50:28] [TRACE] [ng] Initialised not gate
[2021-08-30 23:50:28] [TRACE] [m1] Initialised measure
[2021-08-30 23:50:28] [TRACE] [m2] Initialised measure
[2021-08-30 23:50:28] [TRACE] [si] Initialised local simulator
[2021-08-30 23:50:28] [TRACE] [qc] Quantum circuit received input
[2021-08-30 23:50:29] [TRACE] [qc] Executed quantum circuit command
[2021-08-30 23:50:29] [TRACE] [qr] Quantum register received input
[2021-08-30 23:50:29] [TRACE] [cr] Classical register received input
[2021-08-30 23:50:29] [TRACE] [qr] Executed quantum register command
[2021-08-30 23:50:29] [TRACE] [qr] Quantum register waiting for circuit to be ready
[2021-08-30 23:50:29] [TRACE] [ng] Not gate received input
[2021-08-30 23:50:29] [TRACE] [m1] Measure received input
[2021-08-30 23:50:29] [TRACE] [ng] Executed not gate command
[2021-08-30 23:50:29] [ERROR] [ng] Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'qc' is not defined
[2021-08-30 23:50:29] [TRACE] [m1] Executed measure command
[2021-08-30 23:50:29] [ERROR] [m1] Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'qc' is not defined
This is an error due to wrong persistence of quantum circuit data in the state manager. After #92 it should be gone.
But the reason why it would timeout is because when input will come to local simulator node, than error will be thrown. You can console log in local simulator js file to make sure. The test will just timeout, since last output node in correctOutputReceived function will never receive any message
@Theo-Reignier can think of reason why such flow creation might result in ‘same qubit coming twice’ situation? Although regular flow creation via editor works with no problem .
@Theo-Reignier can think of reason why such flow creation might result in ‘same qubit coming twice’ situation? Although regular flow creation via editor works with no problem .
I don't know, the circuit illustrated above should not raise any error. Maybe the correctOutputReceived function is not working properly.
correctOutputReceived just loads the flow, injects the input to the first node and catches the output from the last output. Shouldn't any problems there.
@ttoktassynov Could you paste your latest log file (from the logs/
directory) when running just this test please? You can use the command export NODE_ENV=dev && npx mocha test/nodes/local-simulator_spec.js -g 'should return correct output for register only circuit' --timeout 10000
Pardon, guys. There was a type in the line where I added a quantum register to the flow:
flow.add('quantum-register', 'qr', [['ng', 'm1']], {outputs:2});
Forgot to wrap 'ng' and 'm1' nodes into brackets correctly. Everything now works fine.
Bug Description
Local simulator received same qubit twice when running flow via flow-builder.
Steps to Reproduce Bug
In this test case
we receive following error:
Expected Behaviour & Actual Behaviour
Expected output:![Screen Shot 2021-08-30 at 22 29 11](https://user-images.githubusercontent.com/25239936/131408381-9c274738-fcb1-4df3-9b2e-5485d632b6fc.png)
Additional Information
System Information