通用Lisp并行编程 [英] Common Lisp Parallel Programming

查看:224
本文介绍了通用Lisp并行编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Common Lisp中并行实现我的粒子滤波算法。粒子滤波和采样可以并行化,我想为我的4核机器做这个。我的问题是并行编程是否可行在CL或者如果可行的是有任何良好的读数,有关开始并行计算在CL中的教程。

I want to implement my particle filtering algorithm in parallel in Common Lisp. Particle Filtering and sampling can be parallelized and I want to do this for my 4-core machine. My question is whether programming in parallel is feasible in CL or not and if it is feasible are there any good readings, tutorials about getting started to parallel computing in CL.

推荐答案

绝对可行!

波尔多线程项目提供了许多实现的线程原语;我建议使用它而不是SBCL的实现特定的原语(特别是如果你不在SBCL!)。

The Bordeaux Threads project provides thread primitives for a number of implementations; I would suggest using it instead of SBCL's implementation-specific primitives (especially if you aren't on SBCL!).

线程原语是由bt提供的,相当原始。我使用并喜欢 Eager Future2 ,它基于bt提供使用futures的并发功能。您可以创建懒惰,热切(立即)或推测性计算的期货。投机期货由线程池计算,线程池的大小可以自定义。

The thread primitives are provided by bt are, however, quite primitive. I've used and enjoyed Eager Future2 which builds on bt to provide concurrency features using futures. You can create futures that are computed lazily, eagerly (immediately), or speculatively. The speculative futures are computed by a thread pool whose size can be customized.

我开始一个小项目提供并行版本的CL函数使用EF2,但它只有三个函数,到目前为止,所以它不会有太多的使用任何人。我当然欢迎其他编程人员对其进行攻击并提交pull请求,我希望在将来对它进行更多的工作。

I started a little project to provide parallel versions of CL functions using EF2, but it's only about three functions so far, so it won't be of much use to anyone. I do of course welcome other coders to hack on it and submit pull requests, and I hope to do more work on it in the future.

有很多其他库< a href =http://www.cliki.net/concurrency>在Cliki上列出,我没有尝试过。

There are many other libraries listed on Cliki that I haven't tried myself.

至于教程,我不知道任何,但提供的并发功能也在其他语言中找到,良好的算法和实践通常不是语言特定的。

As far as tutorials, I don't know of any, but the concurrency features provided are found in other languages as well and good algorithms and practices are not generally language-specific.

如果您有兴趣阅读一本书,我建议您使用「并发C程式语言」。 作者描述了一种基于C的新的编程语言,并行性作为语言特性。当然,由于CL的本质,可能有可能实现这些功能,而不诉诸创建一个新的编译器。在我看来,本书提供了优秀的并发概念,并解决了在编写并发程序时可能遇到或未能考虑的许多问题。

If you're interested in reading a book, I recommend The Concurrent C Programming Language. The authors describe a new programming language, based on C, with concurrency as a language feature. Of course, due to the nature of CL, it would likely be possible to implement these features without resorting to creating a new compiler. In my opinion the book presents excellent concurrency concepts, and addresses many of the problems you may encounter or fail to consider in writing concurrent programs.

这篇关于通用Lisp并行编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