Skip to content

Contradicting error messages on where to set max_qubits/n_qubits when running emulation #289

@rainij

Description

@rainij

Today I wanted to try out qnexus job submission and followed the tutorial here. I made a small modification in replacing repeat_until_success(q: qubit, attempts: int) by

@guppy
def cnot_chain() -> None:
    q0: qubit = qubit()
    q1: qubit = qubit()
    q2: qubit = qubit()

    h(q0)
    cx(q0, q1)
    cx(q1, q2)

    result("c0", measure(q0))
    result("c1", measure(q1))
    result("c2", measure(q2))

to make the compilation to hugr work (otherwise I get an entrypoint error, see also #288). Unfortunately I still get an error in qnx.start_execute_job. The error message is essentially this:

ResourceCreateFailed: Failed to create resource with status code: 400, message:
{"message":"Helios emulation must have max-qubits set in QuantinuumConfig.compiler_options set."}

It seems the error message wants me to change my code like this:

compiler_options = QuantinuumCompilerOptions(max_qubits=4) # <- new

config = qnx.QuantinuumConfig(
    device_name="Helios-1E",
    max_cost=6, #np.ceil(prediction)
    compiler_options=compiler_options, # <- new
)

But note that actually the QuantinuumCompilerOptions has no field for max_qubits. It didn't complain about it though. When I run this get another error message:

ResourceCreateFailed: Failed to create resource with status code: 400, message:
{"message":"max-qubits/n_qubits must currently be set explicitly in the BackendConfig."}

This sounds as if it contradicts the previous error message. Anyway, I tried out this

config = qnx.QuantinuumConfig(
    device_name="Helios-1E",
    max_cost=6, #np.ceil(prediction)
    compiler_options=compiler_options,
    max_qubits=4, # <- new (again typechecker complains though)
    n_qubits=4,   # <- new (again typechecker complains though)
)

But I get the same error (second) message. And if I comment out the compiler_options I get back the first error message.

I believe it is a bug. In any case, some feedback would be appricated.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions