gpt4 book ai didi

OpenCL:运行 CPU/GPU 多个设备

转载 作者:行者123 更新时间:2023-12-04 14:34:14 25 4
gpt4 key购买 nike

我想使用 OpenCL 多个设备在 GPU 和 CPU 上运行并行任务。 AMD SDK 的标准示例在这个问题上不是很清楚。您能否就此主题提供任何其他教程或示例?任何建议都可以。

谢谢你。

最佳答案

在多个设备上运行并行任务需要动态调度以提高效率,因为您永远不知道任何设备的确切性能 - 它取决于当前负载(不仅取决于您的程序,还取决于所有其他设备)、当前时钟(在大多数 CPU 和GPU 取决于当前的节能配置文件或负载)。此外,实际性能可能取决于您的输入数据。

当然,您可以像所有其他答案所建议的那样自己编写所有必要的代码,但在我看来,这是浪费时间,使用现有解决方案更好。我建议使用 StarPU。我在我的 OpenCL 项目中使用了 StarPU,而且效果很好。 StarPU 附带了如何编写能够高效使用多个 GPU 和 CPU 的代码的示例。

StarPU :

Traditional processors have reached architectural limits which heterogeneous multicore designs and hardware specialization (e.g. coprocessors, accelerators, ...) intend to address. However, exploiting such machines introduces numerous challenging issues at all levels, ranging from programming models and compilers to the design of scalable hardware solutions. The design of efficient runtime systems for these architectures is a critical issue. StarPU typically makes it much easier for high performance libraries or compiler environments to exploit heterogeneous multicore machines possibly equipped with GPGPUs or Cell processors: rather than handling low-level issues, programmers may concentrate on algorithmic concerns.



还有一个项目,SkePU,不过我自己没试过:

SkePU :

SkePU is such a skeleton programming framework for multicore CPUs and multi-GPU systems. It is a C++ template library with six data-parallel and one task-parallel skeletons, two container types, and support for execution on multi-GPU systems both with CUDA and OpenCL. Recently, support for hybrid execution, performance-aware dynamic scheduling and load balancing is developed in SkePU by implementing a backend for the StarPU runtime system.



如果您在 Google 上搜索“动态调度 gpu cpu opencl”,您可以找到更多可能有用的免费或商业项目和文档。

关于OpenCL:运行 CPU/GPU 多个设备,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5647795/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com