简体   繁体   English

使用Java在OpenCL上运行C应用程序-可能吗?

[英]Run C application on OpenCL using Java - possible?

I only have knowledge of Java for NeuralNetworks, GAs and some graphical interfaces work. 我只有Java for NeuralNetworks,GA和一些图形界面的知识。 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? 我有一个简单的问题,关于OpenCL + Java + C可以实现什么。我知道您可以在Java中运行C,但是我想做的是运行第三方C应用程序(对此我没有源代码)通过Java,足够简单-但由于需要大量计算,我想让C应用程序在使用OpenCL的GPU上运行-这可能吗? I know there are some libraries such as JavaCL etc. 我知道有一些库,例如JavaCL等。

Ideally the workflow would be something like: 理想情况下,工作流程应为:

1.Java App forces C application to run on GPU using OpenCL. 1. Java App强制C应用程序使用OpenCL在GPU上运行。

2.Java App sends commands to C application with Data and Parameters 2. Java App使用数据和参数将命令发送到C应用程序

3.Java App uses OpenCL library to manage C application threads. 3. Java App使用OpenCL库来管理C应用程序线程。

4.Java App could initialise multiple instances of the C app? 4.Java App可以初始化C app的多个实例吗?

5.C App processes Data and returns to Java App. 5.C App处理数据并返回Java App。

6.Java App visualises data. 6.Java App可视化数据。

Thanks for any help or advice. 感谢您的帮助或建议。 Cheers, Patrick. 干杯,帕特里克。

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). 不可以,如果您有使用纯C语言编写的第三方二进制程序,则无法使用OpenCL(或任何其他方法)在GPU上运行该程序。 That binary will be using a CPU instruction set (x86, ARM etc) that will not compatible with whatever instruction set the GPU uses. 该二进制文件将使用与GPU使用的任何指令集都不兼容的CPU指令集(x86,ARM等)。 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. 您将需要使用OpenCL(或其他支持GPU的语言+ API)重写计算量大的代码,以使其在GPU上运行。

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. 我使用LWJGL来满足Java OpenCL的需求,它的工作原理非常好,并且对于几乎完全相同的C ++-> Java实现来说非常简单。

Source: http://lwjgl.org/wiki/index.php?title=OpenCL_in_LWJGL 资料来源: http : //lwjgl.org/wiki/index.php?title=OpenCL_in_LWJGL

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 是否可以使用Java创建使用CUDA和OpenCL的混合GPU加速应用程序? - Is it possible to create a Hybrid GPU accelerated application in Java that utilize CUDA & OpenCL? 是否可以在硬件中运行Java应用程序 - Is is possible to run Java application in Hardware 是否可以使用 WildFly 在 Java 应用程序中运行 gRPC 服务器? - Is it possible to run a gRPC server in a Java application using WildFly? 是否可以在Flex应用程序中运行Java程序? - Is it possible to run a Java program inside a Flex application? 是否可以在两个命令行中/作为Web服务运行Java应用程序 - Is it possible to run java application in both commandline / as a webservice 是否可以通过openjdk在android上运行java应用程序 - Is it possible to run java application on android through openjdk 是否可以在 heroku 非 Web Java 应用程序上运行? - Is it possible to run on heroku non web java application? 是否可以在Java swing应用程序中运行osmdroid - Is it possible to run osmdroid in a java swing application 是否可以使用Unix套接字在C应用程序和Java应用程序之间创建通信? - Is it possible to create a communication between C application and Java application using Unix Sockets? 是否可以仅使用 Nginx 服务器运行 Java web 应用程序而不使用 Z1B359D87540678B535BEFA04 - Is it possible to run Java web application using Nginx server only without tomcat server?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM