本文介绍了加速和修复有不同的用例吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在玩Repa和加速 - 他们都很有趣,但我无法解决什么时候使用一个,什么时候使用另一个。他们是一起增长,竞争对手,还是只是为了不同的问题?解决方案

维修是一个库,用于高效的阵列构建和遍历,编程在Haskell中运行,并在Haskell运行时运行。 Repa依靠GHC的优化器和线程来提高性能。您可以将任意Haskell代码与Repa(Repa函数,如 map 以Haskell函数作为参数)混合使用。



加速是GPU编程的嵌入式语言。加速依赖于自己的编译器和GPU并行性来提高性能。使用Accelerate库的一段代码实际上并不执行数组计算。它生成一个Accelerate程序,该程序由Accelerate自己的编译器处理,生成实际处理数组数据的代码。



如果要在Haskell中编程GPU,Accelerate是主要选择。如果你想让你的代码在CPU上运行,那么Repa就是要走的路。 Accelerate不会生成多核代码。它的架构可以支持另一个目标,但据我所知,使用加速器支持CPU的动机很低,因为竞争越激烈。 >编辑:黑曜石和尼古拉是GPU编程的替代品。从对文件的简要调查来看,黑曜石的范围似乎更窄;它可以以(f> => g> => h)的形式表示管道。 Nikola的功能集似乎更接近Accelerate's。我没有经验来真正比较它们。


I've been playing around with Repa and Accelerate - they're both interesting, but I can't work out when I'd use one and when the other. Are they growing together, rivals, or just for different problems?

解决方案

Repa is a library for efficient array construction and traversal, programmed in Haskell and run in the Haskell runtime. Repa relies on GHC's optimizer and threads for performance. You can mix arbitrary Haskell code with Repa (Repa functions such as map take Haskell functions as parameters).

Accelerate is an embedded language for GPU programming. Accelerate relies on its own compiler and GPU parallelism for performance. A piece of code using the Accelerate library doesn't actually do array computation. It generates an Accelerate program, which is processed by Accelerate's own compiler to generate the code that actually processes your array data.

If you want to program GPUs in Haskell, Accelerate is the primary option. If you want your code to run on CPUs, Repa is the way to go. Accelerate doesn't generate multicore code. It's architected in a way that could support another target, but as far as I can tell, the motivation to support CPUs with Accelerator is low because there's more competition.

Edit: Obsidian and Nikola are alternatives for GPU programming. From a brief investigation of the documentation, Obsidian seems narrower in scope; it can express pipelines in the form (f >=> g >=> h). Nikola's feature set appears to be closer to Accelerate's. I don't have the experience to really compare them.

这篇关于加速和修复有不同的用例吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-11 02:53