SoftwareQuTech / SimulaQron

Quantum Network Simulator for Application Programming
Other
113 stars 53 forks source link

occasional failures in teleport #248

Closed johanvos closed 4 years ago

johanvos commented 4 years ago

Occasionally, I get failures running the CQC-Python teleport sample. The expected outcome for Bob to measure should be 0, but sometimes 1 is measured.

The log (with debug level) for a failure (not the final measured outcome 1) is shown below:

2019-12-29 14:15:01,495:DEBUG:CQC Bob: Initialized Protocol
2019-12-29 14:15:01,495:DEBUG:CQC Bob: Read CQC Header: CQC Header. Version: 2 Type: 1 App ID: 0 Length: 4
2019-12-29 14:15:01,495:DEBUG:CQC Bob: Command received
2019-12-29 14:15:01,495:DEBUG:CQC Bob got command header Command Header. Qubit ID: 0 Instruction: 8 Notify: True Block: True Action: False
2019-12-29 14:15:01,495:DEBUG:CQC Bob: Executing command: Command Header. Qubit ID: 0 Instruction: 8 Notify: True Block: True Action: False
2019-12-29 14:15:01,495:DEBUG:CQC Bob: Asking to receive for App ID 0
2019-12-29 14:15:01,496:DEBUG:VIRTUAL NODE Bob: Trying to retrieve qubit for app id 0 from epr list
2019-12-29 14:15:01,497:DEBUG:CQC Alice: Initialized Protocol
2019-12-29 14:15:01,497:DEBUG:CQC Alice: Read CQC Header: CQC Header. Version: 2 Type: 1 App ID: 0 Length: 12
2019-12-29 14:15:01,497:DEBUG:CQC Alice: Command received
2019-12-29 14:15:01,497:DEBUG:CQC Alice got command header Command Header. Qubit ID: 0 Instruction: 7 Notify: True Block: True Action: False
2019-12-29 14:15:01,497:DEBUG:CQC Alice: Read XTRA Header: Communication header. Remote App ID: 0 Remote Node: 2130706433 Remote Port: 8004
2019-12-29 14:15:01,497:DEBUG:CQC Alice: Executing command: Command Header. Qubit ID: 0 Instruction: 7 Notify: True Block: True Action: False
2019-12-29 14:15:01,498:DEBUG:VIRTUAL NODE Alice: Request to create new qubit.
2019-12-29 14:15:01,498:DEBUG:VIRTUAL NODE Alice: Local GETTING LOCK
2019-12-29 14:15:01,498:DEBUG:VIRTUAL NODE Alice: Local GOT LOCK
2019-12-29 14:15:01,498:DEBUG:VIRTUAL NODE Alice: Local GETTING LOCK
2019-12-29 14:15:01,498:DEBUG:VIRTUAL NODE Alice: Initializing new simulated register.
2019-12-29 14:15:01,498:DEBUG:VIRTUAL NODE Alice: Local RELEASE LOCK
2019-12-29 14:15:01,498:DEBUG:VIRTUAL NODE Alice: Local GOT LOCK
2019-12-29 14:15:01,499:INFO:QUANTUM Alice: Adding qubit number 0 to register 15
2019-12-29 14:15:01,499:DEBUG:VIRTUAL NODE Alice: Local RELEASE LOCK
2019-12-29 14:15:01,499:INFO:CQC Alice: Requested new qubit (0,1)
2019-12-29 14:15:01,500:DEBUG:VIRTUAL NODE Alice: Request to create new qubit.
2019-12-29 14:15:01,500:DEBUG:VIRTUAL NODE Alice: Local GETTING LOCK
2019-12-29 14:15:01,500:DEBUG:VIRTUAL NODE Alice: Local GOT LOCK
2019-12-29 14:15:01,500:DEBUG:VIRTUAL NODE Alice: Local GETTING LOCK
2019-12-29 14:15:01,500:DEBUG:VIRTUAL NODE Alice: Initializing new simulated register.
2019-12-29 14:15:01,500:DEBUG:VIRTUAL NODE Alice: Local RELEASE LOCK
2019-12-29 14:15:01,500:DEBUG:VIRTUAL NODE Alice: Local GOT LOCK
2019-12-29 14:15:01,500:INFO:QUANTUM Alice: Adding qubit number 0 to register 16
2019-12-29 14:15:01,500:DEBUG:VIRTUAL NODE Alice: Local RELEASE LOCK
2019-12-29 14:15:01,501:INFO:CQC Alice: Requested new qubit (0,2)
2019-12-29 14:15:01,501:DEBUG:CQC Alice: apply_H on App ID 0 to qubit id 1
2019-12-29 14:15:01,501:DEBUG:VIRTUAL NODE Alice: applying H to number 0
2019-12-29 14:15:01,501:DEBUG:CQC Alice: Applying cnot_onto to App ID 0 qubit id 1 target 2
2019-12-29 14:15:01,502:DEBUG:VIRTUAL NODE Alice: Doing 2 qubit gate name cnot_onto and local call remote_cnot_onto
2019-12-29 14:15:01,502:DEBUG:VIRTUAL NODE Alice: Local GETTING LOCK
2019-12-29 14:15:01,502:DEBUG:VIRTUAL NODE Alice: Local GOT LOCK
2019-12-29 14:15:01,502:DEBUG:VIRTUAL NODE Alice: 2qubit command demands register merge.
2019-12-29 14:15:01,502:DEBUG:VIRTUAL NODE Alice: Request to merge local register for qubits simNum 0 and simNum 1.
2019-12-29 14:15:01,502:DEBUG:VIRTUAL NODE Alice: Request to merge LOCKS PRESENT
2019-12-29 14:15:01,502:DEBUG:VIRTUAL NODE Alice: Request to merge local register: need merge
2019-12-29 14:15:01,502:DEBUG:VIRTUAL NODE Alice: Updating register 0 to 1.
2019-12-29 14:15:01,503:DEBUG:VIRTUAL NODE Alice: CNOT from 0 to 1
2019-12-29 14:15:01,503:DEBUG:VIRTUAL NODE Alice: Local RELEASE LOCK
2019-12-29 14:15:01,503:DEBUG:VIRTUAL NODE Alice: Local RELEASE LOCK
2019-12-29 14:15:01,504:DEBUG:VIRTUAL NODE Alice: Request to send qubit sim Num 1 to Bob.
2019-12-29 14:15:01,504:DEBUG:VIRTUAL NODE Alice: Local GETTING LOCK
2019-12-29 14:15:01,504:DEBUG:VIRTUAL NODE Alice: Local GOT LOCK
2019-12-29 14:15:01,504:DEBUG:VIRTUAL NODE Alice: Sending qubit simulated locally
2019-12-29 14:15:01,504:DEBUG:VIRTUAL NODE Bob: Request to add qubit from Alice.
2019-12-29 14:15:01,505:DEBUG:VIRTUAL NODE Bob: Local GETTING LOCK
2019-12-29 14:15:01,505:DEBUG:VIRTUAL NODE Bob: Local GOT LOCK
2019-12-29 14:15:01,505:DEBUG:VIRTUAL NODE Bob: Local RELEASE LOCK
2019-12-29 14:15:01,505:DEBUG:VIRTUAL NODE Alice: Local RELEASE LOCK
2019-12-29 14:15:01,506:DEBUG:VIRTUAL NODE Bob: Added a qubit for app id 0 to epr list
2019-12-29 14:15:01,507:DEBUG:CQC Alice: Sent App ID 0 half a EPR pair as qubit id 2 to Bob
2019-12-29 14:15:01,507:DEBUG:CQC Alice: Notify Extra Qubit header. qubit id: 1
2019-12-29 14:15:01,507:DEBUG:CQC Alice: Entanglement information A: (2130706433, 8001, 0) B: (2130706433, 8004, 0) Entanglement ID: 5 Timestamp: 1577625301 Time of Goodness: 1577625301 Goodness: 0 Directionality Flag: 1
2019-12-29 14:15:01,507:DEBUG:CQC Alice: EPR Pair ID 0 qubit id 0
2019-12-29 14:15:01,507:DEBUG:CQC Alice: Command successful, sent done.
2019-12-29 14:15:01,508:DEBUG:CQC Alice: Read CQC Header: CQC Header. Version: 2 Type: 1 App ID: 0 Length: 4
2019-12-29 14:15:01,508:DEBUG:CQC Alice: Incomplete data. Waiting. Current length 0, required length 4
2019-12-29 14:15:01,547:DEBUG:CQC Alice: Command received
2019-12-29 14:15:01,547:DEBUG:CQC Alice got command header Command Header. Qubit ID: 0 Instruction: 1 Notify: True Block: True Action: False
2019-12-29 14:15:01,547:DEBUG:CQC Alice: Executing command: Command Header. Qubit ID: 0 Instruction: 1 Notify: True Block: True Action: False
2019-12-29 14:15:01,548:DEBUG:VIRTUAL NODE Alice: Request to create new qubit.
2019-12-29 14:15:01,548:DEBUG:VIRTUAL NODE Alice: Local GETTING LOCK
2019-12-29 14:15:01,548:DEBUG:VIRTUAL NODE Alice: Local GOT LOCK
2019-12-29 14:15:01,548:DEBUG:VIRTUAL NODE Alice: Local GETTING LOCK
2019-12-29 14:15:01,548:DEBUG:VIRTUAL NODE Alice: Initializing new simulated register.
2019-12-29 14:15:01,548:DEBUG:VIRTUAL NODE Alice: Local RELEASE LOCK
2019-12-29 14:15:01,548:DEBUG:VIRTUAL NODE Alice: Local GOT LOCK
2019-12-29 14:15:01,549:INFO:QUANTUM Alice: Adding qubit number 0 to register 17
2019-12-29 14:15:01,549:DEBUG:VIRTUAL NODE Alice: Local RELEASE LOCK
2019-12-29 14:15:01,549:INFO:CQC Alice: Requested new qubit (0,2)
2019-12-29 14:15:01,549:INFO:CQC Alice: Extra Qubit header. qubit id: 2
2019-12-29 14:15:01,549:DEBUG:CQC Alice: Command successful, sent done.
2019-12-29 14:15:01,550:DEBUG:CQC Alice: Read CQC Header: CQC Header. Version: 2 Type: 1 App ID: 0 Length: 4
2019-12-29 14:15:01,550:DEBUG:CQC Alice: Incomplete data. Waiting. Current length 0, required length 4
2019-12-29 14:15:01,587:DEBUG:CQC Alice: Command received
2019-12-29 14:15:01,587:DEBUG:CQC Alice got command header Command Header. Qubit ID: 2 Instruction: 17 Notify: True Block: True Action: False
2019-12-29 14:15:01,587:DEBUG:CQC Alice: Executing command: Command Header. Qubit ID: 2 Instruction: 17 Notify: True Block: True Action: False
2019-12-29 14:15:01,588:DEBUG:CQC Alice: apply_H on App ID 0 to qubit id 2
2019-12-29 14:15:01,588:DEBUG:VIRTUAL NODE Alice: applying H to number 0
2019-12-29 14:15:01,589:DEBUG:CQC Alice: Command successful, sent done.
2019-12-29 14:15:01,589:DEBUG:CQC Alice: Read CQC Header: CQC Header. Version: 2 Type: 1 App ID: 0 Length: 6
2019-12-29 14:15:01,590:DEBUG:CQC Alice: Command received
2019-12-29 14:15:01,590:DEBUG:CQC Alice got command header Command Header. Qubit ID: 2 Instruction: 20 Notify: True Block: True Action: False
2019-12-29 14:15:01,590:DEBUG:CQC Alice: Read XTRA Header: Extra Qubit header. qubit id: 1
2019-12-29 14:15:01,590:DEBUG:CQC Alice: Executing command: Command Header. Qubit ID: 2 Instruction: 20 Notify: True Block: True Action: False
2019-12-29 14:15:01,590:DEBUG:CQC Alice: Applying cnot_onto to App ID 0 qubit id 2 target 1
2019-12-29 14:15:01,591:DEBUG:VIRTUAL NODE Alice: Doing 2 qubit gate name cnot_onto and local call remote_cnot_onto
2019-12-29 14:15:01,591:DEBUG:VIRTUAL NODE Alice: Local GETTING LOCK
2019-12-29 14:15:01,592:DEBUG:VIRTUAL NODE Alice: Local GOT LOCK
2019-12-29 14:15:01,592:DEBUG:VIRTUAL NODE Alice: 2qubit command demands register merge.
2019-12-29 14:15:01,592:DEBUG:VIRTUAL NODE Alice: Request to merge local register for qubits simNum 2 and simNum 0.
2019-12-29 14:15:01,592:DEBUG:VIRTUAL NODE Alice: Request to merge LOCKS PRESENT
2019-12-29 14:15:01,592:DEBUG:VIRTUAL NODE Alice: Request to merge local register: need merge
2019-12-29 14:15:01,593:DEBUG:VIRTUAL NODE Alice: Updating register 0 to 1.
2019-12-29 14:15:01,593:DEBUG:VIRTUAL NODE Alice: Updating register 1 to 2.
2019-12-29 14:15:01,593:DEBUG:VIRTUAL NODE Alice: CNOT from 0 to 1
2019-12-29 14:15:01,593:DEBUG:VIRTUAL NODE Alice: Local RELEASE LOCK
2019-12-29 14:15:01,593:DEBUG:VIRTUAL NODE Alice: Local RELEASE LOCK
2019-12-29 14:15:01,594:DEBUG:CQC Alice: Command successful, sent done.
2019-12-29 14:15:01,595:DEBUG:CQC Alice: Read CQC Header: CQC Header. Version: 2 Type: 1 App ID: 0 Length: 4
2019-12-29 14:15:01,595:DEBUG:CQC Alice: Incomplete data. Waiting. Current length 0, required length 4
2019-12-29 14:15:01,597:DEBUG:VIRTUAL NODE Bob: Trying to retrieve qubit for app id 0 from epr list
2019-12-29 14:15:01,597:DEBUG:VIRTUAL NODE Bob: Returning qubit for app id 0 from epr list
2019-12-29 14:15:01,598:DEBUG:CQC Bob: Qubit received for app_id 0
2019-12-29 14:15:01,598:DEBUG:CQC Bob: Extra Qubit header. qubit id: 1
2019-12-29 14:15:01,598:DEBUG:CQC Bob: Entanglement information A: (2130706433, 8004, 0) B: (2130706433, 8001, 0) Entanglement ID: 5 Timestamp: 1577625301 Time of Goodness: 1577625301 Goodness: 0 Directionality Flag: 2
2019-12-29 14:15:01,598:DEBUG:CQC Bob: EPR Pair ID 0 qubit id 0
2019-12-29 14:15:01,598:DEBUG:CQC Bob: Command successful, sent done.
2019-12-29 14:15:01,631:DEBUG:CQC Alice: Command received
2019-12-29 14:15:01,631:DEBUG:CQC Alice got command header Command Header. Qubit ID: 2 Instruction: 17 Notify: True Block: True Action: False
2019-12-29 14:15:01,631:DEBUG:CQC Alice: Executing command: Command Header. Qubit ID: 2 Instruction: 17 Notify: True Block: True Action: False
2019-12-29 14:15:01,632:DEBUG:CQC Alice: apply_H on App ID 0 to qubit id 2
2019-12-29 14:15:01,632:DEBUG:VIRTUAL NODE Alice: applying H to number 0
2019-12-29 14:15:01,633:DEBUG:CQC Alice: Command successful, sent done.
2019-12-29 14:15:01,633:DEBUG:CQC Alice: Read CQC Header: CQC Header. Version: 2 Type: 1 App ID: 0 Length: 8
2019-12-29 14:15:01,634:DEBUG:CQC Alice: Command received
2019-12-29 14:15:01,634:DEBUG:CQC Alice got command header Command Header. Qubit ID: 2 Instruction: 2 Notify: False Block: True Action: False
2019-12-29 14:15:01,634:DEBUG:CQC Alice: Read XTRA Header: CQC Assign sub header. RefID=0
2019-12-29 14:15:01,634:DEBUG:CQC Alice: Executing command: Command Header. Qubit ID: 2 Instruction: 2 Notify: False Block: True Action: False
2019-12-29 14:15:01,634:DEBUG:CQC Alice: Measuring App ID 0 qubit id 2
2019-12-29 14:15:01,635:DEBUG:VIRTUAL NODE Alice: Measuring local qubit
2019-12-29 14:15:01,636:DEBUG:VIRTUAL NODE Alice: Local GETTING LOCK
2019-12-29 14:15:01,636:DEBUG:VIRTUAL NODE Alice: Local GOT LOCK
2019-12-29 14:15:01,637:DEBUG:VIRTUAL NODE Alice: Local RELEASE LOCK
2019-12-29 14:15:01,637:DEBUG:CQC Alice: Measured outcome 0
2019-12-29 14:15:01,637:DEBUG:CQC Alice: Notify Measurement Outcome header. measurement outcome: 0
2019-12-29 14:15:01,638:DEBUG:CQC Alice: Read CQC Header: CQC Header. Version: 2 Type: 1 App ID: 0 Length: 8
2019-12-29 14:15:01,638:DEBUG:CQC Alice: Command received
2019-12-29 14:15:01,638:DEBUG:CQC Alice got command header Command Header. Qubit ID: 1 Instruction: 2 Notify: False Block: True Action: False
2019-12-29 14:15:01,639:DEBUG:CQC Alice: Read XTRA Header: CQC Assign sub header. RefID=0
2019-12-29 14:15:01,639:DEBUG:CQC Alice: Executing command: Command Header. Qubit ID: 1 Instruction: 2 Notify: False Block: True Action: False
2019-12-29 14:15:01,639:DEBUG:CQC Alice: Measuring App ID 0 qubit id 1
2019-12-29 14:15:01,675:DEBUG:VIRTUAL NODE Alice: Measuring local qubit
2019-12-29 14:15:01,676:DEBUG:VIRTUAL NODE Alice: Local GETTING LOCK
2019-12-29 14:15:01,676:DEBUG:VIRTUAL NODE Alice: Local GOT LOCK
2019-12-29 14:15:01,677:DEBUG:VIRTUAL NODE Alice: Local RELEASE LOCK
2019-12-29 14:15:01,678:DEBUG:CQC Alice: Measured outcome 1
2019-12-29 14:15:01,678:DEBUG:CQC Alice: Notify Measurement Outcome header. measurement outcome: 1
2019-12-29 14:15:01,679:DEBUG:CQC Bob: Read CQC Header: CQC Header. Version: 2 Type: 1 App ID: 0 Length: 4
2019-12-29 14:15:01,680:DEBUG:CQC Bob: Command received
2019-12-29 14:15:01,680:DEBUG:CQC Bob got command header Command Header. Qubit ID: 1 Instruction: 10 Notify: True Block: True Action: False
2019-12-29 14:15:01,680:DEBUG:CQC Bob: Executing command: Command Header. Qubit ID: 1 Instruction: 10 Notify: True Block: True Action: False
2019-12-29 14:15:01,680:DEBUG:CQC Bob: apply_X on App ID 0 to qubit id 1
2019-12-29 14:15:01,684:DEBUG:VIRTUAL NODE Bob: Calling Alice remotely to apply apply_X.
2019-12-29 14:15:01,685:DEBUG:VIRTUAL NODE Alice: applying X to number 0
2019-12-29 14:15:01,687:DEBUG:CQC Bob: Command successful, sent done.
2019-12-29 14:15:01,688:DEBUG:CQC Bob: Read CQC Header: CQC Header. Version: 2 Type: 1 App ID: 0 Length: 8
2019-12-29 14:15:01,688:DEBUG:CQC Bob: Command received
2019-12-29 14:15:01,688:DEBUG:CQC Bob got command header Command Header. Qubit ID: 1 Instruction: 2 Notify: False Block: True Action: False
2019-12-29 14:15:01,688:DEBUG:CQC Bob: Read XTRA Header: CQC Assign sub header. RefID=0
2019-12-29 14:15:01,689:DEBUG:CQC Bob: Executing command: Command Header. Qubit ID: 1 Instruction: 2 Notify: False Block: True Action: False
2019-12-29 14:15:01,689:DEBUG:CQC Bob: Measuring App ID 0 qubit id 1
2019-12-29 14:15:01,692:DEBUG:VIRTUAL NODE Bob: Measuring remote qubit at Alice.
2019-12-29 14:15:01,695:DEBUG:VIRTUAL NODE Alice: Local GETTING LOCK
2019-12-29 14:15:01,695:DEBUG:VIRTUAL NODE Alice: Local GOT LOCK
2019-12-29 14:15:01,696:DEBUG:VIRTUAL NODE Alice: Local RELEASE LOCK
2019-12-29 14:15:01,698:DEBUG:CQC Bob: Measured outcome 1
2019-12-29 14:15:01,698:DEBUG:CQC Bob: Notify Measurement Outcome header. measurement outcome: 1
AckslD commented 4 years ago

Hi @johanvos! How are you running this? Is it the stress-test you mentioned in an email?

johanvos commented 4 years ago

correct

AckslD commented 4 years ago

@johanvos The current version of SimulaQron and CQC is unfortunately not so robust against heavy load or stress-test. This will hopefully improve in the next iteration. Is this an issue for you at the moment or something that you stumbled upon while testing?

johanvos commented 4 years ago

Thanks, It's not a blocking issue for me. I noticed that the issue doesn't occur when adding small sleeps in between invocations, so I can do that. The more important question is probably if the CQC protocol should (ultimately) deal with concurrency, or if that is the responsibility of a higher layer? I can live with both.

AckslD commented 4 years ago

In my view, CQC should deal with concurrency, since the higher layer has little control and information about the timing and execution-time of operations. I think it's therefore useful if the higher layer does not have to care about such things.

I'd be happy to hear if you have different thoughts :)