Hello Maxime,
it runs in the fastest way with your idea,
as you said it scm_init_guile() is only needed once by thread.
On Fri, Jan 13, 2023 at 1:23 PM Maxime Devos wrote:
> > for (i=start; i<=stop; i++) { /* i is private by default */
> >
> > scm_init_guile();
> > scm_call_1( func
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.
i made some test of openMP and Guile with Guile 3.0.8.99-f3ea8 on MacOS M1
and Linux Intel because i was not sure of the performances. I find a
problem on Linux the code is slower (could be a factor of 5) with openMP
and in Mac OS the gain is is of 100% (divide by 2) or 15% depending of
computation