From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 05B97BC37 for ; Sun, 27 Dec 2009 16:24:13 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AigEAFYLN0vUnwckimdsb2JhbACCGCeZGwEBAQoJDAcRBrUfhDMEiVo X-IronPort-AV: E=Sophos;i="4.47,459,1257116400"; d="scan'208";a="40615185" Received: from relay.ptn-ipout02.plus.net ([212.159.7.36]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 27 Dec 2009 16:23:42 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ai4KAN4KN0tUXebq/2dsb2JhbACCGCfOeIQzBIla Received: from relay07.plus.net ([84.93.230.234]) by relay.ptn-ipout02.plus.net with ESMTP; 27 Dec 2009 15:23:42 +0000 Received: from [87.114.35.173] (helo=leper.local) by relay07.plus.net with esmtp (Exim) id 1NOuy5-00053v-Tz for caml-list@yquem.inria.fr; Sun, 27 Dec 2009 15:23:42 +0000 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Re: multicore wish Date: Sun, 27 Dec 2009 16:37:58 +0000 User-Agent: KMail/1.9.9 References: <4B2D2BC1.6020204@msu.edu> <200912241706.51917.jon@ffconsultancy.com> <87bphkk2ke.fsf@frosties.localdomain> In-Reply-To: <87bphkk2ke.fsf@frosties.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200912271637.58280.jon@ffconsultancy.com> X-Plusnet-Relay: 922de778450672a53d3d768dbf8a11f3 X-Spam: no; 0.00; bigarray:01 marshaling:01 stubs:01 bigarrays:01 low-level:01 polymorphism:01 ocaml:01 ocaml:01 vastly:01 parallelism:01 2009:98 pices:98 burdens:98 frog:98 threads:01 On Sunday 27 December 2009 12:45:53 Goswin von Brederlow wrote: > There is one implementation: http://www.algo-prog.info/ocmc/web/ > But as said maybe not a very good one. > > I tried implementing parallel threads under the original GC by forking > multiple instances of the same program and using a Bigarray to mmap > /dev/null for shared memory between the instances. That works for > sharing primitive types, flat records (records of primitive types) and > even fixed (or bound) sized structures but it gets more and more > complex to share each and needs some Obj magic, marshaling or C stubs > (except for primitive types). It works but is a real hack. Once you've conceded to manual memory management (mmap of shared bigarrays) and low-level programming (no polymorphism, Obj.magic) you've lost the main advantages of OCaml and you still cannot get great performance. > I hope someone will pick up the pices and update OCaml4Multicore to > the latest ocaml or maybe for ocaml to add it directly. If not then I > fear ocaml will be left behind soon. Building upon OCaml rather than starting from scratch makes it vastly more difficult to implement a useful parallel GC not just because the GC and code gen must work in harmony together but because OCaml has been so heavily optimized in the wrong direction for this (e.g. a bit twiddled uniform representation that burdens the GC with everything from complex numbers to pairs). That's why I think the best solution is to start from scratch and build a completely separate VM bred for shared-memory parallelism. Indeed, HLVM already outperforms OC4MC even though I have put a fraction of the effort into it and built a lot more surrounding infrastructure. For example, my latest GC only took 5 days to write. -- Dr Jon Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?e