mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Msieve (https://www.mersenneforum.org/forumdisplay.php?f=83)
-   -   Msieve 1.40 Beta Feedback (https://www.mersenneforum.org/showthread.php?t=11553)

jasonp 2009-03-26 18:18

You don't need a new binary as long as the factor base file has 'SKEW 1.0' as the second line. Of course for GNFS you will be specifcying a non-default skew anyway.

v1.41 is on a faster relase schedule, I'll try to get something out in the next few weeks.

Brian Gladman 2009-03-26 18:40

[quote=Jeff Gilchrist;166669]I'm not sure, I haven't looked a the code closely but do you have any assembler code that isn't being picked up and used when it is compiled with 64bit MSVC? That happens with YAFU, it uses generic C code for some things instead.[/quote]

This bug is caused by a problem in gmp_xface.h. Just change the four lines:

#if GMP_LIMB_BITS == 64

to:

#if GMP_LIMB_BITS == 64 && !defined( _MSC_VER )

Brian Gladman

bsquared 2009-03-26 19:20

[quote=jasonp;166654]The performance difference between 32-bit and 64-bit MSVC is very interesting, I wonder what could be making the sieving so much slower.

[/quote]

FWIW, I'm not sure why 64bit YAFU is faster than 32bit either. Nearly all of the siqs routine is 32 bit only so having a 64 bit compiler shouldn't really matter much, but it does. I'm left with grasping at nuts n' bolts compiler detail straws: maybe 64 bit emitted code uses more registers, or has different memory access patterns, or schedules things with different priorities vs a 32 bit compiler. I don't have the motivation to learn enough about the compliers and their optimization routines to find out for sure.

In leu of that, one near term goal of mine is to try to use inline assembler code based on 64 bit emitted code to try to level this playing field. Not sure how long this will take or if it will work.

p.s.
sorry to spam the msieve thread with yafu stuff...

Jeff Gilchrist 2009-03-26 19:50

[QUOTE=Brian Gladman;166771]This bug is caused by a problem in gmp_xface.h. Just change the four lines:

#if GMP_LIMB_BITS == 64

to:

#if GMP_LIMB_BITS == 64 && !defined( _MSC_VER )
[/QUOTE]

Brian you are the man! That does it. Jason, have you updated your code with that change?

I will re-create the 64bit binary and post it right away.

jasonp 2009-03-26 20:08

I'd prefer that you just update your local source and post a corrected x64 binary, and I'll keep accumulating patches for v1.41 (Brian is already working on several more and I've also made other small changes).

Jeff Gilchrist 2009-03-26 23:14

[QUOTE=jasonp;166781]I'd prefer that you just update your local source and post a corrected x64 binary, and I'll keep accumulating patches for v1.41 (Brian is already working on several more and I've also made other small changes).[/QUOTE]

No problem, a new binary has been posted and I'm in the process of testing it more thoroughly. I'm also testing some other stuff Brian is working on that hopefully will make it into 1.41.

Batalov 2009-03-27 04:43

error: relation product is incorrect
 
In a small 28-bit project, the square root in v. 1.40 showed some reproducible problems
[code]Thu Mar 26 21:00:05 2009 Msieve v. 1.40
Thu Mar 26 21:00:05 2009 random seeds: 3263c2bb c8f6b37b
Thu Mar 26 21:00:05 2009 factoring 18148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148149 (176 digits)
Thu Mar 26 21:00:07 2009 searching for 15-digit factors
Thu Mar 26 21:00:07 2009 commencing number field sieve (176-digit input)
Thu Mar 26 21:00:07 2009 R0: -100000000000000000000000000000000000
Thu Mar 26 21:00:07 2009 R1: 1
Thu Mar 26 21:00:07 2009 A0: 23
Thu Mar 26 21:00:07 2009 A1: 0
Thu Mar 26 21:00:07 2009 A2: 0
Thu Mar 26 21:00:07 2009 A3: 0
Thu Mar 26 21:00:07 2009 A4: 0
Thu Mar 26 21:00:07 2009 A5: 49
Thu Mar 26 21:00:07 2009 skew 0.86, size 2.337842e-12, alpha 1.102433, combined = 1.386138e-10
Thu Mar 26 21:00:07 2009
Thu Mar 26 21:00:07 2009 commencing square root phase
Thu Mar 26 21:00:07 2009 reading relations for dependency 1
Thu Mar 26 21:00:08 2009 read 712166 cycles
Thu Mar 26 21:00:09 2009 cycles contain 3034535 unique relations
Thu Mar 26 21:00:32 2009 read 3034535 relations
Thu Mar 26 21:00:46 2009 multiplying 2513416 relations
Thu Mar 26 21:02:58 2009 multiply complete, coefficients have about 69.21 million bits
Thu Mar 26 21:02:59 2009 error: relation product is incorrect
Thu Mar 26 21:02:59 2009 algebraic square root failed
Thu Mar 26 21:02:59 2009 reading relations for dependency 2
Thu Mar 26 21:02:59 2009 read 712139 cycles
Thu Mar 26 21:03:00 2009 cycles contain 3035569 unique relations
Thu Mar 26 21:03:23 2009 read 3035569 relations
Thu Mar 26 21:03:36 2009 multiplying 2514714 relations
Thu Mar 26 21:05:47 2009 multiply complete, coefficients have about 69.25 million bits
Thu Mar 26 21:05:48 2009 error: relation product is incorrect
Thu Mar 26 21:05:48 2009 algebraic square root failed
Thu Mar 26 21:05:48 2009 reading relations for dependency 3
Thu Mar 26 21:05:48 2009 read 713367 cycles
Thu Mar 26 21:05:50 2009 cycles contain 3037441 unique relations
Thu Mar 26 21:06:12 2009 read 3037441 relations
Thu Mar 26 21:06:25 2009 multiplying 2515946 relations
Thu Mar 26 21:08:37 2009 multiply complete, coefficients have about 69.28 million bits
Thu Mar 26 21:08:38 2009 error: relation product is incorrect
Thu Mar 26 21:08:38 2009 algebraic square root failed
Thu Mar 26 21:08:38 2009 reading relations for dependency 4
Thu Mar 26 21:08:38 2009 read 713476 cycles
Thu Mar 26 21:08:40 2009 cycles contain 3041490 unique relations
Thu Mar 26 21:09:02 2009 read 3041490 relations
Thu Mar 26 21:09:17 2009 multiplying 2518804 relations
Thu Mar 26 21:11:29 2009 multiply complete, coefficients have about 69.37 million bits
Thu Mar 26 21:11:31 2009 initial square root is modulo 95311
Thu Mar 26 21:15:19 2009 reading relations for dependency 5
Thu Mar 26 21:15:19 2009 read 712077 cycles
Thu Mar 26 21:15:20 2009 cycles contain 3035880 unique relations
Thu Mar 26 21:15:43 2009 read 3035880 relations
Thu Mar 26 21:15:57 2009 multiplying 2514900 relations
Thu Mar 26 21:18:09 2009 multiply complete, coefficients have about 69.25 million bits
Thu Mar 26 21:18:10 2009 error: relation product is incorrect
Thu Mar 26 21:18:10 2009 algebraic square root failed
Thu Mar 26 21:18:10 2009 reading relations for dependency 6
Thu Mar 26 21:18:10 2009 read 713064 cycles
Thu Mar 26 21:18:11 2009 cycles contain 3037390 unique relations
Thu Mar 26 21:18:34 2009 read 3037390 relations
Thu Mar 26 21:18:47 2009 multiplying 2516254 relations
Thu Mar 26 21:20:59 2009 multiply complete, coefficients have about 69.29 million bits
Thu Mar 26 21:21:00 2009 error: relation product is incorrect
Thu Mar 26 21:21:00 2009 algebraic square root failed
Thu Mar 26 21:21:00 2009 reading relations for dependency 7
### ...killed here, now with Msieve v. 1.39
#
Thu Mar 26 21:22:55 2009 Msieve v. 1.39
Thu Mar 26 21:22:55 2009 random seeds: 1e349613 ecc4c8af
Thu Mar 26 21:22:55 2009 factoring 18148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148148149 (176 digits)
Thu Mar 26 21:22:57 2009 searching for 15-digit factors
Thu Mar 26 21:22:58 2009 commencing number field sieve (176-digit input)
Thu Mar 26 21:22:58 2009 R0: -100000000000000000000000000000000000
Thu Mar 26 21:22:58 2009 R1: 1
Thu Mar 26 21:22:58 2009 A0: 23
Thu Mar 26 21:22:58 2009 A1: 0
Thu Mar 26 21:22:58 2009 A2: 0
Thu Mar 26 21:22:58 2009 A3: 0
Thu Mar 26 21:22:58 2009 A4: 0
Thu Mar 26 21:22:58 2009 A5: 49
Thu Mar 26 21:22:58 2009 skew 0.86, size 3.376048e-12, alpha 1.102433, combined = 2.337842e-12
Thu Mar 26 21:22:58 2009
Thu Mar 26 21:22:58 2009 commencing square root phase
Thu Mar 26 21:22:58 2009 reading relations for dependency 1
Thu Mar 26 21:22:58 2009 read 712166 cycles
Thu Mar 26 21:23:00 2009 cycles contain 3034535 unique relations
Thu Mar 26 21:23:23 2009 read 3034535 relations
Thu Mar 26 21:23:37 2009 multiplying 2513416 relations
Thu Mar 26 21:25:55 2009 multiply complete, coefficients have about 69.21 million bits
Thu Mar 26 21:25:56 2009 initial square root is modulo 92951
Thu Mar 26 21:29:52 2009 prp64 factor: 1495137986198626713891034616766476860505226920685712498786743139
Thu Mar 26 21:29:52 2009 prp113 factor: 12138109201739721837657904196381001857689869557081702922551111410234045319431624045172325499708883925960213827591
Thu Mar 26 21:29:52 2009 elapsed time 00:06:57
[/code]
Notice that dependency 4 went through (but didn't solve), other 5 sqrts - same error.

1.39 waltzed through on the 1st dependency.

I kept the directory intact if we want to debug this. But maybe you'll see what was changed by eyeballing?

--Serge

jasonp 2009-03-27 13:36

Is this a 32-bit x86 binary? If yes, the only relevant change I can think of is the "m"(b) for the asm() on line 339 of common/ap.c and perhaps the error would go away by changing it back to "g"(b). No idea if it's a 64-bit binary, since that doesn't use asm at all for this.

You can also try restoring the v1.39 definitions of mp_modadd_1 and mp_modsub_1 in include/mp.h, on the off-chance I did something dumb copying Ben's code. Ben, do your C versions of these work correctly when the modulus needs all 32 bits?

bsquared 2009-03-27 16:02

[quote=bsquared;164444]
Here is the code for modsub_1:
[code]
#elif defined(GCC_ASM64A)
uint32 t = a-b;
return t += ((t >> 31) * p);
[/code]

and for modadd_1

[code]
#elif defined(GCC_ASM64A)
uint32 t = a + b;
return t -= ((t >= p) * p);
[/code]

[/quote]

[quote=jasonp;166858]You can also try restoring the v1.39 definitions of mp_modadd_1 and mp_modsub_1 in include/mp.h, on the off-chance I did something dumb copying Ben's code. Ben, do your C versions of these work correctly when the modulus needs all 32 bits?[/quote]

Hmmm, well in modadd_1 if (a+b) exceeds 32 bits, then t will overflow and the comparison will likely fail, thus p won't be subtracted as it should. This is a problem if a,b,p are > 2^31. I think modsub_1 will still work if a,b,p are 32 bits. But modadd_1 can use modsub_1 like you have it defined, mp_modsub_1(a, p - b, p), so if I'm right and modsub_1 works then I think all is well.

- ben.

jasonp 2009-03-27 16:14

That's what I thought, and this may be the cause of Serge's problem. The sanity check on the NFS square root computes relation product mod a prime > 2^31.

I'll give it a few more days for some 64-bit rework to trickle in, then will release v1.41 early with this fixed.

(Only 64-bit users have to worry about this)

Batalov 2009-03-27 17:20

That's good; yes, it was a 64-bit binary; I can rebuild with 1.39 definitions.
Looking back at the c244 report (done two days ago), I see why I haven't found it back then: the filtering was done with 1.40b2, but BL and sqrt with 1.39.


All times are UTC. The time now is 04:54.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.