SYCL stream print nothing when kernel is in endless loop
How to flush the content in realtime?
@CaoZhongZ hi, could you please provide a bit more context, like code snippet, command to compile, may be some environment info and so on.
How to flush the content in realtime?
@CaoZhongZ, I'm afraid that we currently don't have such functionality.
sycl::stream is designed by the spec to be backend-independent, i.e. it is merely a char buffer for which you automatically have an accessor and fill it through operator<<. The actual printing happens on the host, once kernel is complete and the data is available there.
We have a non-standard undocumented extension of exposing OpenCL C printf function in our implementation, which can be used in kernels: https://github.com/intel/llvm/blob/5a92a19f0e4e4535560a2f6190d774d1b8e19fc5/sycl/include/sycl/ext/oneapi/experimental/builtins.hpp#L38
Please note that this is not a C99 printf and it has its quirks around format string. I can't guarantee that it will work in an endless loop kernel, but there is at least a chance for that, depending on the backend implementation, whilst there are no chances for that with sycl::stream.
Thanks! I'll try backend specific implementation.