qiboteam / qibojit-benchmarks

Benchmark code for qibojit performance accessment
Apache License 2.0
2 stars 3 forks source link

Use non-trivial initial state in tests #20

Closed stavros11 closed 2 years ago

stavros11 commented 2 years ago

Currently tests are using the default initial state |00...0> which has trivial representation [1, 0, 0, ..., 0] in computational basis and thus not all matrix elements are properly tested. Here I add random RX rotations in every qubit before each test circuit to make sure that the input state in each circuit is not trivial. This state is still not entangled, but its representation is not just 0s so it is better choice than the default state. I use gates instead of passing a custom initial state vector, as the latter may be complicated for some libraries.

Tests work with the random state, except the CU3 test which for various libraries (including qiskit and qulacs) gives a fidelity < 0.999 when compared to qibo's CU3. This may be precision related but I am not 100% sure because 1e-3 is a large error for precision issue.

mlazzarin commented 2 years ago

I tried to run the tests with qiskit-gpu and qcgpu. The former runs fine, while we have some assertion errors with the latter. I'm going to investigate it further.