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:36:14 +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="31505"; 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:37:44 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 1otUE4-0007wA-4A for guile-user@m.gmane-mx.org; Fri, 11 Nov 2022 14:37:44 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otUCz-0002MY-8k; Fri, 11 Nov 2022 08:36:37 -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 1otUCu-0002Go-2F for guile-user@gnu.org; Fri, 11 Nov 2022 08:36:32 -0500 Original-Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1otUCr-0004qL-0C for guile-user@gnu.org; Fri, 11 Nov 2022 08:36:31 -0500 Original-Received: by mail-ej1-x630.google.com with SMTP id f27so12684013eje.1 for ; Fri, 11 Nov 2022 05:36:28 -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=bZlxxJdg4b8JYo1URkgSk1LjyCl7abgRyTe5eK+A5ek=; b=XdG+83VqHmcaBAaZtoHhi0HRpcl5nmFLJhou0aMPl1j1l/YPsAv9iM+HrSJMncQpsM UEJ5AA0vBQwCDZe/m2Mh9xtV4oghfijlBA7BCJCvN/2eO7A+edQkbPtVVjD61ewNLNDP J5hYlx+eDRmHfa0BFPR1uedqHOrqOiYJmPs2xT3OMEB1NyzkKJik6H/Oz9FKO9oJhXli KtSocDbyL5PsnmYR6ibg/2xO2ip4Wm/MZqnQXAaiFLKllNSSqfQleO41Za3F7MVzVZOo 0dGEjdf/aLpxxfBisaQSWtPYCBRoCbP18ahPed/0Mpyuw2jEoURHQ8wpYPYKeJqlDq5u K1cA== 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=bZlxxJdg4b8JYo1URkgSk1LjyCl7abgRyTe5eK+A5ek=; b=HKwVw16462LeqAYfR72FbW++Vk2YTWEfFQLJN1YBLkPlj+OdUkqssWQgqRi2XmdeDl i2J92Y7fYkLij3s8JjLouUN0llLUBateExYuLuWhTl+nJCX3wpavD6Dmf8a4UlFwfJxI yv1/1Kkyl1NAFPFUdVdFlF/EUGLNKN1hVqUvPWd3+oxbaP/WaVC4MZsZg7DT8hXvp7iS FaOA58fJ/hfgjvdI6rqxluxzJkDCG4oWG4z9RHKwrU2KvlvRicQPeW5iEq8pRNu8HG0j wOL6I+ZCvlovi1yHzcTzr7clAFL8FEdpDCmiZr7S/dHOAMLwXQ+fMlKFeJTymr+DOO12 IJhw== X-Gm-Message-State: ANoB5pn53EqJvv5c+gmVr6vS6YbSqPvAUh4pquZ4V6U91t5da0Ir7aCA lFaoo6ijQnDrs2gZChchZlvFBxfmFZolob6LH8U= X-Google-Smtp-Source: AA0mqf4EGG6L3QrwYFwpfhh/aniH63w2GpFabStUvpvV/wOqx8aQjiHZGIxaKYr3x3+pgqOS5A+tCvFAZtXI5Tkeik0= X-Received: by 2002:a17:907:7681:b0:78d:d10b:4bd5 with SMTP id jv1-20020a170907768100b0078dd10b4bd5mr1836138ejc.467.1668173786071; Fri, 11 Nov 2022 05:36:26 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::630; envelope-from=damien.mattei@gmail.com; helo=mail-ej1-x630.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:18723 Archived-At: 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-mo= del%29 > : > > > Racket supports multiple threads of evaluation. Threads run > concurrently, in the sense that one thread can preempt another without it= s > cooperation, but threads currently all run on the same processor (i.e., t= he > 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 aroun= d > the system=E2=80=99s POSIX threads. For application-level parallelism, us= ing > 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 when the previous is finished (after touch)... The code is this one: https://github.com/damien-mattei/library-FunctProg/blob/master/racket/logik= i%2B.rkt#L3012 https://github.com/damien-mattei/library-FunctProg/blob/master/racket/logik= i%2B.rkt#L3331 i do not think it could work faster if i cannot access to others CPUs like 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 on > the same core. No speedup to be expected, unless you would be waiting for > IO or something, if you did not use threads. Racket threads are concurren= t, > 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 > >