Bill Allombert on Wed, 20 Mar 2024 15:05:46 +0100
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: How to efficiently count Proth primes with GP parfor?
|
- To: pari-users@pari.math.u-bordeaux.fr
- Subject: Re: How to efficiently count Proth primes with GP parfor?
- From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
- Date: Wed, 20 Mar 2024 15:05:37 +0100
- Arc-authentication-results: i=1; smail; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1710943541; c=relaxed/relaxed; bh=BRcveN4e2014rnuiZSyfV/syZy3md+0jsZSJa5DvqBc=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:Mail-Followup-To: References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; b=35D4Y913FAJSxHAWqeVbdieSosfvN/PrZldRtcfKJVWq1SbMvmkabHaUO5HaJppUIvS2lc/P2jk5USFgJpwC1A2fIxTkOZCCsKf7N3WGAH+/OV7vsUrjJ3c7+CrDin8jOEIyqP0XrNFu/y85rBYI5IEBM7SibmPBe61eblHruGwfKPvYK/bln/dgQdtRFdkKVYuX5qdvE3g9CCiUomCEctTvK2q+zbH98TyfSLx1ok7IrjamE7Wl55KtIan6xJMS+HWN5TSr/RywfHsApUN9E/JmW/N7ANqNyp2haH9nhHInCnWES+HGQO78baaEEBLAIn1EPOfTayEUGs6KvVVSXad2TCGc7J3LO2FzCA9qg5eeGcYQ1lADp7KLiDtbUEP/3ptdp88t6JPuMGX2WrgvvC50ij95tvNrax3j5m7/j18heZPRh6rv4hxFB/ft3RPFwst7LY8OrgCvABlXtLhLhfAEOe8tZeCHXt/oHf4Yf24PwhTSF4Kls9F+w2+84R2JBPfSqMWnYYKW6kxpJ3q42tMI5ce0O5rHENCjK3PSf0ij2txdm1Mc05qlWCs0KTW/TXoaU7WKOcRrWt7oPYLSDrxbRS0dFzOjFXReFynvte+eBze9D2lb/TF0hoNk+bwzdA01TvmC1U9rdkCZCZLiTBHPzDBhnGPWAkVJgBmCsyI=
- Arc-seal: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1710943541; cv=none; b=t0dPWhSmCy+RSf+9UWqxvm79+PZENj1RIlBNYFf0gM+63FUEWQU9MGlfPUW6a7cknYsyq56pAc37r1kuSFB8hq4y0+qH2wH4S/AZDTMnL1arQurOtB/PbYOPfVmJdHuW3VavzcPnu5Cbj2m2XzyterJP/g4GrvuJAfly9WRfWUAQ2n4bwRekHuqt4tXue4Fzg5odYqb3zG+lhvW4pjcWde6ByHK0Ats+6JSaOZdgWBMxXsg3WawzoxPheFeAVJH8W3JSacrjr+vt/rC77woqf7I4Fph3x561Sr2jr3mbpOTmZhqivkk4/8ApxuUHRDVCFGKjAs/mg/KhhltOAcVLuqufgdxEN2y9k7+qkGhniJaDby/b1Zg0WC8ccqHpZYLoz1LmT1E+NIqz7auSMM66lQxuqoICki7V5g8RfgyKKZ1AzkaaUSkzSQlMIABQSscDxvPX8ToAepMXQZvnJuxx8dSeWcWQA/isyF3+nayxELeEcMczdgv09jgW3PjkUtNlYp2SlIl/lXAmnwCcJrSkn14CAqDIpF/i6/x80iNcyi5Qgvtx/fPcP3VCR24V3yllHpj40gfqmTxXp+jGtPRlDYOgRpEu+TodaqmtltKnuwv3N7E+8Dj0vvN6ZHVS5OG7VlLRKwVGB2fdJXRo4q3Pf1rfdJ9Pj4zSca1cq2IZLS4=
- Authentication-results: smail; dmarc=none header.from=math.u-bordeaux.fr
- Authentication-results: smail; arc=none
- Delivery-date: Wed, 20 Mar 2024 15:05:46 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1710943540; bh=BRcveN4e2014rnuiZSyfV/syZy3md+0jsZSJa5DvqBc=; h=Date:From:To:Subject:References:In-Reply-To:From; b=XRc7pHYMDeB7Lbey+bmLQdvGbuXXFSpMFuqF8FqdZ78PkJSt5vj0s7QiD6pB6DZyG vrLYHzxv7WkEBFnrVgBhhFCx5+0McMqmaSwziFI/g42kkVEPxbRsIWayuJsw1DHM40 JEcSqLa5mJgtSyb9ilRgAyizNu4e8roUjdjYCuUbBvbfd9J9pwAJWa0Isx2mcwG4jS HKi/2mERRcHUpuue23srBAqHsV0y3bvNCE61sWDfDuvK3IDZbax93KU3jophjAAgnm ofnbcnsDBH7JLqcSLiPl9QK6kRIHS2Dy3g3ngvS5Of6ljgYvEWlhmKn2W+JMK78m6A Kj3b8tVkLszKHraBLPwBkAkwyVMt8GEpaZK1LfygRis9GrCOErZgJMpdN7SdSd1eLB 4rhn8VSxliclBLHvADiG0zJDTyE/u1aTynqnAEf3OJ4eN9Jf+j1RA0+e0JsK2Z2e39 U4tAXMwtVqWh7E8sLCNrGosimEAPzzQD7F8O++Y1CvzDLd3TYXzt0n0gyfK4WVrkLT jiqCJj1Y2/VYBBTMWPP2vTvSZhZtYhkhZGMqjwX5WQ/ImEFq4UIWM4k0mPYjH94bhC 7wmv79QyFXKzO1U0TUHWvjcKmnkahYMho3XuMBqFGsOxhQPvxol/0dVGwGm3k+l37W GHwgOI7jYm9W+qvpctEekD/Y=
- In-reply-to: <f716073db48b3b39381af4041762e422@stamm-wilbrandt.de>
- Mail-followup-to: pari-users@pari.math.u-bordeaux.fr
- References: <78df8c6fb5e60216469075d862f79735@stamm-wilbrandt.de> <55fecf62eb12a6076cc03e3ff0c06bce@stamm-wilbrandt.de> <Zfq57ke3bDo3Yx7M@seventeen> <f716073db48b3b39381af4041762e422@stamm-wilbrandt.de>
On Wed, Mar 20, 2024 at 02:23:49PM +0100, hermann@stamm-wilbrandt.de wrote:
> > You need to do work by batch.
> >
> > isProth(p)=my(v=valuation(p-1,2));p>>v<2^v;
> > export(isProth);
> > {
> > my(nbt=default(nbthreads));
> > my(c=0,B=323092481\nbt);
> > parforstep(i=1,323092481,B,
> > my(cc=0);
> > forprime(p=i,min(i+B-1,323092481),cc+=isProth(p));cc
> > ,C,c+=C);c
> > }
> > %3 = 3000
> > ? ##
> > *** last result: cpu time 17,843 ms, real time 1,070 ms.
> >
> > (with 20 cores).
> >
> Which GP version do you run?
The GIT version!
For 2.15.4 you need to replace parforstep by parfor,
for example
{
my(nbt=default(nbthreads));
my(c=0,B=323092481\nbt);
parfor(ii=0,(323092481+B-1)\B,
my(cc=0,i=ii*B+1);
forprime(p=i,min(i+B-1,323092481),cc+=isProth(p));cc
,C,c+=C);c
}
Cheers,
Bill.