6

While dividing my application in various tasks and convert it for a multi thread environment, I have realized that fundamentally I've got the base concept wrong: OpenCL is not suited for the kind of operations that I need to do in my app, but only for the mathematical part of the problem.

So at this point I was wondering if I could use MPI to fire up n threads on different devices, and then fire up OpenCL kernels if the device has a GPU.

Is this something that is commonly done, or using MPI exclude OCL and vice-versa?

My objective is to run an app on a computer and use any device attached to it (if present), to increase the computational power and share the task. The task itself is divided between crunching numbers (perfect for OCL), OGL render of the results coming from the data crunching part, UI management and interaction and data management (save, store, replace).

From what I understand MPI is not able to address threads to the GPU like OCL does, but OCL main use is math crunching, so it would not do any good if for example my app needs to access the network to retrieve information, or if it needs to use OGL to plot the results of a thread; in which case the best choice would be MPI.

Any suggestion about a viable option would be more than appreciated.

4

2 回答 2

5

MPI 和 OpenMP 是一种非常标准的 HPC 混合编程模型。对 MPI 和 OpenCL 做同样的事情没有实际或理论上的限制。

MPI 可以处理进程之间的通信,而 openCL 处理 GPU 上的计算密集部分。

一般来说,只要环境一致(相同的操作系统、相同的库版本、相同的架构等),将任何库与 MPI 一起用作多台机器上一组不同进程之间的协调语言是没有限制的。

于 2012-10-31T01:52:33.320 回答
5

这绝对是可行的(见这个问题和答案)。MPI 真正做的就是生成程序的多个实例并处理它们之间的通信。它不关心在每个单独的节点上本地执行的操作。例如,有一次我编写了一个 MPI 程序,其中主进程使用 Qt 来可视化它从工作人员那里收到的数据。

于 2012-10-31T01:47:54.090 回答