We are trying to do some calculations on the core device to perform mid-circuit feedback operations. I've boiled our problem down to the following minimal example.
Goal: take the result of arithmetic involving both sine and cosine and either assign it to an attribute of the experiment class or pass it to an RPC
Observed behavior: if the argument of the sine/cosine is an attribute of the experiment class (or results from an arithmetic operation involving an attribute of the experiment class), we get the following error:
artiq.coredevice.comm_kernel.LoadError: core1 failed to process data
Our experiment:
from artiq.experiment import *
import numpy as np
class fail(EnvExperiment):
def prepare(self):
self.core = self.get_device('core')
self.x = 0.1
self.y = 0.
@kernel
def run(self):
# x = 0.1 # no error
x = self.x # LoadError
a = np.sin(x)
b = np.cos(x)
self.y = a + b
The log shows the following:
[ 3427.600391s] ERROR(ksupport::kernel::core1): failed to load shared library: symbol lookup error: sincos
[ 3427.609772s] WARN(runtime::comms): connection terminated: unexpected pattern
The terminal shows the following:
> artiq_run minimal_example.py
Traceback (most recent call last):
File "C:\Users\jarjarbinks\.venv\kpy\Scripts\artiq_run-script.py", line 33, in <module>
sys.exit(load_entry_point('artiq', 'console_scripts', 'artiq_run')())
File "c:\users\jarjarbinks\code\artiq\artiq\frontend\artiq_run.py", line 272, in main
return run(with_file=True)
File "c:\users\jarjarbinks\code\artiq\artiq\frontend\artiq_run.py", line 256, in run
raise exn
File "c:\users\jarjarbinks\code\artiq\artiq\frontend\artiq_run.py", line 248, in run
exp_inst.run()
File "c:\users\jarjarbinks\code\artiq\artiq\language\core.py", line 54, in run_on_core
return getattr(self, arg).run(run_on_core, ((self,) + k_args), k_kwargs)
File "c:\users\jarjarbinks\code\artiq\artiq\coredevice\core.py", line 169, in run
self._run_compiled(kernel_library, embedding_map, symbolizer, demangler)
File "c:\users\jarjarbinks\code\artiq\artiq\coredevice\core.py", line 156, in _run_compiled
self.comm.load(kernel_library)
File "c:\users\jarjarbinks\code\artiq\artiq\coredevice\comm_kernel.py", line 384, in load
raise LoadError(self._read_string())
artiq.coredevice.comm_kernel.LoadError: core1 failed to process data
Our system configuration is a Kasli-SoC master with two Kasli 2.0 satellites (one of which contains a Shuttler). We are running ARTIQ-8. Our device-db.py is here, in case relevant.
Our current workaround is to replace all instances of np.cos(x) with np.sin(np.pi/2 - x), but I want to get to the bottom of this and understand what is going on.
Has anyone seen anything like this? Happy to provide additional logs or run other tests if it would be helpful.