Hi, I’m trying to demo the JIT functionality provided by catalyst as in the Catalyst Runtime — Catalyst 0.2.0-dev documentation
from catalyst import qjit, measure, cond, for_loop, while_loop
import pennylane as qml
from jax import numpy as jnp
@qjit
@qml.qnode(qml.device("lightning.qubit", wires=5))
def circuit(arg0, arg1, arg2):
qml.RX(arg0, wires=[arg1 + 1])
qml.RY(arg0, wires=[arg2])
qml.CNOT(wires=[arg1, arg2])
return qml.probs(wires=[arg1 + 1])
circuit(jnp.pi / 3, 1, 2)
I get the following error and am unsure what is going wrong - I am running this inside a Docker container.
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
Cell In[14], line 1
----> 1 circuit(jnp.pi / 3, 1, 2)
File /project_name/.venv/lib/python3.11/site-packages/catalyst/compilation_pipelines.py:580, in QJIT.__call__(self, *args, **kwargs)
578 warnings.warn(msg, UserWarning)
579 self.mlir_module = self.get_mlir(*r_sig)
--> 580 self.compiled_function = self.compile()
581 else:
582 args = CompiledFunction.promote_arguments(self.c_sig, r_sig, *args)
File /project_name/.venv/lib/python3.11/site-packages/catalyst/compilation_pipelines.py:548, in QJIT.compile(self)
545 def compile(self):
546 """Compile the current MLIR module."""
--> 548 shared_object, self._llvmir = compiler.compile(
549 self.mlir_module, self.workspace_name, self.passes, self.compile_options
550 )
552 # The function name out of MLIR has quotes around it, which we need to remove.
553 # The MLIR function name is actually a derived type from string which has no
554 # `replace` method, so we need to get a regular Python string out of it.
555 qfunc_name = str(self.mlir_module.body.operations[0].name).replace('"', "")
File /project_name/.venv/lib/python3.11/site-packages/catalyst/compiler.py:491, in compile(mlir_module, workspace, passes, compile_options)
489 passes["ll"] = llvmir
490 object_file = compile_llvmir(llvmir, compile_options)
--> 491 shared_object = link_lightning_runtime(object_file, compile_options)
493 with open(llvmir, "r", encoding="utf-8") as f:
494 _llvmir = f.read()
File /project_name/.venv/lib/python3.11/site-packages/catalyst/compiler.py:443, in link_lightning_runtime(filename, compile_options)
439 raise ValueError(f"Input file ({filename}) for linking is not an object file")
441 new_fname = filename.replace(".o", ".so")
--> 443 CompilerDriver.link(filename, new_fname, compile_options=compile_options)
445 return new_fname
File /project_name/.venv/lib/python3.11/site-packages/catalyst/compiler.py:279, in CompilerDriver.link(infile, outfile, flags, fallback_compilers, compile_options)
277 return
278 msg = f"Unable to link {infile}. All available compiler options exhausted. Please provide a compatible compiler via $CATALYST_CC."
--> 279 raise EnvironmentError(msg)
OSError: Unable to link /tmp/tmpf6t7u1i9/circuit.nohlo.opt.o. All available compiler options exhausted. Please provide a compatible compiler via $CATALYST_CC.
This is the output of qml.about()
:
Name: PennyLane
Version: 0.30.0
Summary: PennyLane is a Python quantum machine learning library by Xanadu Inc.
Home-page: https://github.com/XanaduAI/pennylane
Author:
Author-email:
License: Apache License 2.0
Location: /quantum_risk_engine/.venv/lib/python3.11/site-packages
Requires: appdirs, autograd, autoray, cachetools, networkx, numpy, pennylane-lightning, requests, rustworkx, scipy, semantic-version, toml
Required-by: pennylane-catalyst, PennyLane-Lightning
Platform info: Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.17
Python version: 3.11.3
Numpy version: 1.23.5
Scipy version: 1.10.1
Installed devices:
- default.gaussian (PennyLane-0.30.0)
- default.mixed (PennyLane-0.30.0)
- default.qubit (PennyLane-0.30.0)
- default.qubit.autograd (PennyLane-0.30.0)
- default.qubit.jax (PennyLane-0.30.0)
- default.qubit.tf (PennyLane-0.30.0)
- default.qubit.torch (PennyLane-0.30.0)
- default.qutrit (PennyLane-0.30.0)
- null.qubit (PennyLane-0.30.0)
- lightning.qubit (PennyLane-Lightning-0.30.0)