From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Mikael Djurfeldt Newsgroups: gmane.lisp.guile.devel Subject: [pthreads] performance test using fib.scm Date: Tue, 10 Dec 2002 19:16:04 +0100 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: Reply-To: Mikael Djurfeldt NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1039546710 19780 80.91.224.249 (10 Dec 2002 18:58:30 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 10 Dec 2002 18:58:30 +0000 (UTC) Cc: djurfeldt@nada.kth.se Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18LpaO-00058j-00 for ; Tue, 10 Dec 2002 19:58:28 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18LpH2-0004Ww-0C for guile-devel@m.gmane.org; Tue, 10 Dec 2002 13:38:28 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18LpGk-0004W3-00 for guile-devel@gnu.org; Tue, 10 Dec 2002 13:38:10 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18LpGd-0004Ti-00 for guile-devel@gnu.org; Tue, 10 Dec 2002 13:38:06 -0500 Original-Received: from kvast.blakulla.net ([213.212.20.77]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18LpGd-0004TD-00 for guile-devel@gnu.org; Tue, 10 Dec 2002 13:38:03 -0500 Original-Received: from mdj by kvast.blakulla.net with local (Exim 3.36 #1 (Debian)) id 18LovM-0003lg-00; Tue, 10 Dec 2002 19:16:04 +0100 Original-To: guile-devel@gnu.org X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Developers list for Guile, the GNU extensibility library List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:1813 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:1813 In the announcement of the pthreads support, I attached a program fib.scm: (define (par-fib n n-forks) (cond ((<= n 1) 1) ((> n-forks 0) (letpar ((f1 (par-fib (- n 1) (- n-forks 1))) (f2 (par-fib (- n 2) (- n-forks 1)))) (+ f1 f2))) (else (let ((f1 (mono-fib (- n 1))) (f2 (mono-fib (- n 2)))) (+ f1 f2))))) (define (mono-fib n) (let iter ((f1 1) (f2 1) (i 1)) (if (>= i n) f2 (iter f2 (+ f1 f2) (+ 1 i))))) When I run this with a Guile compiled with COPT threads, it invariably takes around 12 s to run (par-fib 40000 1) on my dual CPU machine. "Top" reports 50% of CPU capacity usage during calculation. With the new pthreads support (which now allows for real SMP), it takes 2.6 s and top says 91%! Still, for large fibonnaci numbers and large branch depths (many threads), Guile often crashes in realloc. That function should be thread safe, shouldn't it? Maybe we're trashing up the heap somewhere else... Anyone keen on some debugging? :-) Mikael _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel