mersenneforum.org mtsieve
 Register FAQ Search Today's Posts Mark Forums Read

2020-05-12, 18:18   #298
VBCurtis

"Curtis"
Feb 2005
Riverside, CA

2·5·467 Posts

Quote:
 Originally Posted by rogue Yet another reason to dislike Windows. Thanks for finding the reason.
Was a fixed version ever posted for this problem? I also run ubuntu, also have the "Unable to lock mutex thread_1_worker. Exiting" error.

Am I to edit the source as indicated in the posts above, or has that been done for me in a released version?

I grabbed source from sourceforge 11 May, CHANGES.txt notes 1.9.6 changes from 15 Jan 2020.

2020-05-12, 18:27   #299
rogue

"Mark"
Apr 2003
Between here and the

22·7·223 Posts

Quote:
 Originally Posted by VBCurtis Was a fixed version ever posted for this problem? I also run ubuntu, also have the "Unable to lock mutex thread_1_worker. Exiting" error. Am I to edit the source as indicated in the posts above, or has that been done for me in a released version? I grabbed source from sourceforge 11 May, CHANGES.txt notes 1.9.6 changes from 15 Jan 2020.
Worker.h was fixed on 1/20. The latest build has that fix.

 2020-05-12, 19:28 #300 VBCurtis     "Curtis" Feb 2005 Riverside, CA 2×5×467 Posts Well, I've tried the download button from the sourceforge project, and the link from http://www.mersenneforum.org/rogue/mtsieve.html (this link appears to be windows .exe's only, I don't see source) Neither seems to have the fix. Where can I find the latest build? Edit: I notice that srsieve2.exe from the MForum link is dated 21 Jan, so maybe it does- but the fix concerned linux, and that's an .exe, so it doesn't seem too relevant. Last fiddled with by VBCurtis on 2020-05-12 at 19:29
2020-05-12, 19:46   #301
rogue

"Mark"
Apr 2003
Between here and the

22×7×223 Posts

Quote:
 Originally Posted by VBCurtis Well, I've tried the download button from the sourceforge project, and the link from http://www.mersenneforum.org/rogue/mtsieve.html (this link appears to be windows .exe's only, I don't see source) Neither seems to have the fix. Where can I find the latest build? Edit: I notice that srsieve2.exe from the MForum link is dated 21 Jan, so maybe it does- but the fix concerned linux, and that's an .exe, so it doesn't seem too relevant.
The source is only in sourceforge. I do not provide Linux builds and I do not know the last version built for linux.

The issue was encountered on Windows, but could happen on other platforms.

 2020-05-12, 22:26 #302 VBCurtis     "Curtis" Feb 2005 Riverside, CA 2×5×467 Posts No, unconnected's report from posts 280 and 282 were ubuntu 18.04, same OS I'm running. You noticed that windows *does not* point out the problem in the succeeding posts. Changing line 117 in workers.h from -> SetValueNoLock to -> SetValueHasLock results in a functioning srsieve2. Thanks for your quick replies! Note that I grabbed the code from sourceforge this morning, so this change has not yet made it into SF.
2020-05-13, 13:11   #303
rogue

"Mark"
Apr 2003
Between here and the

141448 Posts

Quote:
 Originally Posted by VBCurtis No, unconnected's report from posts 280 and 282 were ubuntu 18.04, same OS I'm running. You noticed that windows *does not* point out the problem in the succeeding posts. Changing line 117 in workers.h from -> SetValueNoLock to -> SetValueHasLock results in a functioning srsieve2. Thanks for your quick replies! Note that I grabbed the code from sourceforge this morning, so this change has not yet made it into SF.
This was updated in revision 16 months ago. I'm not certain why you are seeing something different.

 2020-05-15, 18:28 #304 Citrix     Jun 2003 1,579 Posts If using fbncsieve.exe can you sieve sequence k*2^n+1 and k*2^n-1 at the same time (for a range of k)? What command line arguments should one use to do this? Also if you have multiple n and multiple k (Where # of k>> # of n) for same base is there a way to sieve that all at once. Last fiddled with by Citrix on 2020-05-15 at 18:28
2020-05-15, 19:36   #305
rogue

"Mark"
Apr 2003
Between here and the

22×7×223 Posts

