Max Alekseyev on Fri, 17 Jan 2025 21:31:58 +0100
[
Date Prev
] [
Date Next
] [
Thread Prev
] [
Thread Next
] [
Date Index
] [
Thread Index
]
shared variables in parfor()
To
: Pari Users <
pari-users@pari.math.u-bordeaux.fr
>
Subject
: shared variables in parfor()
From
: Max Alekseyev <
maxale@gmail.com
>
Date
: Fri, 17 Jan 2025 15:31:17 -0500
Delivery-date
: Fri, 17 Jan 2025 21:31:58 +0100
Dkim-signature
: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737145915; x=1737750715; darn=pari.math.u-bordeaux.fr; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=JFwGy3Gnjy5+AL/8KATp2o044isD82yiH0S2u/PU6C8=; b=MkVg9Y5XmUeODt7CvOZTRIppTeqKdGEr4icsu4Z73fm9YrA6wZXEd12BM0SSjk8qzK J/M0PTJtI1fQsCnefVNfkddBpwJGN/rK8rl8fJ/83EWugRG9sueJdhJXmPSrOyIOZy7l 7LPjknniww/MR+PP4Wv/uF0tDsaYhaXmwuIajouVcGZkREtlW2IckeIrz5JTR/LFczqv gA5vssJjycsuTJQkG43KUZUM2jxGV5kmvVSUm51fOsvg3X8TFL5JXKTfmKaGm77phC8y bOMAPWdTP7Nq42hC9zplhuRrydgYamECeVXLSNIOwDKvUzD0Uy7NXwH7Vd5+r0wwr9W9 porA==
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)?
Regards,
Max
Follow-Ups
:
Re: shared variables in parfor()
From:
Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
Re: shared variables in parfor()
From:
"Ruud H.G. van Tol" <rvtol@isolution.nl>
Prev by Date:
Re: deciding whether two padic extensions are isomorphic
Next by Date:
Re: shared variables in parfor()
Previous by thread:
script for linear recurrences with polynomial coefficients
Next by thread:
Re: shared variables in parfor()
Index(es):
Date
Thread