-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Builtin "print" in kernel should be an async rpc top avoid RTIO underflows #2680
Comments
Async RPC still takes time to be dispatched, so it's unlikely that it would help. In your experiment, if you care for timing, you shouldn't rely on prints on anything. If you want to debug your experiment, you can use RTIO analyzer, if you need to carry data, there's datasets, and it would be best to wait until the end anyway. If you really need prints in your code, you can break realtime or introduce a delay. Can you tell us more what are you trying to achieve? |
Sure, but it wouldn't hurt to make print async would it? From what I remember the last time I checked, the difference (on a Kasli 2.0) async RPC takes hundreds of μs, versus several ms for synchronous. So in a lot of cases that would be fast enough to slip in a quick print() for debug or diagnostic purposes. As far as I can tell, print is already just an RPC call to the standard python function, so this should just be a matter of putting an async rpc decorator on print() in the global namespace, right? |
Good note, that async RPCs still take some time.
Very good note. We will take a look at that. But also see [1]
This is what we did in order to fight the issue here and there, before we figured, that synchroneously print was causing trouble and async solved it.
In short: An atoms optics experiment with rather slow control (sequences of several seconds with individual steps in the range of many ms to hundreds of ms). Prints in the kernel are rather rare. |
This is also what my opinion is, no matter if using
Yes, it absolutely is. We already tried to simply overwrite artiq/artiq/compiler/prelude.py Line 36 in 7702987
|
It may help and there is no reason to make it a slower synchronous RPC, since it returns no data.
There is also a |
Bug Report
Builtin
print
in kernel should be an async rpc to avoid RTIO underflowsShort summary.
When calling
print
within a kernel, e.g. for debugging a certain part of kernel code, it can cause an RTIO underflow. Especially, whenprint
is called close to timing critical calls to hardware.The nature of the cause is, that
print
is not an async rpc so the kernel waits for the function to return. The amount of time for this to happen varries and mostly depends on network delays.Steps to Reproduce
Run this code with the
print
statement. It will throw an RTIO underflow.Run the the code instead with my custom
kernel_print
method, that is an async RPC, it will work as expectedExpected Behavior
No RTIO underflow
Actual (undesired) Behavior
RTIO underflow thrown with a negative slack of roughly the network delay (e.g. a few ms)
Your System (omit irrelevant parts)
The text was updated successfully, but these errors were encountered: