unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Damien Mattei <damien.mattei@gmail.com>
To: Zelphir Kaltstahl <zelphirkaltstahl@posteo.de>
Cc: guile-user <guile-user@gnu.org>, Olivier Dion <olivier.dion@polymtl.ca>
Subject: Re: map-par slower than map
Date: Fri, 11 Nov 2022 14:36:14 +0100	[thread overview]
Message-ID: <CADEOaddcO+w4xDtTVg+n8tjWu9xEN8=NimMZRgyOuaveR3xmsA@mail.gmail.com> (raw)
In-Reply-To: <d00f1504-3fa5-56ba-ff13-1378a3100e31@posteo.de>

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’s POSIX threads. For application-level parallelism, 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/logiki%2B.rkt#L3012

https://github.com/damien-mattei/library-FunctProg/blob/master/racket/logiki%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 concurrent,
> 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
>
>


  reply	other threads:[~2022-11-11 13:36 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-12 17:19 map-par slower than map Damien Mattei
2022-10-12 18:45 ` Maxime Devos
2022-10-12 20:20   ` Damien Mattei
2022-10-12 20:27     ` Damien Mattei
2022-10-12 21:29       ` Zelphir Kaltstahl
2022-10-14  8:21         ` Damien Mattei
2022-10-14  8:38           ` Zelphir Kaltstahl
2022-10-17 13:17             ` Damien Mattei
2022-10-22 16:01               ` Damien Mattei
2022-10-23  1:06                 ` Damien Mattei
2022-10-23 23:18                   ` Zelphir Kaltstahl
2022-10-24  3:56                     ` Keith Wright
2022-10-24  7:03                       ` Zelphir Kaltstahl
2022-10-24  4:39                     ` Damien Mattei
2022-10-25  9:07         ` Mikael Djurfeldt
2022-10-25  9:11           ` Mikael Djurfeldt
2022-10-25 14:09             ` Damien Mattei
2022-11-10 10:32         ` Damien Mattei
2022-11-10 10:41           ` Damien Mattei
2022-11-10 10:52             ` Zelphir Kaltstahl
2022-11-10 13:36               ` Damien Mattei
2022-11-10 17:07           ` Olivier Dion via General Guile related discussions
2022-11-11 10:26             ` Damien Mattei
2022-11-11 12:25               ` Zelphir Kaltstahl
2022-11-11 13:36                 ` Damien Mattei [this message]
2022-11-11 13:37                   ` Damien Mattei
2022-11-13  8:23                     ` Damien Mattei
2022-10-12 21:44     ` Maxime Devos
2022-10-12 21:55 ` Olivier Dion via Developers list for Guile, the GNU extensibility library
2022-10-13  7:40   ` Damien Mattei
2022-10-13  8:20     ` Damien Mattei
2022-10-13  9:10     ` Olivier Dion via Developers list for Guile, the GNU extensibility library
2022-10-13 10:44   ` Damien Mattei
2022-10-13 11:00     ` Olivier Dion via Developers list for Guile, the GNU extensibility library
     [not found]       ` <CADEOadfovi8s3OxRcssWOuOW8jjHoL9Z7pD_5FstSm=ZkBHP8g@mail.gmail.com>
2022-10-13 11:57         ` Fwd: " Damien Mattei
2022-10-13 12:36           ` Damien Mattei
2022-10-13 12:41             ` Olivier Dion via Developers list for Guile, the GNU extensibility library
2022-10-13 13:43               ` Damien Mattei
2022-10-13 14:06                 ` Olivier Dion via Developers list for Guile, the GNU extensibility library
2022-10-13 14:10                   ` Damien Mattei
2022-10-13 14:21                     ` Damien Mattei

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='CADEOaddcO+w4xDtTVg+n8tjWu9xEN8=NimMZRgyOuaveR3xmsA@mail.gmail.com' \
    --to=damien.mattei@gmail.com \
    --cc=guile-user@gnu.org \
    --cc=olivier.dion@polymtl.ca \
    --cc=zelphirkaltstahl@posteo.de \
    /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).