[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fibers,questions about thread id and mutation of vectors
From: |
Maxime Devos |
Subject: |
Re: fibers,questions about thread id and mutation of vectors |
Date: |
Fri, 13 Jan 2023 13:23:32 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 |
for (i=start; i<=stop; i++) { /* i is private by default */
scm_init_guile();
scm_call_1( func , scm_from_int(i) );
IIUC, you are calling scm_init_guile once per index, whereas calling it
once per thread would suffice. For better performance, I propose doing
it once per thread.
On 13-01-2023 12:10, Damien Mattei wrote:
there should be difference in implementation of Guile between Mac OS and
Linux but i do not know the inner mechanism and algorithm used to run
Guile in a C environment,what scm_init_guile() is doing?
Guile is free software, you can download the source code to read what
scm_init_guile is doing.
why must it be placed under the // region on Linux (with slower result)
From the manual:
6.4 Each thread that wants to use functions from the Guile API needs to
put itself into guile mode with either ‘scm_with_guile’ or
‘scm_init_guile’. The global state of Guile is initialized automatically
when the first thread enters guile mode.
OpenMP does multi-threading, so you need to call scm_init_guile or
scm_with_guile.
and anywhere under MacOS ? (speed up code)
You need to do it on non-Linux too -- the extract from the manual does
not make a 'except on MacOS' exception. It might work without
scm_init_guile in some circumstances, but this is not at all guaranteed.
If you want to know the difference between MacOS and Linux in the
implementation of scm_init_guile, you can read the source code of
scm_init_guile as mentioned before.
Greetings,
Maxime.
OpenPGP_0x49E3EE22191725EE.asc
Description: OpenPGP public key
OpenPGP_signature
Description: OpenPGP digital signature
- fibers,questions about thread id and mutation of vectors, Damien Mattei, 2023/01/06
- Re: fibers,questions about thread id and mutation of vectors, Maxime Devos, 2023/01/06
- Re: fibers,questions about thread id and mutation of vectors, Damien Mattei, 2023/01/06
- Re: fibers,questions about thread id and mutation of vectors, Damien Mattei, 2023/01/06
- Re: fibers,questions about thread id and mutation of vectors, Maxime Devos, 2023/01/06
- Re: fibers,questions about thread id and mutation of vectors, Damien Mattei, 2023/01/13
- Re: fibers,questions about thread id and mutation of vectors,
Maxime Devos <=
- Re: fibers,questions about thread id and mutation of vectors, Damien Mattei, 2023/01/17