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.3 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 331DEBC6B for ; Tue, 18 Sep 2007 15:39:44 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAExy70bAXQImn2dsb2JhbACOEAICBwQGBwgY X-IronPort-AV: E=Sophos;i="4.20,268,1186351200"; d="scan'208";a="16367521" Received: from discorde.inria.fr ([192.93.2.38]) by mail4-smtp-sop.national.inria.fr with ESMTP; 18 Sep 2007 15:40:50 +0200 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l8IDeC5a011537 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Tue, 18 Sep 2007 15:40:12 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAJdx70ZQW+UCh2dsb2JhbACOEAIJCic X-IronPort-AV: E=Sophos;i="4.20,268,1186351200"; d="scan'208";a="973209" Received: from main.gmane.org (HELO ciao.gmane.org) ([80.91.229.2]) by mail1-smtp-roc.national.inria.fr with ESMTP; 18 Sep 2007 15:40:48 +0200 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1IXdJ4-0008HX-Rw for caml-list@inria.fr; Tue, 18 Sep 2007 15:40:02 +0200 Received: from ivr94-8-88-162-26-239.fbx.proxad.net ([88.162.26.239]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 18 Sep 2007 15:40:02 +0200 Received: from li by ivr94-8-88-162-26-239.fbx.proxad.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 18 Sep 2007 15:40:02 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: caml-list@inria.fr From: Zheng Li Subject: Re: [ANN] coThreads 0.10 Date: Tue, 18 Sep 2007 15:40:52 +0200 Message-ID: <87bqc06qhn.fsf@pps.jussieu.fr> References: <87lkb5fe3f.fsf@pps.jussieu.fr> <20070918121041.6683b111.mle+ocaml@mega-nerd.com> <1190095167.22073.54.camel@rosella.wigram> <20070918162347.e04ac421.mle+ocaml@mega-nerd.com> <87y7f473g1.fsf@pps.jussieu.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: ivr94-8-88-162-26-239.fbx.proxad.net User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux) Cancel-Lock: sha1:CJqDkKn2byvz8X7sli9LDYervoQ= Sender: news X-Miltered: at discorde with ID 46EFD53C.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; largefile:01 ocaml:01 intentional:01 yoriyuki:01 yamagata:01 yoriyuki:01 yamagata:01 chopsticks:01 speedup:01 haskell:01 tvar:01 makefile:01 bug:01 bug:01 largefile:01 Hi, Thanks skaller for testing the fix on his machine. Here is a few updates: - I chose the simple fix: just restrict the upper bound of fresh_number based on the word_size of 32bit machine. It's only used to generate fresh number, name and offset, so I suspect the range is fairly enough. On the other hand, it won't be difficult to make use int64 and LargeFile for 64bit machine if necessary, but I'd better to get some x64 machine around for testing first. - A README for /example is added (also attached to the end of this post) - Some minor updates to a few examples - I have no idea what's wrong with the sourceforge file download system. It did work when I uploaded the file a few days ago. Anyway, I re-uploaded the package (with the above modifications), hope it works. Best regards. -- Zheng Li http://www.pps.jussieu.fr/~li README for examples =================== == BUILD == Just ''make all'' after you've got coThreads installed on your system. Type ''make clean'' to remove all imtermediate and final building results. == LIST == * coth (use: Thread (or Cothread), Mutex) Simple test of mutex. A set of threads tries to grab a single mutex and release it for random times * evt (use: Thread (or Cothread), Event) Simple test of event. Most examples are directly from the OCaml OReilly book. The execution won't exist, this is intentional. * lock (use: Thread (or Cothread), Mutex) Simple test of mutex. A set of threads try to grab two mutex. Each thread first must grab the first mutex before the second mutex, then release the second mutex and the first one. * mcast (use: Thread (or Cothread), Stm) STM example from [1], contributed by Yoriyuki Yamagata * merge (use: Thread (or Cothread), Stm) STM example from [1], contributed by Yoriyuki Yamagata * mvar (use: Thread (or Cothread), Stm) STM example from [1], contributed by Yoriyuki Yamagata * phil (use: Thread (or Cothread), Stm) Classical philosophers dinning problem written in STM. Launch it with [./phil n], where n is the number of philosophers and chopsticks. * ray_col, ray_nocol (use: Cothread, Event) Replanted versions of Jon Harrop's ray tracer [3]. ray.ml is the module containing common computation functions, ray_xxx.ml are parallel engines. In ray_nocol.ml, the workers don't send the results back to master, instead they write them directly to the output file; in ray_col.ml, the workers send results back to the master, and the master write them to the output file. Launch it with [./ray_xxx level size degree outputfile], where [level] and [size] are about the quality of output image, and [degree] is the parallel degree which should equal or greater than the cores or cpus of your machine if you'd like to get the most speedup. Or you may just lanch it with [./ray_xxx] which takes the default setting [./ray_xxx 9 512 2 ray_xxx.pgm] * santa (use: Thread (or Cothread), Stm) The Santa Clause problem documented in [2]. The haskell version is attached as comment at the end of the file. * sing (use: Thread (or Cothread), Stm) Simple test of Stm. Two threads constantly update a single tvar. * test (use: Thread (or Cothread), Stm) Simple test of Stm to calculate the sum of [0..n-1] with n threads. The i_th thread is responsible for adding i to the sum. Its action is not allowed to take place until the current sum exceed sum (i/10). * The Makefile itself is an example. It shows that how you can build your applications against a set of execution engines with just a few lines of pattern rules. [1] http://research.microsoft.com/users/simonpj/papers/stm/index.htm#composble [2] https://research.microsoft.com/users/simonpj/papers/stm/index.htm#beautiful [3] http://www.ffconsultancy.com/languages/ray_tracer/index.html Zheng Li writes: > Thank you for the bug report. > > Unfortunately I don't have a x64 machine to test, and know quite little about > 64bit machine (that's why I made the mistake). > > But the bug reason seems obvious: on a x64 machine, one have to use > Unix.LargeFile.lseek to seek the address in the extra space. > > On the other hand, I think 2^14 locks (the x86 case) are fairly enough in > most situation. So we don't have to bother with Int64 and LargeFile. Could you > (or anyone else with a x64 machine) help to test the simple solution: change > "Sys.word_size - 2" in the definition of "fresh_number" to > "(min Sys.word_size 32) - 2" as follows > > let fresh_number = > let usable_size = (min Sys.word_size 32) -2 in > let bits_of_id = 16 in (* Should be sufficient in most OS *) > ........ > > and report whether it works? Thanks