From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 7C573BBCA for ; Mon, 12 May 2008 20:12:10 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuIBAJokKEjUnw6Fb2dsb2JhbACCMY9cAQwFAgQHEwOZZw X-IronPort-AV: E=Sophos;i="4.27,474,1204498800"; d="scan'208";a="12139367" Received: from pih-relay06.plus.net ([212.159.14.133]) by mail1-smtp-roc.national.inria.fr with ESMTP; 12 May 2008 20:12:10 +0200 Received: from [80.229.56.224] (helo=beast.local) by pih-relay06.plus.net with esmtp (Exim) id 1JvcVN-0004dC-6C for caml-list@yquem.inria.fr; Mon, 12 May 2008 19:12:09 +0100 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Re: Why OCaml rocks Date: Mon, 12 May 2008 19:07:12 +0100 User-Agent: KMail/1.9.9 References: <200805090139.54870.jon@ffconsultancy.com> <200805102059.54856.jon@ffconsultancy.com> <20080512132223.GA24858@annexia.org> In-Reply-To: <20080512132223.GA24858@annexia.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200805121907.12615.jon@ffconsultancy.com> X-Plusnet-Relay: 2238b29258f3fc195a61f72c0f4fc06d X-Spam: no; 0.00; ocaml:01 ocaml:01 parallelism:01 parallelism:01 computations:01 lapack:01 mismatch:01 12%:98 frog:98 polymorphic:01 wrote:01 caml-list:01 functions:01 data:02 inefficient:02 On Monday 12 May 2008 14:22:24 Richard Jones wrote: > This is just barely faster than Jon's OCaml version using message > passing (12% faster on my test machine[0]). On this machine, the Ancient-based implementation is 30-40% faster than the message passing OCaml. The important question is: how many operations must we be doing for parallelism to be worthwhile? The answer is of fundamental importance. Plotting the graphs, we find that parallelism is faster in F# for n>32 and in OCaml for n>150 for this O(n^3) task. Therefore, OCaml is two orders of magnitude slower than F# at spawning parallel computations. Moreover, to get this performance from OCaml you had to sacrifice safety. > Which just seems to show that the overhead of message passing _isn't_ the > problem here[1]. Well, OCaml currently offers several different approaches to parallelism that are all extremely inefficient. The parallel GC implementation being funded by Jane St. will completely remove this performance problem with OCaml in this context but it will not scale as well as Microsoft's concurrent GC and will suffer from the same stalling. This is why I believe that project is of incredible importance. > Perhaps it's the bounds checking in the assignment back to the matrix? Actually it was the polymorphic array maps and copies rather than the bounds checking within them. So I hand rolled optimized float array array copying code into both of the new parallel OCaml implementations to get the best possible performance out of OCaml for the above comparison. > Anyhow, in real life situations we'd all be using a super-optimized > hand-coded-in-assembly matrix multiplication library (LAPACK?), so > this is all very academic. If you ignore the impedance mismatch between the data structures, the performance overhead of invoking external functions and all applications that require different functionality that has not already been written, optimized and packaged by someone else, yes. The fact is, this is hugely important to the vast majority of the software industry and companies are investing massive amounts of time and effort into parallelizing their software. Developers are flocking to .NET because it makes parallelism easy and OCaml has the potential to provide these benefits if the parallel GC project flies. -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/products/?e