不说废话,写这篇blog的原因是很高兴看见OCaml的一个分支JoCaml的优越性在一次并行计算优化竞赛中一举成名(在邮件列表和技术博客圈里),翻译老外的话是:一个JoCaml爱好者在一个下午写的JoCaml程序的性能超过了一群Erlang专家不断优化的结果(在我看来,Erlang已经不再是并行计算的第一选择了),而且更惊人的是当一个经过充分手工优化的C程序(其实是C++)出现的时候,JoCaml程序与之相比只有11%的性能差距,而当调整了5行代码之后,JoCaml程序又比C++程序快了1%,这点差别其实考虑到不同的编译器/平台/应用,已经可以忽略不计了。换言之,你完全可以把JoCaml并发程序的性能和经过手工优化过的C++并发程序的性能相提并论。更诱人的是,JoCaml在从多CPU平台扩展到多机平台时,只需要加一行代码(C++程序就麻烦了),而这是 JoCaml优越的并发抽象逻辑所保证的。
这系列并行优化的文章见:http://www.tbray.org/ongoing/When/200x/2007/09/20/Wide-Finder
JoCaml的性能优势:http://www.tbray.org/ongoing/When/200x/2007/10/30/WF-Results
一个被这次优化竞赛的发起人认可的性能总结:“Conclusions about Wide Finder, C++, OCaml, JoCaml, Erlang and friends “ (注意:我不知道为什么这个网站被河蟹咬到了,所以被GFW保护的人民请用标题在google搜索,然后设法穿墙看快照吧)
JoCaml的网站:http://jocaml.inria.fr/
文档:http://jocaml.inria.fr/manual/index.html (推荐这份东西,不过学过一点OCaml语言,看起来会更轻松)
ps. 我正在着手把我的OCaml语言写的神经网络仿真程序改写成JoCaml版,刚在一台4核至强的SUSE服务器上编译完了OCaml和JoCaml的3.10.0版本(both of them),看见这个消息真是振奋人心。最后再次赞美函数式语言在并行计算方面的潜力。
—— Where exceptions happen.
2007年12月21日星期五
在并行计算领域JoCaml小规模小范围的成名了
2007年6月8日星期五
比较OCaml和Haskell的开发效率
|
作者: NullPointer 时间: 06:34 0 留言
Labels: Haskell, OCaml, programming
2007年6月7日星期四
Ocaml资源补遗:OCaml! My Caml!
|
作者: NullPointer 时间: 14:55 0 留言
Labels: OCaml, programming
2007年5月16日星期三
How-to: Build OCaml native code with MSVC 2005
Most Ocaml books, tutorials and lectures would stress its performance. OCaml’s optimizing compiler generates high-performance native code, which I cost a whole afternoon to build.I installed Ocaml 3.09.3 release, and read the “Readme.windows.txt”. I found these evil lines:
" Visual C++ version 6 or later. We use Visual C++ 2003.But... I've installed the free Visual C++ 2005 Express Edition. ╮(﹀_﹀")╭ One way is uninstalling the free MSVC 2005 Express edition, then emule/bt a pirate and out-of-date MSVC 2003. the other is trying to find some workaround. I chose the latter.
The free download Visual C++ 2005 Express Edition works under
Windows 2000, but not under Windows XP because of the "manifest"
annotations on DLLs, which are not yet supported by OCaml.
So, please stick with the 2003 edition for the time being. "
After a long try-err process, I successfully build OCaml into native win32 code with MSVC 2005 version. following is the detail step-by-step:
0. make sure you've installed Ocaml for the port based on the Microsoft toolchain. This guide isn't for Cygwin port.
1. get Visual C++ 2005 Express Edition from Microsoft.com, It's free. and get it's SP1 too.
2. get Microsoft Macro Assembler 8.0 (MASM) Package from Microsoft.com. It's free also.
3. get Microsoft Windows Server 2003 R2 Platform SDK from Microsoft.com. It's free but require you pass the "Windows Genuine Advantage" test.(if you hate this test. you can easily find the SDK ISO on emule...*\(▔▽▔)/*)
4. install 1,2.3.
5. set the PATH environment variable: add "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE;C:\Program Files\Microsoft Visual Studio 8\VC\bin" into the PATH. you may need alter the path as your tools' real install directory.
6. set the LIB environment variable as "D:\Microsoft Platform SDK for Windows Server 2003 R2\Lib;C:\Program Files\Microsoft Visual Studio 8\VC\lib\" you may need alter the path too.
7. Thus you ocamlopt your .ml file, thus all of them. And on the seventh step you ended your work which you had made; and you rested on the seventh step from all your work which you had made. :-P
ps. this How-to guide is writen in an obviously imperative style. Let us rewrite it in functional style:
let PATH = "$Visual Studio$\VC\bin; $Visual Studio$\Common7\IDE"
let LIB = "$Platform SDK$\lib; $Visual Studio$\VC\lib"
Functional style is really short and clear. :-)
作者: NullPointer 时间: 19:58 1 留言
Labels: 技术, OCaml, programming
OCaml resources
Chosen OCaml for my neural network simulation, these days I greedily collected OCaml resources all the Web just as a spider. Wish the following links help other OCaml-rookies. Intro: Manual: Lecture: Tutorial: Code: IDE: Benchmark: News rss: 中文论坛:
Ocaml on Wikipedia ;
Ocaml Homepage
The Objective Caml system release 3.09 (newest ref)
Using, Understanding, and Unraveling: The OCaml Language; (2000, 2001)
http://www.ocaml-tutorial.org/ (this site is resourceful and updated)
"Ocaml for scientist" (Chapter 1) (recommend)
OCaml official codebase: The Caml Hump
Codecodex's OCaml Category. (this site is very interesting for fans of many kinds of language , not including Haskell :-p )
OCaml Development Tools (an Eclipse plug-in. released 1.0 at May 10, 2007)
OCaml vs. Java.(Take it for fun!)
Maybe I should use pipes to make one rss for OCaml News….Hmmm
Ocaml china, 一个不错的中文Ocaml论坛,虽然草创,文章和人气都不是很多。但格局和讨论氛围很好:)希望能进一步壮大。
作者: NullPointer 时间: 19:11 3 留言
Labels: 技术, OCaml, programming