I have noticed some odd behaviour when using openCL. After using any openCL function, say clGetPlatformIDs, StdOut no longer automatically flushes itself when the program exits. This is most apparent when piping stdout between programs in linux (fedora, ubuntu and suse tested) as any data written to stdout does not make it to the other file or program.
Has anyone else noticed this? Is there a solution?
Note: This is using printf inside normal cpu code, not inside an opencl kernel.
Just in case this isn't obvious, and I don't mean to insult your intelligence, or anyone elses, as a workaround, you could just fflush(stdout); right before exiting. stdout is defined as a FILE*, so fflush will work just fine with it...
As for the problem itself....got me 😕
Thanks. Using fflush was how I actually pinned down what was going on. It's a workaround definitely, but not ideal.
Strange things do seem to happen to stdout, but fflush mostly solves them for me.