Quote:
 Originally Posted by Citrix If using fbncsieve.exe can you sieve sequence k*2^n+1 and k*2^n-1 at the same time (for a range of k)? What command line arguments should one use to do this? Also if you have multiple n and multiple k (Where # of k>> # of n) for same base is there a way to sieve that all at once.
Use twinsieve with the -s argument to sieve for a single fixed n and both +1 and -1.

For your other question, if using base 2 and +1, then use gfndsieve.

I do not have a sieve that sieves a single base for both +1 and -1, a range of k, and a range of n. I don't think it would be too difficult to modify twinsieve to do that.

 2020-05-20, 16:04 #306 rogue     "Mark" Apr 2003 Between here and the 22×7×223 Posts I posted the binaries to mtsieve 2.0.0 at sourceforge. This is what I fixed: Fixed an issue with the framework where it could stop sieving before reaching the max prime specified on the command line. Fixed a link issue with gfndsieve and dmdsieve with GMP on OS X. Fixed a compiler issue with the .align ASM instruction on OS X.
2020-05-24, 04:55   #307
Citrix

Jun 2003

157910 Posts

Quote:
 Originally Posted by rogue Use twinsieve with the -s argument to sieve for a single fixed n and both +1 and -1. For your other question, if using base 2 and +1, then use gfndsieve. I do not have a sieve that sieves a single base for both +1 and -1, a range of k, and a range of n. I don't think it would be too difficult to modify twinsieve to do that.
Thanks.

I am working on
kmin=2
kmax=n
b=2
N=n*n
c=+1 and -1

Currently I am using fbncsieve (now twinsieve) for each N value separately using a script.

If there could be a sieve for these square numbers that would be great.
These numbers can be sieved very efficiently.
You can jump from one N value to next using 1 modular multiplication and 3 additions making it extremely fast to sieve together than sieve separately.
A GPU version should also be possible.

Here is the code that you can use for this

Code:
//Adapted from multisieve

void SquareNSieve::DoWork64Bit(uint64_t thePrime)
{
uint32_t    nmin, nmax;
nmin = 100;
nmax = 1000;

uint64_t    temp, power;

temp = thePrime + 1;
temp >> 1;
temp = expmod62(temp, nmax*nmax, thePrime);
power = expmod62(2, 2 * nmax, thePrime);

for (int x = nmax; x >= nmin; x--)
{
if (temp <= x)
LogFactor('-', temp, 2, x*x, thePrime);

if (temp >= thePrime - x)
LogFactor('+', temp, 2, x*x, thePrime);

temp = mulmod62(temp, power, thePrime);
if (temp&1)
{
temp = temp + thePrime;
}
temp >> 1;
if (power&1)
{
power = power + thePrime;
}
power >> 1;
if (power&1)
{
power = power + thePrime;
}
power >> 1;
}
}

Last fiddled with by Citrix on 2020-05-24 at 05:45

2020-05-25, 05:49   #308
Citrix

Jun 2003

157910 Posts

I tried to write the code my self. I have attached it.

The program mainly writes the factors to factor file which need to be processed by srfile. There is no input or output file.

I only modified the FPU code and not the AVX multiplication code.

I cannot get it to compile. gmp.h is missing. I do not have GMP installed on my computer. Can anyone help compile it?

I do not have experience with GPU apps - how do I modify the code for GPU? Possibly cw_kernel.cl needs to be modified. Not sure what to do with the cw_kernel.h file.

Code:
void  SquareNWorker::TestLargePrimesFPU(uint64_t *ps)
{
uint64_t powinvs[4];
uint64_t tempinvs[4];
for (int i = 0; i < 4; i++)
{
powinvs[i] = ps[i] + 1;
powinvs[i] >> 1;
tempinvs[i] = powinvs[i];
}

fpu_powmod_4b_1n_4p(powinvs, 2 * ii_MaxN, ps);
fpu_powmod_4b_1n_4p(tempinvs, ii_MaxN * ii_MaxN, ps);

for (int32_t x = ii_MaxN; x >= ii_MinN; x--)
{
for (int i = 0; i < 4; i++)
{
if (tempinvs[i] <= x) { ip_SquareNApp->ReportFactor(tempinvs[i], x*x, -1, ps[i]); }
if (tempinvs[i] >= ps[i] - x) { ip_SquareNApp->ReportFactor(tempinvs[i], x*x, +1, ps[i]); }
// do not verify factors
// just write to file as k*2^n+-1
// use srfile then to clean up abc file.
// modified report factor so also print k.
}

fpu_push_1divp(ps[3]);
fpu_push_1divp(ps[2]);
fpu_push_1divp(ps[1]);
fpu_push_1divp(ps[0]);

fpu_mulmod_4a_4b_4p(powinvs, tempinvs, ps);

for (int i = 0; i < 4; i++)
{
if (tempinvs[i] & 1) { tempinvs[i] += ps[i]; }
tempinvs[i] >> 1;
if (powinvs[i] & 1) { powinvs[i] += ps[i]; }
powinvs[i] >> 1;
if (tempinvs[i] & 1) { powinvs[i] += ps[i]; }
powinvs[i] >> 1;

}
}
fpu_pop();
fpu_pop();
fpu_pop();
fpu_pop();
}
Attached Files
 squareNsieve.zip (20.4 KB, 30 views)

All times are UTC. The time now is 01:25.

Fri Feb 26 01:25:08 UTC 2021 up 84 days, 21:36, 0 users, load averages: 2.05, 1.97, 1.82

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.