unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Zelphir Kaltstahl <zelphirkaltstahl@posteo.de>
To: Amirouche Boubekki <amirouche.boubekki@gmail.com>
Cc: Guile User <guile-user@gnu.org>
Subject: Re: Guile fibers return values
Date: Wed, 15 Jan 2020 01:04:19 +0100	[thread overview]
Message-ID: <2d57388b-acd7-0f0e-8468-a064b2d964f9@posteo.de> (raw)
In-Reply-To: <CAL7_Mo9L9rNwMKr7G==s4iMoE_iz08ODtiTctxNXjC-vSO34hw@mail.gmail.com>

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 à 22:49, Zelphir Kaltstahl
> <zelphirkaltstahl@posteo.de> a écrit :
>> 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 to
>> 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 fiber?
>>
>> 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 to
>> 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/87ae25b56777ab6072759bbe80bb80851d0d9174/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.html
>
>> Regards,
>>
>> Zelphir
>>
>>
>



  reply	other threads:[~2020-01-15  0:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-04 22:49 Guile fibers return values Zelphir Kaltstahl
2020-01-05  2:42 ` John Cowan
2020-01-05 12:46   ` Zelphir Kaltstahl
2020-01-14 10:59 ` Amirouche Boubekki
2020-01-15  0:04   ` Zelphir Kaltstahl [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-01-05  1:30 Zelphir Kaltstahl
2020-01-05 12:33 ` Chris Vine
2020-01-05 12:58   ` Zelphir Kaltstahl
2020-01-05 14:28     ` Chris Vine
     [not found]     ` <20200105142358.4ad96d15a23a0b947b2d55e3@gmail.com>
2020-01-05 18:22       ` Zelphir Kaltstahl
2020-01-05 21:45         ` Chris Vine
2020-01-06 19:42           ` Zelphir Kaltstahl
2020-01-06 21:14             ` Chris Vine
2020-01-06 21:47               ` John Cowan
2020-01-06 22:45                 ` Zelphir Kaltstahl
2020-01-07  1:36                   ` John Cowan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2d57388b-acd7-0f0e-8468-a064b2d964f9@posteo.de \
    --to=zelphirkaltstahl@posteo.de \
    --cc=amirouche.boubekki@gmail.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).