mersenneforum.org  

Go Back   mersenneforum.org > Factoring Projects > Msieve

Reply
 
Thread Tools
Old 2020-06-16, 19:36   #1
ryanp
 
ryanp's Avatar
 
Jun 2012
Boulder, CO

2×89 Posts
Default msieve with GMP 6.2.0

Has anyone successfully compiled and used msieve with the latest GMP release, 6.2.0?

I'm seeing segfaults during relation filtering. Some gdb debugging tracked the problem to the "if" block of this method in include/gmp_xface.h:

Code:
static INLINE void uint64_2gmp(uint64 src, mpz_t dest) {

#if GMP_LIMB_BITS == 64
        dest->_mp_d[0] = src;
        dest->_mp_size = (src ? 1 : 0);
#else
        /* mpz_import is terribly slow */
        mpz_set_ui(dest, (uint32)(src >> 32));
        mpz_mul_2exp(dest, dest, 32);
        mpz_add_ui(dest, dest, (uint32)src);
#endif
}
Commenting out the #if part (just using the mpz_* calls) seems to get things working, but I don't know if this fix is correct, or optimal.

Last fiddled with by ryanp on 2020-06-16 at 19:44 Reason: clarification
ryanp is offline   Reply With Quote
Old 2020-06-16, 19:52   #2
bsquared
 
bsquared's Avatar
 
"Ben"
Feb 2007

22×32×7×13 Posts
Default

Quote:
Originally Posted by ryanp View Post
Has anyone successfully compiled and used msieve with the latest GMP release, 6.2.0?

I'm seeing segfaults during relation filtering. Some gdb debugging tracked the problem to the "if" block of this method in include/gmp_xface.h:

Code:
static INLINE void uint64_2gmp(uint64 src, mpz_t dest) {

#if GMP_LIMB_BITS == 64
        dest->_mp_d[0] = src;
        dest->_mp_size = (src ? 1 : 0);
#else
        /* mpz_import is terribly slow */
        mpz_set_ui(dest, (uint32)(src >> 32));
        mpz_mul_2exp(dest, dest, 32);
        mpz_add_ui(dest, dest, (uint32)src);
#endif
}
Commenting out the #if part (just using the mpz_* calls) seems to get things working, but I don't know if this fix is correct, or optimal.
Yeah, I ran across this and came up with this fix:
https://www.mersenneforum.org/showpo...7&postcount=81

I suspect the problem comes about because of this from the gmp changelog:
Quote:
Internal representation of the mpz_t variables now supports lazy allocation; memory is allocated only when a value is stored.
I take that to mean that the _mp_d internals of an mpz_t now may not be actually allocated if accessed directly.
bsquared is offline   Reply With Quote
Old 2020-06-16, 20:36   #3
ryanp
 
ryanp's Avatar
 
Jun 2012
Boulder, CO

2·89 Posts
Default

Quote:
Originally Posted by bsquared View Post
Yeah, I ran across this and came up with this fix:
https://www.mersenneforum.org/showpo...7&postcount=81

I suspect the problem comes about because of this from the gmp changelog:


I take that to mean that the _mp_d internals of an mpz_t now may not be actually allocated if accessed directly.
Thanks!
ryanp is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
msieve on KNL frmky Msieve 3 2016-11-06 11:45
Msieve on a Mac (Help) pxp Msieve 1 2013-02-28 14:56
Using msieve with c burrobert Msieve 9 2012-10-26 22:46
msieve help em99010pepe Msieve 23 2009-09-27 16:13
fun with msieve masser Sierpinski/Riesel Base 5 83 2007-11-17 19:39

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

Fri Aug 7 04:13:43 UTC 2020 up 21 days, 30 secs, 1 user, load averages: 2.32, 2.07, 1.83

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

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.