From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,3a6a9f1d654285ba X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!g23g2000vbr.googlegroups.com!not-for-mail From: jonathan Newsgroups: comp.lang.ada Subject: Re: Ada Shootout program for K-Nucleotide (patches) Date: Wed, 19 Aug 2009 12:22:02 -0700 (PDT) Organization: http://groups.google.com Message-ID: <7bb94c7b-4507-4567-8183-d0a2aabc602f@g23g2000vbr.googlegroups.com> References: <4a743343$0$32674$9b4e6d93@newsspool2.arcor-online.net> <4bc4b12d-40f8-4140-8ef6-326d9e6b8adf@k30g2000yqf.googlegroups.com> <4a897b61$0$30221$9b4e6d93@newsspool1.arcor-online.net> <4d48b846-bb2d-4126-86c2-487b2244c9ad@d4g2000yqa.googlegroups.com> <4a8c119d$0$31866$9b4e6d93@newsspool3.arcor-online.net> NNTP-Posting-Host: 143.117.23.126 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1250709722 12604 127.0.0.1 (19 Aug 2009 19:22:02 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 19 Aug 2009 19:22:02 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: g23g2000vbr.googlegroups.com; posting-host=143.117.23.126; posting-account=Jzt5lQoAAAB4PhTgRLOPGuTLd_K1LY-C User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-GB; rv:1.9.0.12) Gecko/2009072220 Iceweasel/3.0.6 (Debian-3.0.6-1),gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:6907 Date: 2009-08-19T12:22:02-07:00 List-Id: Quick report on the the multitasking version of knucleotide, using an 8-core machine. Running on a single core, (single worker task) it takes 35 seconds (same as the task-free version of knucleotide): Split_Work: array (1 .. 1) of Writer; begin Split_Work(1).Set (Nucleotide_Length => 1); Split_Work(1).Set (Nucleotide_Length => 2); Split_Work(1).Set (Fragments.Length (Fragment_3), Fragment_3); Split_Work(1).Set (Fragments.Length (Fragment_4), Fragment_4); Split_Work(1).Set (Fragments.Length (Fragment_6), Fragment_6); Split_Work(1).Set (Fragments.Length (Fragment_12), Fragment_12); Split_Work(1).Set (Fragments.Length (Fragment_18), Fragment_18); time ./knucleotide < fasta250.dat real 0m35.267s user 0m35.002s sys 0m0.252s Using 4 worker tasks, it takes 13.6 seconds (best result). But come to think of it, if there is a fifth env task aiding execution, then it may benefit from the fact that there are 8 cores on my machine. Tasking overhead is negligible. Split_Work: array (1 .. 4) of Writer; begin Split_Work(3).Set (Fragments.Length (Fragment_12), Fragment_12); Split_Work(4).Set (Fragments.Length (Fragment_18), Fragment_18); Split_Work(1).Set (Nucleotide_Length => 1); Split_Work(2).Set (Nucleotide_Length => 2); Split_Work(1).Set (Fragments.Length (Fragment_3), Fragment_3); Split_Work(2).Set (Fragments.Length (Fragment_4), Fragment_4); Split_Work(1).Set (Fragments.Length (Fragment_6), Fragment_6); time ./knucleotide < fasta250.dat real 0m13.653s user 0m35.478s sys 0m0.288s I have put my version of the 1-core knucleotide.adb at http://web.am.qub.ac.uk/users/j.parker/ in directory bench_depository. I made an attempt to prettify the text to my tastes, then lost steam. It seems to be identical to the new multicore version. The only difference is a marginally stronger hash_function, which I played with out of curiosity. (Concluded that overhead from calculating H is essentially insignificant, certainly compared to benefit of avoiding collisions.) for J in 1 .. Key.Last loop H := Character'Pos (Key.Data (J)) + H * 2**3 + H * 2**6 + H * 2**11 - H; end loop; return Hash_Type'Base (H mod Uns_32(Hash_Type'Last + 1)); The older one, which may be better on more general (ie longer) strings, and it is cetainly safer: someone verified that it works in general. Jonathan