Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade cirq from 0.13.1 to ~= 1.0 and etc. #15

Merged
merged 9 commits into from
May 3, 2023
Merged

Upgrade cirq from 0.13.1 to ~= 1.0 and etc. #15

merged 9 commits into from
May 3, 2023

Conversation

jaeyoo
Copy link
Owner

@jaeyoo jaeyoo commented May 3, 2023

  • Added ./scripts/test_all.sh gpu for testing cuquantum ops together.

  • For the recent qsim 0.16.1 compatibility with Cirq, TFQ also needs Cirq >= 1.0. In this case, there are some deprecated & changed features.

  • ParseContext ProtoParse() has bug.

    • 2023-05-02 04:52:39.342483: W tensorflow/core/framework/op_kernel.cc:1830] OP_REQUIRES failed at tfq_adj_grad_op_cuquantum.cu.cc:87 : INVALID_ARGUMENT: Unparseable proto: junk and segfault.
      • It should not segfault the program. For graceful termination, we need to allow OpKernel to run its destructor to return resources including GPU handlers.
  • Test_simulate_state_large was too large.

    • 4x4=16 qubits ~ 160 GB.
    • → so, 3x3 = 9 qubits resolves.
  • SampledExpectationCuquantum op bug

    • circuit_execution_ops_test:ExecutionOpsConsistentyTest.test_sampled_expectation_no_circuits4 failed
    • Because it has no empty tensor treatment, it fell into segfault.
  • Lots of warnings fixed:

    • int vs unsigned, size type comparisons e.g. for (int … → for (size_t …
    • However, if the iterator decreases (e.g. i--), it should use int because it never goes under 0 in size_t, it runs forever.
  • Adjoint gradient cuquantum op numerical error bug was fixed

    • There was no BulkSetAmpl() function for cuStatevec state space. so, I temporarily added a cuda kernel.
    • Please remove the temporary hack code after supporting the function in qsim.
  • Added 4 Keras major layers (Expectation, SampledExpectation, Sample, State) use_cuquantum tests.

    • Also, if statements dealing with backend and use_cuquantum were unified.
    • To support older APIs, backend == 'noiseless' or backend is None will be the first condition to check use_cuquantum is required or not.
      • It also checks quantum_concurrent option together, to make it False whenever use_cuquantum is True.
  • Fixed and verified ./scripts/test_all.sh gpu passes.

jaeyoo added 9 commits May 3, 2023 00:43
1. CNOT's control and target was deprecated.
2. QuantumEngineSampler was deprecated. Use ProcessorSampler instead.
3. SingleQubitGate was deprecated. Use Gate instead. For testing
purpose, there is cirq.testing.SingleQubitGate.
4. Bump up the cirq dep version in TFQ to ~= 1.0 to be compatible with
qsim
Without this, sometimes OpKernel terminates without calling destructor,
going to segfault when cuquantum ops are running.
@jaeyoo jaeyoo requested a review from Sinestro38 May 3, 2023 04:16
@jaeyoo jaeyoo merged commit 0b59038 into master May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant