Bill Allombert on Fri, 17 Jan 2025 22:50:26 +0100
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: shared variables in parfor()
|
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: Re: shared variables in parfor()
- From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
- Date: Fri, 17 Jan 2025 22:50:23 +0100
- Delivery-date: Fri, 17 Jan 2025 22:50:26 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=math.u-bordeaux.fr; s=2022; t=1737150624; bh=uiB5Dzp78qexfaO6EfQwt8k2BiLOei1yIYWjT57m6r0=; h=Date:From:To:Subject:References:In-Reply-To:From; b=Zn2MtImPsFnAFhcWJvkG5YVRgm1GrRpplWJ6zXd5ibPR/xJiC9QtjjvTqcGnIgKln q5dTnSJbI8aUKZSqolYS2EwoCeLcXZ+50B58KE+L+BkoNNykvBvQs+dAv3xBSjap/n b5wruI7t5IyKxUfNzhmCU2JCNQ+4FL8+kX3FU7gRkUerq16DqHgja/2sOnu1wjDZmd HE5NLHi+6hkOn41PDJEuQrDewAZPpKqFvcAdZKwbq2/SC6Qg+pbDMh15T5LOS1/4ni EqvEbju8HO0YCaUb21L/oOivQ7BmsBN9mvJNXr41KbSPPnkhLSESNenjdbSOz44f84 mODeMWlDqxH1YEo3LHyCTGvKgawd4N+mAZKE36FoziyUMVu1xJ1TkEZiiwny7YiNc8 S04pqXn89YDJ8ySga/CoG1KxmckOUuKh3pVKWEVO49/uJjVCSb4vQIZKtUYomRWlwn 6Hnt8MqoE9TbTW5T+BTdOfTxoKCW92wlZu86UJBuPQMUvn0QX1pECtQRUHCnUvNzuc 5AqhgdAW9qp6qjnE829Is5MUHRJdlnbx/2y92U98PcLkQWB8JoTdjgkZDol85X/7rH pI2DNlyJyJAbVIpmkybAXOS0kvLiZKQUwFjEYExxDjilNTsoyGOHaNcmZ89O3FBDNg IByUvwNrR5yf+fmg6SQy5U1k=
- In-reply-to: <CAJkPp5PSKWvnex9JchT3syYFifbyra7NeZNf+WVxa2TWzLNq7g@mail.gmail.com>
- Mail-followup-to: pari-users@pari.math.u-bordeaux.fr
- References: <CAJkPp5PSKWvnex9JchT3syYFifbyra7NeZNf+WVxa2TWzLNq7g@mail.gmail.com>
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.