Re: question on implementing an atomic operation in GP Pari
American Citizen <[email protected]> Fri, 22 Aug 2025 16:03:49 -0700
| Newsgroups | gmane.comp.mathematics.pari.user |
|---|---|
| Message-ID | <[email protected]> |
Thanks Bill, now all I have to do is write the correct gp pari code to kick off 6 cores On 8/22/25 01:34, Bill Allombert wrote: > On Thu, Aug 21, 2025 at 01:04:46PM -0700, American Citizen wrote: >> Hello: >> >> Currently I am using 6 cores to run though a long list of primes or product >> of primes congruent to 1 mod 4. (such as 5, 37, 65, etc) >> >> I split the list according to the assigned processor number 0..5 by using >> modulus 6 values. >> >> While this method works, some of the processors are climbing up the list >> faster than others. >> >> Currently I have >> >> n:88181 >> n:90889 >> n:87145 >> n:88285 >> n:88633 >> n:89245 >> >> and you can see that the 2nd processor at 90,889 is ahead of the others. The >> 3rd processor is behind at 87,145. >> >> I can use an alternate scheme, having all 6 cores access an atomic operator >> and receiving just one unique number from the list, then incrementing the >> index to the list, this would insure that all numbers are bunched closely >> together. >> >> This requires an atomic "get and increment" operator. I do have C code which >> does this, would this be the right way to go, to implement an external call >> into the gp code? > You can do that directly in GP using parfor or parforeach. > > Cheers, > Bill. >