当前位置: 动力学知识库 > 问答 > 编程问答 >

.net - How native is OpenCL in Java?

问题描述:

I see there is an OpenCL binding for Java. Does this enable one to truly program in Java, using CPU / GPU etc. as processing cores, or does it merely give Java apps access to C++ OpenCL enabled methods?

Out of interest, is there an OpenCL binding for .Net?

网友答案:

What exactly would a C++ OpenCL enabled method be? In c++ you have access to the api functions to create contexts/buffers/kernels/..., but the code to be executed on the gpu has to be written in the OpenCL C language and distributed as source with the application (meaning OpenCL is not all that native in C++ either). From what I have seen so far this is the situation for java too (so its as native or not native as c++ in that regards, except that c++ is a bit closer to the used C dialect then java (but not compatible).

While it should be possible to create a OpenCL C source from a compiled java class and feed that to the compiler, its quite a bit of efford to create a Compiler java bytecode <-> OpenCL C, so I'd think it will take some more time till that kind of solution appears. Furthermore there would be all kind of (seemingly abitrary) restrictions on the code which could be fed into this system (e.g. no recursion). However if I recall correctly a somewhat native solution for python already exists, so it might not take that long.

Of course I don't know every single Java library and using OpenCl with java is not on my to do list right now, so I might be wrong about there not being "native" bindings.

There are bindings for .Net, e.g. http://sourceforge.net/projects/cloo/

分享给朋友:
您可能感兴趣的文章:
随机阅读: