Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个用 Java 编写的程序,其中涉及大量的多维数组。我正在尝试使用 JOCL (OpenCL) 对其进行并行化,但是在传递给 OpenCL 之前,必须将多维数组转换为一维数组。
除了用一维数组重写整个程序,还有其他的解决办法吗?
当我有多维数组时,这是我在 C++ 中所做的:
for (int i = 0 ; i < n ; i++) { queue.enqueueWriteBuffer(buffer, CL_FALSE, i*m*sizeof(int), m*sizeof(int), data[i]); }
当我需要阅读时也是如此,只是在你的内核中小心你的索引。
你不能在 Java 中做同样的事情吗?