Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

test_gates() not passing deterministically #262

Description

Describe the bug

The test_gates() in the capi_test.cpp file, tests the gate implementation in the native simulator code.
The relevant part of the test for this bug is the following:
X(sim_id, 0);
CRx(sim_id, 1.0, 0, 1);
H(sim_id, 1);
CRx(sim_id, -1.0, 0, 1);
H(sim_id, 1);
assert(M(sim_id, 1) == false);
Here, the assert following the the gate sequence, does not pass deterministically and was demonstrated to fail after a number of runs

To Reproduce

The bug can be reproduced by running capi_test multiple times either manually or using a powershell script as follows:
$i = 0 ; while(!$LASTEXITCODE){.\capi_test.exe > out-null ; $i++ ; write-host $i ; sleep 2}

Expected behavior

The expected behavior is that all tests in capi_test pass deterministically every time, and printing the following:
Testing allocate
Testing gates
Testing teleport
Testing basis state permutation
Testing dump

Actual behavior

The error observed is an assertion fail, like the following:
Testing allocate
Testing gates
Assertion failed: M(sim_id, 1)==false, file D:\github\qsharp-runtime\src\Simulation\Native\src\simulator\capi_test.cpp, line 121

System information

  • OS: Windows

  • .NET Core Version: 3.1.300

  • IQ# Version: N/A

  • Python Version (if applicable): N/A

Additional context
Add any other context about the problem here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions