qiboteam / qibojit-benchmarks

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

Fix CU1 gate for QCGPU #24

Closed mlazzarin closed 2 years ago

mlazzarin commented 2 years ago

The tests for qcgpu were failing due to a different definition of CU1 gates w.r.t. Qibo. I defined a custom CU1 gate and now the tests are ok.

mlazzarin commented 2 years ago

Thanks for the fix, it works for me. Do you get any other issues with the random state tests on GPU? For me all libraries we currently have on this branch (qibo, qiskit-gpu, qulacs-gpu and qcgpu) are working fine now. Of course we have the low tolerance in CU3 but this will be addressed in #21.

I haven't tested qulacs-gpu, but the others work fine.

One last thing we could do for QCGPU is to implement the RZZ gate and check if QAOA is passing. This should be easy, we can just copy the matrix from qulacs. Would you like to give a try here?

Ok, I'm on it.

mlazzarin commented 2 years ago

One last thing we could do for QCGPU is to implement the RZZ gate and check if QAOA is passing. This should be easy, we can just copy the matrix from qulacs. Would you like to give a try here?

Unfortunately, it looks like QCGPU supports only 2x2 matrices.

ValueError: Gate is not a 2x2 matrix. For larger gates, please decompose into 2x2 matrices and/or use the controlled gate functionality.
stavros11 commented 2 years ago

Unfortunately, it looks like QCGPU supports only 2x2 matrices.

ValueError: Gate is not a 2x2 matrix. For larger gates, please decompose into 2x2 matrices and/or use the controlled gate functionality.

That's right, this is probably also why if you notice QCGPU.from_qasm I implemented the SWAP as three CNOTs. QCGPU is a very lightweight library without many features. I guess we can merge this as it is.

mlazzarin commented 2 years ago

Ok, I'll merge this PR.