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: Sun, 13 Nov 2022 09:23:12 +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="2467"; mail-complaints-to="usenet@ciao.gmane.io" Cc: guile-user Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sun Nov 13 09:24:16 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 1ou8Hn-0000SC-UO for guile-user@m.gmane-mx.org; Sun, 13 Nov 2022 09:24:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ou8H3-00039z-FM; Sun, 13 Nov 2022 03:23:29 -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 1ou8H2-00039p-Li for guile-user@gnu.org; Sun, 13 Nov 2022 03:23:28 -0500 Original-Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ou8H0-00052G-9L for guile-user@gnu.org; Sun, 13 Nov 2022 03:23:28 -0500 Original-Received: by mail-ej1-x629.google.com with SMTP id ft34so21471375ejc.12 for ; Sun, 13 Nov 2022 00:23:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=WAtHLs8DgywusvQ7O4tC0tUe+/Rz/b/jf5P+RvddAXM=; b=fjgI+/RPUYtp5EdQpjn2s5OBepvuFe73bQjv5cdb3YNNl9ftWuSqyqIhNRS+NFvejo nVzIeEMGwSTO3DYrtqS64xSVuVfHYDjxeLHquxwBYR0HB2tGCAGJG/YjWOAki/1qelqK 9ZZt/ywxwK4soCCwcaAsZrHYzBc2ZBcHgQT5KVwNMQBFtEC1HSU9/EC67QT4MaRZMp/J fCUzCg9utxlyFc67Q8t0+AUYJLmQMQF6iiWCGt7UIwPzn/2T25Ouu/O+jngldeUCqhGm R2ClflgDyCTftuAm+/eBtKTJZDJuBrWt/HA9y+zbWC7/dWJM9MOVLORiMopwr3SCs+Ke VkoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc: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=WAtHLs8DgywusvQ7O4tC0tUe+/Rz/b/jf5P+RvddAXM=; b=ROHKRGUcIOe9V2LtklsbU0zI3OYwfeGX6CpNl+NurHSRw6U0HPPxdMtBvSHP0O6T9k aey98w+5lMhi/XXzQuLL6TzKEawkRyTa/H4woTlCrRhKifYHqWen91K5QYqcH2gQLx9e MFTd6jkk+RsX+vouPK14Hefcn8lgqO7AxVvBguqwNeO0HvMCAuANinOoBCMxQHQs9XSh vFB9bbIErpKsRX1LdGHENAX0Ogg6MRaVXpBdpQrMXslorr7pbEL+b5QeiQn3IOqoIyWL pX7EMNH8GOhzUvPeOfpqJ+ip6W7tA97VOqQiT1V0/bVg1KzyNMK0kn3fROJKzIq9s1mu 2H9w== X-Gm-Message-State: ANoB5plu6OaT3Y5kmhVArSLCp8CPF0Rjubd0X+7DqfG3xiiHOhWUsg99 Q5tup5cguDfEF73QyXia5kBv57qsTF8TS1NzkW+cugNPIM4= X-Google-Smtp-Source: AA0mqf7Wnj4wOcmFZigiqwKx2RoikD3Q7Hjp/5HwSYG5BToxInYh3HX69JNQcQZGJeEftnj2obPEbStOCrIAQ27QDbQ= X-Received: by 2002:a17:907:c08e:b0:7ae:e2fb:c028 with SMTP id st14-20020a170907c08e00b007aee2fbc028mr3247026ejc.539.1668327803884; Sun, 13 Nov 2022 00:23:23 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::629; envelope-from=damien.mattei@gmail.com; helo=mail-ej1-x629.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.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, MISSING_HEADERS=1.021, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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:18733 Archived-At: it just an idea, but i explore the way to fork() my code,use some shared memory (for the minterms vector) to get more system ressource (CPUs), i did not find the equivalent to fork() under unix in Guile or an API to manage shared memory (like in unix) but i read that C and guile can be used together: https://www.gnu.org/software/guile/manual/html_node/Combining-with-C.html but i can not find any example, is there a place i can find more documentation and tutorials about that ? Best Regards, Damien On Fri, Nov 11, 2022 at 2:37 PM Damien Mattei wrote: > 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-= model%29 >>> : >>> >>> > Racket supports multiple threads of evaluation. Threads run >>> concurrently, in the sense that one thread can preempt another without = its >>> 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 parall= elism, 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 >> when the previous is finished (after touch)... >> >> The code is this one: >> >> https://github.com/damien-mattei/library-FunctProg/blob/master/racket/lo= giki%2B.rkt#L3012 >> >> >> https://github.com/damien-mattei/library-FunctProg/blob/master/racket/lo= giki%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 ar= e >>> like (more like?) Python threads, and do not run on another core. If yo= u >>> 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 f= or >>> IO or something, if you did not use threads. Racket threads are concurr= ent, >>> 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 >>> >>>