qp.runtime_declare¶
- runtime_declare(symbol, spec, library=None)¶
Declare the signature of a runtime symbol so it can be called by name.
speclists parameter types in runtime order, followed by an optional result. Anoutparameter is declared inspecbut omitted from the arguments toruntime_call().- Parameters:
symbol (str) – the C symbol name, as exported by the runtime library
spec (str) – the signature spec, e.g.
"(ptr, buf, u64) -> i32". SeeCTypefor the available types.library (str | None) – the shared library (
.so/.dylib) exportingsymbol, for a local in-process call. It is recorded on the compiled module so the driver links against it. Leave itNonefor a dispatched symbol, or one already loaded in the calling process.
- Returns:
- the declared signature, which
runtime_call()also takes directly
- the declared signature, which
- Return type:
Example
import pennylane as qp qp.runtime_declare("example_declared_rounds", "(ptr, u32) -> i32") # ...and a local symbol, from a shared library the program is linked against: qp.runtime_declare("example_local", "(i32, i32) -> i32", library="/path/liblocal.so") def program(session, lhs, rhs): qp.runtime_call("example_declared_rounds", session, 1000, address="board:9000") return qp.runtime_call("example_local", lhs, rhs)
See also