From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Zelphir Kaltstahl Newsgroups: gmane.lisp.guile.user Subject: Re: Guile fibers return values Date: Wed, 15 Jan 2020 01:04:19 +0100 Message-ID: <2d57388b-acd7-0f0e-8468-a064b2d964f9@posteo.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="42580"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 Cc: Guile User To: Amirouche Boubekki Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Wed Jan 15 01:04:41 2020 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1irWAr-000Ain-Cq for guile-user@m.gmane-mx.org; Wed, 15 Jan 2020 01:04:41 +0100 Original-Received: from localhost ([::1]:47466 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1irWAq-00042z-5M for guile-user@m.gmane-mx.org; Tue, 14 Jan 2020 19:04:40 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43433) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1irWAb-00042j-RZ for guile-user@gnu.org; Tue, 14 Jan 2020 19:04:27 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1irWAa-00072G-In for guile-user@gnu.org; Tue, 14 Jan 2020 19:04:25 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]:40469) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1irWAa-0006zc-3n for guile-user@gnu.org; Tue, 14 Jan 2020 19:04:24 -0500 Original-Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 3C80216005C for ; Wed, 15 Jan 2020 01:04:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1579046661; bh=R0tQRBIur0Z1rxJqLCxwR7HPHIo32rxEULhFMjvJNgg=; h=Subject:To:Cc:From:Date:From; b=rLuvtux4FWxdZ70lshWlXMKClpeByvLEO6zGnbEHBlfbmlwbi0cm1pCGiBvisbu2E 6VbDSC0nr3fYqNl7TIJdS76aYzulhleZLOhzqog8XxGu4W+9LUlrnjUHpxCrEgEp3B ceVnCT3BdKnHOnLP8Ct5dAJo3JxLyC3kfMsF89ouKea4y9gga8BmiaYzSeQH1y5nRO gn/BIsSmLn9UV9BoIbURIqkdsPwU4AwtpqEkNkKSAsLTcYV2gJlpDNpZqkph0IjFi+ GDBcv8iNZlkxQX3rmxqafrGfo4cM8zYU8CjS5XlquLJK9vXQAQL4l0ntm2pSlZR7hh DQOQFnecYiwwA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 47y6xw3NFMz6tm7; Wed, 15 Jan 2020 01:04:20 +0100 (CET) In-Reply-To: Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.67.36.65 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.org gmane.lisp.guile.user:16063 Archived-At: Hi Amirouche! I am currently looking into using parallel forms, but am experiencing some trouble with it (see other e-mail about possible bug in parallel forms). I would like to have more control over the maximum number of in parallel running threads, when spawning tasks recursively. Parallel forms do not offer to limit the maximum, except for the expensive parallel forms. And those probably also do not offer it for recursive calls (in a task start again multiple tasks to run in parallel, which is the case for building the tree). I need to look at your code in detail to understand, but from the description or comments it looks promising for my use case. Thanks, Zelphir On 1/14/20 11:59 AM, Amirouche Boubekki wrote: > Hello Zelphir! > > Le sam. 4 janv. 2020 =C3=A0 22:49, Zelphir Kaltstahl > a =C3=A9crit : >> Hello Guile users! >> >> I have questions regarding the usage of the fibers library. It seems, >> that I cannot find any way to get a computation result back from a >> fiber. I also cannot find anything about how to get a value back from = a >> fiber, except for channels. The examples include one example using the >> procedure `make-channel`, to create one channel for a client to send t= o >> a server and one channel to use for the server to send messages to the >> client. >> >> Are channels the only way to get a computation result back from a fibe= r? >> >> Should I be creating channels, which the spawned fiber then can use on >> its own, to asynchronously give me a result? >> >> This is an aside of my actual project currently. I want to parallelize >> some algorithm and want to make use of fibers for that, but in order t= o >> do that, I must understand how to run multiple fibers and get their >> results back. >> >> Can you give me an example, where fibers are used to split up a >> computation heavy task so that it is sped up, because of running on >> multiple cores? >> > For that last bit, I have done the following in babelia: > > https://github.com/amirouche/guile-babelia/blob/87ae25b56777ab6072759= bbe80bb80851d0d9174/babelia/pool.scm#L89-L108 > > I am wondering why the existing parallel for do not work for you: > > https://www.gnu.org/software/guile/manual/html_node/Parallel-Forms.ht= ml > >> Regards, >> >> Zelphir >> >> >