From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Damien Mattei Newsgroups: gmane.lisp.guile.user Subject: Re: map-par slower than map Date: Fri, 11 Nov 2022 14:37:48 +0100 Message-ID: References: <5608809c-89a2-118c-5c05-c46ac3a0e21b@posteo.de> <87mt8yoi0u.fsf@laura> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35300"; mail-complaints-to="usenet@ciao.gmane.io" Cc: guile-user , Olivier Dion To: Zelphir Kaltstahl Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Fri Nov 11 14:38:29 2022 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1otUEm-0008uL-DG for guile-user@m.gmane-mx.org; Fri, 11 Nov 2022 14:38:28 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otUES-0003k1-Ls; Fri, 11 Nov 2022 08:38:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1otUEO-0003iF-Mo for guile-user@gnu.org; Fri, 11 Nov 2022 08:38:06 -0500 Original-Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1otUEM-00062I-Jp for guile-user@gnu.org; Fri, 11 Nov 2022 08:38:04 -0500 Original-Received: by mail-ej1-x62e.google.com with SMTP id q9so12774763ejd.0 for ; Fri, 11 Nov 2022 05:38:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=mCd3QC+FzEsYbVnnOd6Tf+j7rAg5PcLeQAWKHVIqGx4=; b=cjzO+PUlBQBoJZbGW208mV9KtldHSUejC5SfA68hQnNpX2eqms4dqp6Manytacdg8p QdaEvWpB7ICcSoba5QLNZZrv3hjN+WzSQPrE7QRlvqf2mc3G7WxgcaXsMcojjgUFaJDx pmPkIGQArsh0PY9OJQ74y0eR/NBZHzEyWLuafAgAfXxFZF4rfSQoBdqktclTxoxVHgPe lyWkrhPYNNcoi7R9k9Vuy5AM54XNavNS5X7uvl99KW6lVFRt7p79RWTyLoMLRnBH19Mq vpLysK9U0rAvgfIKNJkAyUO55DYn00FfqVojw8jkBPXAU1O1kRUdpQnwrOCOS7Pc3a7k aPvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=mCd3QC+FzEsYbVnnOd6Tf+j7rAg5PcLeQAWKHVIqGx4=; b=BIlLeu3KMAb6wEch95L/niU7mdN3aQQmzOODOFYuSKlIPEYEFbuKN0mNaseIMA/gn1 J8J+aSaH80rQCuiHYupzX5mNFJcvCELq76tDkbEYs2/+PElx81s6IMO5YDiIsL+wNugl ecv2bdURz88bU0KACkWNlV60PwRCxpbjXC3N+2one9EnrEDqzLt0yazdINGGrPEXEZZo Mpwxk7Oqa+R0bj1NQcp6p7Wahy+gC5Ac9MkGd5cDuXTasHgq4vYSLiN6chzjEHQgGjwj xkCwo0dEehaEBG6zFz0rsdR7nH2O2VuZ2pNn6Vwc3ysW7s2z5exuK3G8gzecCzl73oHM CgWg== X-Gm-Message-State: ANoB5pl5+Cjxifeyt9ihaKZZc2ILZL+wTrEaPg9QqV0x2JHuDw/v4QFe MkutcWsljGPGlYtJIdKiKW+K3RMUrosZOQxDAvY= X-Google-Smtp-Source: AA0mqf5K95UZe8pQNtGO2BrwjVVByX+08FYKj+rIx2U5LDnfWs+s3zHPs4gOmzopyhn7xaUn39V1CTFUQ6hSkZlSnc0= X-Received: by 2002:a17:906:3ad1:b0:7a7:5e38:ca28 with SMTP id z17-20020a1709063ad100b007a75e38ca28mr1715539ejd.539.1668173880238; Fri, 11 Nov 2022 05:38:00 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::62e; envelope-from=damien.mattei@gmail.com; helo=mail-ej1-x62e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:18724 Archived-At: in the previous mail ,read: It seems again that only with this code Guile Racket can make another thread only when the previous is finished (after touch)... On Fri, Nov 11, 2022 at 2:36 PM Damien Mattei wrote: > Hi Zelphir, > > > On Fri, Nov 11, 2022 at 1:25 PM Zelphir Kaltstahl < > zelphirkaltstahl@posteo.de> wrote: > >> >> Note, that threads in Guile and Racket are different: >> >> >> https://docs.racket-lang.org/reference/eval-model.html#%28part._thread-m= odel%29 >> : >> >> > Racket supports multiple threads of evaluation. Threads run >> concurrently, in the sense that one thread can preempt another without i= ts >> cooperation, but threads currently all run on the same processor (i.e., = the >> same underlying operating system process and thread). >> > > oh! that is the reason with Racket of no speed up. > > https://www.gnu.org/software/guile/manual/html_node/Threads.html: >> >> > The procedures below manipulate Guile threads, which are wrappers >> around the system=E2=80=99s POSIX threads. For application-level paralle= lism, using >> higher-level constructs, such as futures, is recommended (see Futures). >> > yes but futures seems to block on touch with guile, the same code under > Racket,do not show speed up, it display a different output: > run-in-parallel : making future > run-in-parallel : touching future > run-in-parallel : making future > run-in-parallel : touching future > run-in-parallel : making future > run-in-parallel : touching future > run-in-parallel : making future > run-in-parallel : touching future > run-in-parallel : making future > run-in-parallel : touching future > run-in-parallel : making future > run-in-parallel : touching future > it is different from the guile ouput. > It seems again that only with this code Guile can make another thread whe= n > the previous is finished (after touch)... > > The code is this one: > > https://github.com/damien-mattei/library-FunctProg/blob/master/racket/log= iki%2B.rkt#L3012 > > > https://github.com/damien-mattei/library-FunctProg/blob/master/racket/log= iki%2B.rkt#L3331 > > i do not think it could work faster if i cannot access to others CPUs lik= e > in OpenMP > or this: > https://en.wikipedia.org/wiki/Processor_affinity > but it is not existing with Scheme. > > Best Regards, > Damien > >> I believe another word for Racket's threads is "green threads". They are >> like (more like?) Python threads, and do not run on another core. If you >> start multiple Racket threads on the same Racket VM, they will run all o= n >> the same core. No speedup to be expected, unless you would be waiting fo= r >> IO or something, if you did not use threads. Racket threads are concurre= nt, >> but not parallel. >> >> I think Racket's threads' nature is the answer to why it is slower than >> single threaded execution. >> >> Regards, >> Zelphir >> >> -- >> repositories: https://notabug.org/ZelphirKaltstahl >> >>