Java 中 GPGPU/CUDA/OpenCL 的最佳方法?

2022-01-10 00:00:00 cuda opencl gpgpu java

图形处理单元(GPGPU)上的通用计算是一个非常有吸引力的概念GPU 的强大功能可用于任何类型的计算.

General-purpose computing on graphics processing units (GPGPU) is a very attractive concept to harness the power of the GPU for any kind of computing.

我很想将 GPGPU 用于图像处理、粒子和快速几何运算.

I'd love to use GPGPU for image processing, particles, and fast geometric operations.

目前,该领域的两个竞争者似乎是 CUDA 和 OpenCL.我想知道:

Right now, it seems the two contenders in this space are CUDA and OpenCL. I'd like to know:

  • OpenCL 是否可以在 Windows/Mac 上的 Java 中使用?
  • 与 OpenCL/CUDA 接口的库方法有哪些?
  • 是否可以直接使用 JNA?
  • 我是不是忘记了什么?

感谢任何现实世界的经验/例子/战争故事.

Any real-world experience/examples/war stories are appreciated.

推荐答案

AFAIK, JavaCL/OpenCL4Java 是目前唯一可在所有平台上使用的 OpenCL 绑定(包括 MacOS X、FreeBSD、Linux、Windows、Solaris,均采用 Intel 32、64 位和 ppc 变体,这要归功于它使用 JNA).

AFAIK, JavaCL / OpenCL4Java is the only OpenCL binding that is available on all platforms right now (including MacOS X, FreeBSD, Linux, Windows, Solaris, all in Intel 32, 64 bits and ppc variants, thanks to its use of JNA).

它的演示至少在 Mac 和 Windows 上可以从 Java Web Start 正常运行(为了避免 Linux 上的随机崩溃,请参阅 this wiki page,例如这个 粒子演示.

It has demos that actually run fine from Java Web Start at least on Mac and Windows (to avoid random crashes on Linux, please see this wiki page, such as this Particles Demo.

它还带有一些实用程序(GPGPU 随机数生成、基本并行缩减、线性代数)和一个 Scala DSL.

It also comes with a few utilities (GPGPU random number generation, basic parallel reduction, linear algebra) and a Scala DSL.

最后,它是可用的最古老的绑定(自 2009 年 6 月以来)并且 它有一个活跃的用户社区.

Finally, it's the oldest bindings available (since june 2009) and it has an active user community.

(免责声明:我是 JavaCL 的作者 :-))

(Disclaimer: I'm JavaCL's author :-))

相关文章