Re: shared variables in parfor()
Bill Allombert <[email protected]>
| Newsgroups | gmane.comp.mathematics.pari.user |
|---|---|
| Message-ID | <Z4rQn5QJqrh80UXC@seventeen> |
On Fri, Jan 17, 2025 at 03:31:17PM -0500, Max Alekseyev wrote: > Hello, > > I naively thought that the following code would print a few zeros, which > would then follow by all ones: > > my(q=0); parfor(i=1,10^6, print(q); 0, R, q=1) > > but it constantly prints zeros. So, the value of q is not shared between > threads. > What is the right way to create a shared variable (with pthreads if that > matters)? It is not possible. This is by design. Cheers, Bill.