OpenCL fails to connect kernel printf stdout to intelliJ IDEA console
已回答
The printf instruction in an openCL kernel is supposed to write to the stdout interface which in turn is expected to be the "Run" console in the workbench ( I am working with IntelliJ IDEA community 2020.01). However, it doesn't work. Any suggestion?
Specifics:
OS: Windows 8.1 on a lenovo notebook
GPU: AMD onboard chip with device OpenCL version 1.2, platform version 2.0.
The kernel is as simple as it can be (it compiles and runs OK, but no output on the console):
#pragma OPENCL EXTENSION cl_amd_printf: enable
__kernel void myKernel() {
printf("hello world");
}
I am aware that CLion is perhaps better equipped to work with GPU/OpenCL (see also: https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000738764-OpenCL-kernel-source-support),
but I believe that it should basically work on IntelliJ IDEA too.
请先登录再写评论。
IntelliJ IDEA does not support C/C# programming.
Here is the feature request for that: https://youtrack.jetbrains.com/issue/CPP-4141
Hi Konstantin. This response falls a bit too short. I don't expect IntelliJ IDEA to support the programming of the GPU Kernel. I am actually working with the OpenCL library of JOCL which is for Java. So, I am working with IntelliJ IDEA in the first place. Example programs (see for example https://github.com/gpu/JOCLSamples) might even include the simple 'play example kernels' as Strings within the Java Code. So, I am supposed to run a GPU program using OpenCL java library as framework. Your statement would simply imply that you can't do programming of GPU without entirely switching to C programming and not Java. I don't think that this is what we want to or should take away as message. Do you know of any project that uses IntelliJ IDEA to develop applications with use of the parallel processing power of graphic cards?
There is a possibility that the fact that print is not shown is the libraries' realization specialty. May you run a sample HelloWorld in the command line via java?
Waiting for your test from here: https://forum.byte-welt.net/t/opencl-on-intellij-idea/22102/4
Yep. it works. see my notes on https://forum.byte-welt.net/t/opencl-on-intellij-idea/22102/4.
See https://forum.byte-welt.net/t/opencl-on-intellij-idea/22102/8.
Case closed. printf("hello world") does not work. It has to be:
printf("%s\n", "hello world");