Question

I only have knowledge of Java for NeuralNetworks, GAs and some graphical interfaces work. I have a simple question that is about what is possible with OpenCL + Java + C. I know you can run C in Java, however what I would like to do is run a third party C application (for which I don't have the source) via Java, simple enough - but I'd like to have the C application run on a GPU using OpenCL because of the amount of calculations require - is this possible? I know there are some libraries such as JavaCL etc.

Ideally the workflow would be something like:

1.Java App forces C application to run on GPU using OpenCL.

2.Java App sends commands to C application with Data and Parameters

3.Java App uses OpenCL library to manage C application threads.

4.Java App could initialise multiple instances of the C app?

5.C App processes Data and returns to Java App.

6.Java App visualises data.

Thanks for any help or advice. Cheers, Patrick.

Was it helpful?

Solution

No, if you have a third-party binary program written in plain C, there is no way to run that program on the GPU using OpenCL (or any other method). That binary will be using a CPU instruction set (x86, ARM etc) that will not compatible with whatever instruction set the GPU uses. You would need to rewrite the computationally expensive code using OpenCL (or some other GPU-capable language + API) to get it run on the GPU.

OTHER TIPS

I know this isn't ideal since you don't have the source, but you might have the kernel or can get it? I use LWJGL for my Java OpenCL needs and it works really well and is dead simple to use with almost exact C++ -> Java implementation.

Source: http://lwjgl.org/wiki/index.php?title=OpenCL_in_LWJGL

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top