From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.bugs Subject: bug#14756: threads - par-map - multicore issue Date: Tue, 28 Feb 2017 10:53:39 +0100 Message-ID: <87fuiyproc.fsf@pobox.com> References: <20130630150054.07f19f35@capac> <87lh1z592a.fsf@pobox.com> <87vb13c55g.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1488275661 25974 195.159.176.226 (28 Feb 2017 09:54:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 28 Feb 2017 09:54:21 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: 14756@debbugs.gnu.org To: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Tue Feb 28 10:54:15 2017 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cieTx-0005dr-Ah for guile-bugs@m.gmane.org; Tue, 28 Feb 2017 10:54:14 +0100 Original-Received: from localhost ([::1]:59785 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cieU3-0001i5-7L for guile-bugs@m.gmane.org; Tue, 28 Feb 2017 04:54:15 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56225) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cieTu-0001gw-SG for bug-guile@gnu.org; Tue, 28 Feb 2017 04:54:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cieTq-0000W1-3r for bug-guile@gnu.org; Tue, 28 Feb 2017 04:54:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60871) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cieTq-0000Vu-0y for bug-guile@gnu.org; Tue, 28 Feb 2017 04:54:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cieTp-00087O-Lg for bug-guile@gnu.org; Tue, 28 Feb 2017 04:54:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Andy Wingo Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 28 Feb 2017 09:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14756 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 14756-submit@debbugs.gnu.org id=B14756.148827563231186 (code B ref 14756); Tue, 28 Feb 2017 09:54:01 +0000 Original-Received: (at 14756) by debbugs.gnu.org; 28 Feb 2017 09:53:52 +0000 Original-Received: from localhost ([127.0.0.1]:59070 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cieTg-00086v-Aj for submit@debbugs.gnu.org; Tue, 28 Feb 2017 04:53:52 -0500 Original-Received: from pb-sasl1.pobox.com ([64.147.108.66]:54793 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cieTe-00086k-CW for 14756@debbugs.gnu.org; Tue, 28 Feb 2017 04:53:50 -0500 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-sasl1.pobox.com (Postfix) with ESMTP id 7D9D25F838; Tue, 28 Feb 2017 04:53:48 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=sasl; bh=J8TMkdKRAO7N t6ObTCVsSe8mhSU=; b=o5wbuiVF9AXk7nGEXUy8rDehPEK4hDiXkwVx2yMz1zYn 1678CVeHuFtMlZAWYlP7XxfRePWCSBlGaC0L/agdwds76x81EOysNPri2ktmrptM be5gbMEaWOzMJA4YU1vIC+8dqLhHZYFhDntPToFnQ+9g4LlqwPi3DEqhguhm6UM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=sasl; b=DDIIvg 1+FcpixOsssE9EMEhl07geKt/Iwn0jDqlOnLOr4bNwPrGUqoPJb9e9D9S1Qh+RVq WkQEUOEeFl7Kp0kwYgu0YFcd9EJOszbS5PGAL4JnZ1AxuIDtKGjNTO9A3hwuKuie 0q8ZhgzBc9cUlcmaS/ViryXhkxv8qMS91Sshw= Original-Received: from pb-sasl1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-sasl1.pobox.com (Postfix) with ESMTP id 6AAA75F836; Tue, 28 Feb 2017 04:53:48 -0500 (EST) Original-Received: from clucks (unknown [88.160.190.192]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by pb-sasl1.pobox.com (Postfix) with ESMTPSA id 1F93F5F835; Tue, 28 Feb 2017 04:53:47 -0500 (EST) In-Reply-To: <87vb13c55g.fsf@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Tue, 21 Jun 2016 10:33:47 +0200") X-Pobox-Relay-ID: CC81A62A-FD9B-11E6-8C80-CDEC6462E9F6-02397024!pb-sasl1.pobox.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.org gmane.lisp.guile.bugs:8575 Archived-At: On Tue 21 Jun 2016 10:33, ludo@gnu.org (Ludovic Court=C3=A8s) writes: > Andy Wingo skribis: > >> I see this, but I'm not quite sure what's going on. What I do see is >> that par-map of 1+ on a list is horribly slow, both on 2.0 and master. >> Ludovic do you know what's going on here? > > As David put it, only one core is being used, which is clearly a bug. > > I believe the bug was introduced by > 8a177d316c0062afe74f9a761ef460e297435e59 (however, before that commit, > you would hit a stack overflow when doing =E2=80=98par-map=E2=80=99 on a = large-enough > list.) Given that Guile 2.2. doesn't have a stack limit problem, I have reverted this commit on master (though I kept the tests). FWIW Guile 2.0 with this test $ time ../guile-2.0/meta/guile -c '(begin (use-modules (ice-9 threads)) = (par-map 1+ (iota 40000)))' real 1m45.282s user 1m45.208s sys 0m0.036s Guile 2.1.x with the stack-limit stuff: $ time /opt/guile/bin/guile -c '(begin (use-modules (ice-9 threads)) (pa= r-map 1+ (iota 40000)))' real 0m51.738s user 1m2.720s sys 0m0.116s Guile 2.1.x after reverting the patch: $ time meta/guile -c '(begin (use-modules (ice-9 threads)) (par-map 1+ (= iota 40000)))' real 0m1.403s user 0m1.396s sys 0m0.024s Note that I took a zero off the original test in all examples above. However! I still have the problem that mostly only one core is used. I would imagine that is because the thread that builds the spine is more costly than the threads that actually do the workload (the 1+ in this case). But maybe that is wrong. Certainly there are improvements that can be made in the futures implementation in 2.2 with atomic boxes. Andy