Skip to content

[Python] [tests] Chemistry tests rely on prebuilt kernels #1954

@khalatepradnya

Description

@khalatepradnya
  • The function cudaq.__clearKernelRegistries() causes the global kernel registry to be cleared. As a result, the kernels in python/cudaq/kernels/uccsd.py get cleared.

  • If python/tests/domains/test_chemistry.py is run after this, then it fails -

FAILED ../python/tests/domains/test_chemistry.py::testUCCSD - cudaq.kernel.ast_bridge.CompilerError: uccsd.py:537: error: unhandled function call - single_excitation, known kernels are dict_keys([])
         (offending source -> single_excitation(qubits, singles_a[i][0], singles_a[i][1], thetas[thetaCounter]))
FAILED ../python/tests/domains/test_chemistry.py::test_uccsd_kernel - cudaq.kernel.ast_bridge.CompilerError: uccsd.py:579: error: unhandled function call - uccsd_even_electrons, known kernels are dict_keys([])
         (offending source -> uccsd_even_electrons(qubits, thetas, n_electrons, n_qubits))
  • Expected behavior - the kernels get recompiled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    python-langAnything related to the Python CUDA Quantum language implementationtestingRelates to testing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions