From: <Ba...@us...> - 2009-04-18 03:58:56
|
Revision: 353 http://ggnfs.svn.sourceforge.net/ggnfs/?rev=353&view=rev Author: Batalov Date: 2009-04-18 03:58:53 +0000 (Sat, 18 Apr 2009) Log Message: ----------- My patches to lasieve_64 Modified Paths: -------------- trunk/src/experimental/lasieve4_64/INSTALL trunk/src/experimental/lasieve4_64/athlon64/Makefile trunk/src/experimental/lasieve4_64/athlon64/slinie1A.asm trunk/src/experimental/lasieve4_64/athlon64/slinie2A.asm trunk/src/experimental/lasieve4_64/athlon64/slinie3A.asm trunk/src/experimental/lasieve4_64/athlon64/tdslinie1.asm trunk/src/experimental/lasieve4_64/athlon64/tdslinie2.asm trunk/src/experimental/lasieve4_64/gnfs-lasieve4e.c Modified: trunk/src/experimental/lasieve4_64/INSTALL =================================================================== --- trunk/src/experimental/lasieve4_64/INSTALL 2009-04-18 03:42:10 UTC (rev 352) +++ trunk/src/experimental/lasieve4_64/INSTALL 2009-04-18 03:58:53 UTC (rev 353) @@ -2,6 +2,8 @@ follow these steps to build the binaries on a 64-bit machine. These should build and run on Athlon64, or Core2 cpus. +Prerequisites: gmp.h libgmp + cd athlon64 make liblasieve.a make liblasieveI11.a @@ -12,5 +14,6 @@ make liblasieveI16.a cp *.a .. cd .. +ln -s athlon64 asm make Modified: trunk/src/experimental/lasieve4_64/athlon64/Makefile =================================================================== --- trunk/src/experimental/lasieve4_64/athlon64/Makefile 2009-04-18 03:42:10 UTC (rev 352) +++ trunk/src/experimental/lasieve4_64/athlon64/Makefile 2009-04-18 03:58:53 UTC (rev 353) @@ -7,7 +7,7 @@ # Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -CFLAGS= -O3 -march=amdfam10 -mtune=amdfam10 +CFLAGS= -O3 -march=k8 -mtune=k8 -I. #CFLAGS= -g CC=gcc Modified: trunk/src/experimental/lasieve4_64/athlon64/slinie1A.asm =================================================================== --- trunk/src/experimental/lasieve4_64/athlon64/slinie1A.asm 2009-04-18 03:42:10 UTC (rev 352) +++ trunk/src/experimental/lasieve4_64/athlon64/slinie1A.asm 2009-04-18 03:58:53 UTC (rev 353) @@ -75,10 +75,6 @@ popq %rbx ret ifelse(j_per_strip,1,`divert`'',`divert(-1)')dnl -dnl In this case, it is possible to keep the sieve interval in a register -dnl since the register keeping the root is not needed. -define(sieve_interval_arg,sieve_interval)dnl -define(`sieve_interval',root)dnl function_head(slinie1) cmpq aux_ptr,aux_ptr_ub pushq %rbx @@ -86,11 +82,15 @@ jbe slinie1_ende subq $8,aux_ptr_ub slinie1_fbi_loop: + movzwq proot_src,auxreg movzwq prime_src,prime - movzwq root_src,sieve_ptr + movzwq root_src,root + subq prime,auxreg movb log_src,sieve_log + movq auxreg,proot movq sieve_interval,sieve_ptr_ub - leaq (sieve_interval,sieve_ptr),sieve_ptr + movq root,sieve_ptr + leaq (sieve_ptr_ub,sieve_ptr),sieve_ptr addq $n_i,sieve_ptr_ub subq prime,sieve_ptr_ub movb (sieve_ptr),sv0 Modified: trunk/src/experimental/lasieve4_64/athlon64/slinie2A.asm =================================================================== --- trunk/src/experimental/lasieve4_64/athlon64/slinie2A.asm 2009-04-18 03:42:10 UTC (rev 352) +++ trunk/src/experimental/lasieve4_64/athlon64/slinie2A.asm 2009-04-18 03:58:53 UTC (rev 353) @@ -78,10 +78,6 @@ popq %rbx ret ifelse(j_per_strip,1,`divert`'',`divert(-1)')dnl -dnl In this case, it is possible to keep the sieve interval in a register -dnl since the register keeping the root is not needed. -define(sieve_interval_arg,sieve_interval)dnl -define(`sieve_interval',root)dnl function_head(slinie2) cmpq aux_ptr,aux_ptr_ub pushq %rbx @@ -89,11 +85,15 @@ jbe slinie2_ende subq $8,aux_ptr_ub slinie2_fbi_loop: + movzwq proot_src,auxreg movzwq prime_src,prime - movzwq root_src,sieve_ptr + movzwq root_src,root + subq prime,auxreg movb log_src,sieve_log + movq auxreg,proot movq sieve_interval,sieve_ptr_ub - leaq (sieve_interval,sieve_ptr),sieve_ptr + movq root,sieve_ptr + leaq (sieve_ptr_ub,sieve_ptr),sieve_ptr addq $n_i,sieve_ptr_ub movb (sieve_ptr,prime),sv0 subq prime,sieve_ptr_ub Modified: trunk/src/experimental/lasieve4_64/athlon64/slinie3A.asm =================================================================== --- trunk/src/experimental/lasieve4_64/athlon64/slinie3A.asm 2009-04-18 03:42:10 UTC (rev 352) +++ trunk/src/experimental/lasieve4_64/athlon64/slinie3A.asm 2009-04-18 03:58:53 UTC (rev 353) @@ -85,10 +85,6 @@ popq %rbx ret ifelse(j_per_strip,1,`divert`'',`divert(-1)')dnl -dnl In this case, it is possible to keep the sieve interval in a register -dnl since the register keeping the root is not needed. -define(sieve_interval_arg,sieve_interval)dnl -define(`sieve_interval',root)dnl function_head(slinie3) cmpq aux_ptr,aux_ptr_ub pushq %rbx @@ -96,11 +92,15 @@ jbe slinie3_ende subq $8,aux_ptr_ub slinie3_fbi_loop: + movzwq proot_src,auxreg movzwq prime_src,prime - movzwq root_src,sieve_ptr + movzwq root_src,root + subq prime,auxreg movb log_src,sieve_log + movq auxreg,proot movq sieve_interval,sieve_ptr_ub - leaq (sieve_interval,sieve_ptr),sieve_ptr + movq root,sieve_ptr + leaq (sieve_ptr_ub,sieve_ptr),sieve_ptr addq $n_i,sieve_ptr_ub movb (sieve_ptr,prime),sv0 subq prime,sieve_ptr_ub Modified: trunk/src/experimental/lasieve4_64/athlon64/tdslinie1.asm =================================================================== --- trunk/src/experimental/lasieve4_64/athlon64/tdslinie1.asm 2009-04-18 03:42:10 UTC (rev 352) +++ trunk/src/experimental/lasieve4_64/athlon64/tdslinie1.asm 2009-04-18 03:58:53 UTC (rev 353) @@ -111,4 +111,4 @@ movq sieve_ptr,(tds_buffer,auxreg,8) tdsline1s_next_j`'i: ') - jmp tdslinie1_nextfbi \ No newline at end of file + jmp tdslinie1_nextfbi Modified: trunk/src/experimental/lasieve4_64/athlon64/tdslinie2.asm =================================================================== --- trunk/src/experimental/lasieve4_64/athlon64/tdslinie2.asm 2009-04-18 03:42:10 UTC (rev 352) +++ trunk/src/experimental/lasieve4_64/athlon64/tdslinie2.asm 2009-04-18 03:58:53 UTC (rev 353) @@ -127,4 +127,4 @@ movq sieve_ptr,(auxreg) tdslinie2s_next_j`'i: ') - jmp tdslinie2_next_fbi \ No newline at end of file + jmp tdslinie2_next_fbi Modified: trunk/src/experimental/lasieve4_64/gnfs-lasieve4e.c =================================================================== --- trunk/src/experimental/lasieve4_64/gnfs-lasieve4e.c 2009-04-18 03:42:10 UTC (rev 352) +++ trunk/src/experimental/lasieve4_64/gnfs-lasieve4e.c 2009-04-18 03:58:53 UTC (rev 353) @@ -1,6 +1,20 @@ -/*3:*/ -// #line 36 "gnfs-lasieve4e.w" +/* gnfs-lasieve4e.c + By Jens Franke. + 6/13/04: Hacked up for use in GGNFS by Chris Monico. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + You should have received a copy of the GNU General Public License along + with this program; see the file COPYING. If not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ +// #include "lasieve.h" + #include <stdio.h> #include <sys/types.h> #include <math.h> @@ -9,6 +23,7 @@ #include <limits.h> #include <string.h> #include <time.h> +#include <ctype.h> #ifdef LINUX #include <endian.h> #endif @@ -24,9 +39,6 @@ #define TDS_PRIMALITY_TEST TDS_IMMEDIATELY #endif -/*:3*//*4:*/ -// #line 61 "gnfs-lasieve4e.w" - #include "if.h" #include "primgen32.h" #include "asm/32bit.h" @@ -37,17 +49,11 @@ #include "gmp-aux.h" #include "lasieve-prepn.h" -/*:4*//*5:*/ -// #line 75 "gnfs-lasieve4e.w" - #define TDS_IMMEDIATELY 0 #define TDS_BIGSS 1 #define TDS_ODDNESS_CLASS 2 #define TDS_SPECIAL_Q 3 -/*:5*//*6:*/ -// #line 82 "gnfs-lasieve4e.w" - #define GCD_SIEVE_BOUND 10 #include "asm/siever-config.c" @@ -61,23 +67,15 @@ u32_t nss= 0,nzss[3]= {0,0,0}; #endif -static float -FB_bound[2],sieve_report_multiplier[2]; +static float FB_bound[2],sieve_report_multiplier[2]; static u16_t sieve_min[2],max_primebits[2],max_factorbits[2]; static u32_t*(FB[2]),*(proots[2]),FBsize[2]; - -/*44:*/ -// #line 1610 "gnfs-lasieve4e.w" - static double*(tpoly_f[2]); #define CANDIDATE_SEARCH_STEPS 128 static unsigned char**(sieve_report_bounds[2]); static i32_t n_srb_i,n_srb_j; -/*:44*/ -// #line 102 "gnfs-lasieve4e.w" - static u32_t b,first_spq,first_spq1,first_root,last_spq,sieve_count; static mpz_t m,N,aux1,aux2,aux3,sr_a,sr_b; @@ -89,7 +87,8 @@ i32_t poldeg[2],poldeg_max; -u32_t keep_factorbase; +u32_t keep_factorbase; +u32_t g_resume; #define MAX_LPFACTORS 3 static mpz_t rational_rest,algebraic_rest; mpz_t factors[MAX_LPFACTORS]; @@ -103,49 +102,34 @@ static i64_t tdsi_clock[2]= {0,0},tds1_clock[2]= {0,0},tds2_clock[2]= {0,0}; static i64_t tds3_clock[2]= {0,0},tds4_clock[2]= {0,0}; -char*basename; -char*input_line= NULL; +char *base_name; +char *input_line= NULL; size_t input_line_alloc= 0; -/*:6*//*7:*/ -// #line 133 "gnfs-lasieve4e.w" static u32_t ncand; static u16_t*cand; static unsigned char*fss_sv; +u32_t process_no; +char *sysload_cmd; +double sieveStartTime; -/*:7*//*8:*/ -// #line 139 "gnfs-lasieve4e.w" - static int tdcand_cmp(const void*x,const void*y) { -return(int)(*((u16_t*)x))-(int)(*((u16_t*)y)); + return(int)(*((u16_t*)x))-(int)(*((u16_t*)y)); } -/*:8*//*9:*/ -// #line 155 "gnfs-lasieve4e.w" - typedef struct xFBstruct{ -u32_t p,pp,q,qq,r,l; + u32_t p,pp,q,qq,r,l; }*xFBptr; static volatile xFBptr xFB[2]; static volatile u32_t xFBs[2]; -/*:9*//*10:*/ -// #line 181 "gnfs-lasieve4e.w" - static void xFBtranslate(u16_t*rop,xFBptr op); static int xFBcmp(const void*,const void*); -/*:10*//*12:*/ -// #line 196 "gnfs-lasieve4e.w" +static u32_t add_primepowers2xaFB(size_t*aFB_alloc_ptr,u32_t pp_bound,u32_t side,u32_t p,u32_t r); -static u32_t add_primepowers2xaFB(size_t*aFB_alloc_ptr, -u32_t pp_bound,u32_t side,u32_t p,u32_t r); - -/*:12*//*13:*/ -// #line 214 "gnfs-lasieve4e.w" - i32_t a0,a1,b0,b1; #if 0 u32_t I_bits; @@ -154,66 +138,36 @@ u32_t root_no; float sigma; -/*:13*//*14:*/ -// #line 234 "gnfs-lasieve4e.w" - static u32_t oddness_type; static u32_t n_i,n_j,i_bits,j_bits; -/*:14*//*15:*/ -// #line 239 "gnfs-lasieve4e.w" - -/*18:*/ -// #line 461 "gnfs-lasieve4e.w" - u32_t spq_i,spq_j,spq_x; -/*:18*//*28:*/ -// #line 995 "gnfs-lasieve4e.w" - u32_t fbi1[2]; -/*:28*//*29:*/ -// #line 1000 "gnfs-lasieve4e.w" - u32_t fbis[2]; -/*:29*//*31:*/ -// #line 1101 "gnfs-lasieve4e.w" - static u32_t j_per_strip,jps_bits,jps_mask,n_strips; static struct schedule_struct{ -u16_t***schedule; -u32_t*fbi_bounds; -u32_t n_pieces; -unsigned char*schedlogs; -u16_t n_strips,current_strip; -size_t alloc,alloc1; -u32_t*ri; + u16_t***schedule; + u32_t*fbi_bounds; + u32_t n_pieces; + unsigned char*schedlogs; + u16_t n_strips,current_strip; + size_t alloc,alloc1; + u32_t*ri; }*(schedules[2]); u32_t n_schedules[2]; -/*:31*//*32:*/ -// #line 1115 "gnfs-lasieve4e.w" - static u32_t*(LPri[2]); #define RI_SIZE 2 -/*:32*//*33:*/ -// #line 1120 "gnfs-lasieve4e.w" - static u32_t*(current_ij[2]); -/*:33*//*34:*/ -// #line 1127 "gnfs-lasieve4e.w" - static size_t sched_alloc[2]; #define SE_SIZE 2 #define SCHEDFBI_MAXSTEP 0x10000 -/*:34*//*38:*/ -// #line 1338 "gnfs-lasieve4e.w" - #define USE_MEDSCHED #ifdef USE_MEDSCHED static u16_t**(med_sched[2]); @@ -223,9 +177,6 @@ static u16_t n_medsched_pieces[2]; #endif -/*:38*//*40:*/ -// #line 1392 "gnfs-lasieve4e.w" - static unsigned char*sieve_interval= NULL,*(FB_logs[2]); static unsigned char*tiny_sieve_buffer; #define TINY_SIEVEBUFFER_SIZE 420 @@ -233,43 +184,22 @@ static double sieve_multiplier[2],FB_maxlog[2]; static u32_t j_offset; -/*:40*//*48:*/ -// #line 1682 "gnfs-lasieve4e.w" - void do_scheduling(struct schedule_struct*,u32_t,u32_t,u32_t); -/*:48*//*51:*/ -// #line 1729 "gnfs-lasieve4e.w" - static u16_t*(smallsieve_aux[2]),*(smallsieve_auxbound[2][5]); static u16_t*(smallsieve_tinybound[2]); -/*:51*//*52:*/ -// #line 1737 "gnfs-lasieve4e.w" - static u16_t*(smallsieve_aux1[2]),*(smallsieve_aux1_ub_odd[2]); static u16_t*(smallsieve_aux1_ub[2]),*(smallsieve_tinybound1[2]); -/*:52*//*53:*/ -// #line 1744 "gnfs-lasieve4e.w" - static u16_t*(smallsieve_aux2[2]),*(smallsieve_aux2_ub[2]); -/*:53*//*54:*/ -// #line 1761 "gnfs-lasieve4e.w" - static u16_t*(smallpsieve_aux[2]),*(smallpsieve_aux_ub_pow1[2]); static u16_t*(smallpsieve_aux_ub_odd[2]),*(smallpsieve_aux_ub[2]); static unsigned char*horizontal_sievesums; -/*:54*//*55:*/ -// #line 1768 "gnfs-lasieve4e.w" - static u16_t*(x2FB[2]),x2FBs[2]; -/*:55*//*56:*/ -// #line 1776 "gnfs-lasieve4e.w" - static u16_t*tinysieve_curpos; #ifndef MMX_TD static u16_t**(smalltdsieve_aux[2]); @@ -278,46 +208,25 @@ #endif #endif -/*:56*//*57:*/ -// #line 1788 "gnfs-lasieve4e.w" - #ifdef GCD_SIEVE_BOUND static u32_t np_gcd_sieve; static unsigned char*gcd_sieve_buffer; static void gcd_sieve(void); #endif -/*:57*//*95:*/ -// #line 2777 "gnfs-lasieve4e.w" - u16_t**schedbuf; -/*:95*//*103:*/ -// #line 2872 "gnfs-lasieve4e.w" - static void store_candidate(u16_t,u16_t,unsigned char); -/*:103*//*110:*/ -// #line 3050 "gnfs-lasieve4e.w" - void trial_divide(void); -/*:110*//*124:*/ -// #line 3486 "gnfs-lasieve4e.w" - #ifndef SCHED_TDS_BUFSIZE #define SCHED_TDS_BUFSIZE 1024 #endif u16_t*(sched_tds_buffer[SCHED_TDS_BUFSIZE]); -/*:124*//*140:*/ -// #line 3896 "gnfs-lasieve4e.w" - u32_t*mpz_trialdiv(mpz_t N,u32_t*pbuf,u32_t ncp,char*errmsg); -/*:140*//*142:*/ -// #line 3949 "gnfs-lasieve4e.w" - static void output_tdsurvivor(u32_t*,u32_t*,u32_t*,u32_t*,mpz_t,mpz_t); static void store_tdsurvivor(u32_t*,u32_t*,u32_t*,u32_t*,mpz_t,mpz_t); static int primality_tests(void); @@ -330,9 +239,6 @@ #define MAX_TDS_INCREMENT 1024 #define TDS_FBP_ALLOC_INCREMENT 8192 -/*:142*//*150:*/ -// #line 4229 "gnfs-lasieve4e.w" - #if 0 #define OFMT_CWI #endif @@ -340,23 +246,11 @@ static char u32_t2cwi(u32_t); #endif -/*:150*//*153:*/ -// #line 4263 "gnfs-lasieve4e.w" - void dumpsieve(u32_t j_offset,u32_t side); -/*:153*/ -// #line 240 "gnfs-lasieve4e.w" - -/*114:*/ -// #line 3135 "gnfs-lasieve4e.w" - u32_t*(td_buf[2]),**td_buf1; size_t td_buf_alloc[2]= {1024,1024}; -/*:114*//*119:*/ -// #line 3306 "gnfs-lasieve4e.w" - static unsigned char tds_coll[UCHAR_MAX]; u32_t**tds_fbi= NULL; u32_t**tds_fbi_curpos= NULL; @@ -365,26 +259,20 @@ static size_t tds_fbi_alloc= TDFBI_ALLOC; #endif -/*:119*//*138:*/ -// #line 3871 "gnfs-lasieve4e.w" - static mpz_t td_rests[L1_SIZE]; static mpz_t large_factors[2],*(large_primes[2]); static mpz_t FBb_sq[2]; -/*:138*/ -// #line 241 "gnfs-lasieve4e.w" - void Usage() { -complain("Usage"); + complain("Usage"); } static u32_t n_prereports= 0,n_reports= 0,n_rep1= 0,n_rep2= 0; static u32_t n_tdsurvivors[2]= {0,0}; -static FILE*ofile; -static char*ofile_name; +static FILE*g_ofile; +static char*g_ofile_name; #ifdef STC_DEBUG FILE*debugfile; @@ -413,8 +301,8 @@ static void terminate_sieving(int signo) { -exitval= USER_INTERRUPT_EXITVAL; -longjmp(termination_jb,USER_INTERRUPT); + exitval= USER_INTERRUPT_EXITVAL; + longjmp(termination_jb,USER_INTERRUPT); } static clock_t last_clock; @@ -423,2135 +311,1995 @@ extern u64_t MMX_TdNloop; #endif -main(int argc,char**argv) +/*******************************************************/ +double sTime() + /*******************************************************/ +#if 0 && !defined (_MSC_VER) && !defined (__MINGW32__) && !defined (MINGW32) { -u16_t zip_output,force_aFBcalc; -u16_t catch_signals; -u32_t all_spq_done; -u32_t n_spq,n_spq_discard; -double tStart, tNow, lastReport; -char*sysload_cmd; -u32_t process_no; -#ifdef STC_DEBUG -debugfile= fopen("rtdsdebug","w"); + static struct timeval this_tv; + static struct timezone dumbTZ; + double t; + + gettimeofday(&this_tv, &dumbTZ); + t = this_tv.tv_sec + 0.000001*this_tv.tv_usec; + return t; +} +#else +{ + return clock() / (double)CLOCKS_PER_SEC; +} #endif -/*21:*/ -// #line 562 "gnfs-lasieve4e.w" +/**************************************************/ +void logTotalTime() + /**************************************************/ { -i32_t option; -FILE*input_data; -u32_t i; + double t=sTime()-sieveStartTime; + FILE *fp=fopen("ggnfs.log", "a"); + + fprintf(fp, "\tLatSieveTime: %ld\n", (long)t); + fclose(fp); +} -sieve_count= U32_MAX; -ofile_name= NULL; -zip_output= 0; -special_q_side= NO_SIDE; -sigma= 0; -keep_factorbase= 0; -basename= NULL; -first_spq= 0; -sieve_count= 1; -force_aFBcalc= 0; -sysload_cmd= NULL; -process_no= 0; -catch_signals= 0; +/**************************************************/ +int parse_q_from_line(char *buf) { + /**************************************************/ + char *p, *tmp, *next_field; + u32_t q, q0, i, side; + static int first=0; + + for(p=tmp=buf; *p && isspace(*p); p++); + if(!*p) return 0; /* empty line, skip */ + + side = (special_q_side == RATIONAL_SIDE) ? 0 : 1; + for(i=0; *p; p++) { + if(*p == ':') { + if(i++ == side) tmp = p; /* we will only scan this section for a q0 */ + } else if(!(*p == '-' || *p == ',' || isspace(*p) || isxdigit(*p))) { + if(first++ == 0) printf(" Warning! some corrupt lines in the original file\n"); + return -1; + } + } + if(i!=2) { + printf(" Warning: an incomplete line in the original file; if just a few, it's ok, they will be skipped\n"); + return -1; /* must have two ':' some ',' and hexdigits */ + } + + q0 = first_spq; + do { + q = strtoul(tmp + 1, &next_field, 16); + if(q >= first_spq && q < first_spq+sieve_count) + q0 = q; + tmp = next_field; + } while(tmp[0] == ',' && isxdigit(tmp[1])); + + /* I've seen cases when q0 is not the last reported in the comma-separated list */ + /* However, the closer it is to the end of the line the more likely it was the true q0 */ + /* In 99% cases it is the last value, but we don't want to depend on that */ + + if(q0 > first_spq && q0 < first_spq+sieve_count) { + sieve_count -= (q0 - first_spq); + first_spq = q0; + } + return 1; +} -first_psp_side= 2; -first_mpqs_side= 0; -J_bits= U32_MAX; - +/**************************************************/ +int main(int argc, char **argv) + /**************************************************/ +{ + u16_t zip_output,force_aFBcalc; + u16_t catch_signals; + u32_t all_spq_done; + u32_t n_spq, n_spq_discard; + double tStart, tNow, lastReport; + +#if defined (_MSC_VER) && defined (_DEBUG) + int tmpDbgFlag; + tmpDbgFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); + /* + tmpDbgFlag |= _CRTDBG_CHECK_ALWAYS_DF; + tmpDbgFlag |= _CRTDBG_CHECK_CRT_DF; + tmpDbgFlag |= _CRTDBG_DELAY_FREE_MEM_DF; + */ + tmpDbgFlag |= _CRTDBG_LEAK_CHECK_DF; + _CrtSetDbgFlag(tmpDbgFlag); +#endif + + n_spq = 0; + n_spq_discard = 0; + + sieveStartTime = sTime(); + +#ifdef STC_DEBUG + debugfile= fopen("rtdsdebug","w"); +#endif + { + i32_t option; + FILE*input_data; + u32_t i; + + sieve_count= U32_MAX; + g_ofile_name= NULL; + zip_output= 0; + special_q_side= NO_SIDE; + sigma= 0; + keep_factorbase= 0; + g_resume= 0; + base_name= NULL; + first_spq= 0; + sieve_count= 1; + force_aFBcalc= 0; + sysload_cmd= NULL; + process_no= 0; + catch_signals= 0; + + first_psp_side= 2; + first_mpqs_side= 0; + J_bits= U32_MAX; + #define NumRead(x) if(sscanf(optarg,"%u",&x)!=1) Usage() #define NumRead16(x) if(sscanf(optarg,"%hu",&x)!=1) Usage() - -append_output= 0; -while((option= getopt(argc,argv,"FJ:L:M:N:P:S:ab:c:f:i:kn:o:q:rt:vz"))!=-1){ -switch(option){ -case'F': -force_aFBcalc= 1; -break; -case'J': -NumRead(J_bits); -break; -case'L': -sysload_cmd= optarg; -break; -case'M': -NumRead16(first_mpqs_side); -break; -case'P': -NumRead16(first_psp_side); -break; -case'S': -if(sscanf(optarg,"%f",&sigma)!=1){ -errprintf("Cannot read floating point number %s\n",optarg); -Usage(); -} -break; -case'a': -if(special_q_side!=NO_SIDE){ -errprintf("Ignoring -a\n"); -break; -} -special_q_side= ALGEBRAIC_SIDE; -break; -case'b': -if(basename!=NULL)errprintf("Ignoring -b %s\n",basename); -else basename= optarg; -break; -case'c': -NumRead(sieve_count); -break; -case'f': -if(sscanf(optarg,"%u:%u:%u",&first_spq,&first_spq1,&first_root)!=3){ -if(sscanf(optarg,"%u",&first_spq)==1){ -first_spq1= first_spq; -first_root= 0; -}else Usage(); -}else append_output= 1; -break; -case'i': -if(sscanf(optarg,"%hu",&cmdline_first_sieve_side)!=1) -complain("-i %s ???\n",optarg); -break; -case'k': -keep_factorbase= 1; -break; -case'n': -catch_signals= 1; -case'N': -NumRead(process_no); -break; -case'o': -ofile_name= optarg; -break; -case'q': -NumRead16(special_q_side); -break; -case'r': -if(special_q_side!=NO_SIDE){ -errprintf("Ignoring -r\n"); -break; -} -special_q_side= RATIONAL_SIDE; -break; -case't': -if(sscanf(optarg,"%hu",&cmdline_first_td_side)!=1) -complain("-t %s ???\n",optarg); -break; -case'v': -verbose++; -break; -case'z': -zip_output= 1; -break; -} -} -if(J_bits==U32_MAX)J_bits= I_bits-1; -if(first_psp_side==2)first_psp_side= first_mpqs_side; + + append_output= 0; + while((option= getopt(argc,argv,"FJ:L:M:N:P:RS:ab:c:f:i:kn:o:q:rt:vz"))!=-1) { + switch(option) { + case 'R': + g_resume = 1; break; + case'F': + force_aFBcalc= 1; + break; + case'J': + NumRead(J_bits); + break; + case'L': + sysload_cmd= optarg; + break; + case'M': + NumRead16(first_mpqs_side); + break; + case'P': + NumRead16(first_psp_side); + break; + case'S': + if(sscanf(optarg,"%f",&sigma)!=1) { + errprintf("Cannot read floating point number %s\n",optarg); + Usage(); + } + break; + case'a': + if(special_q_side!=NO_SIDE) { + errprintf("Ignoring -a\n"); + break; + } + special_q_side= ALGEBRAIC_SIDE; + break; + case'b': + if(base_name!=NULL)errprintf("Ignoring -b %s\n",base_name); + else base_name= optarg; + break; + case'c': + NumRead(sieve_count); + break; + case'f': + if(sscanf(optarg,"%u:%u:%u",&first_spq,&first_spq1,&first_root)!=3) { + if(sscanf(optarg,"%u",&first_spq) == 1) { + first_spq1= first_spq; + first_root= 0; + } else Usage(); + } else append_output= 1; + break; + case'i': + if(sscanf(optarg,"%hu",&cmdline_first_sieve_side)!=1) + complain("-i %s ???\n",optarg); + break; + case'k': + keep_factorbase= 1; + break; + case'n': + catch_signals= 1; + case'N': + NumRead(process_no); + break; + case'o': + g_ofile_name= optarg; + break; + case'q': + NumRead16(special_q_side); + break; + case'r': + if(special_q_side!=NO_SIDE) { + errprintf("Ignoring -r\n"); + break; + } + special_q_side= RATIONAL_SIDE; + break; + case't': + if(sscanf(optarg,"%hu",&cmdline_first_td_side)!=1) + complain("-t %s ???\n",optarg); + break; + case'v': + verbose++; + break; + case'z': + zip_output= 1; + break; + } + } + +#define LINE_BUF_SIZE 300 + + if (g_resume != 0) { + char buf[LINE_BUF_SIZE]; + int ret; + + if (zip_output != 0) + complain("Cannot resume gzipped file. gunzip, and retry without -z\n"); + if (g_ofile_name == NULL) + complain("Cannot resume without the file name\n"); + if (strcmp(g_ofile_name, "-") == 0) + complain("Cannot resume using stdout\n"); + if ((g_ofile = fopen(g_ofile_name, "ab+")) == NULL) + complain("Cannot open %s for append: %m\n", g_ofile_name); + while(fgets(buf, LINE_BUF_SIZE, g_ofile)) { + ret = parse_q_from_line(buf); + } + if(ret < 0) fprintf(g_ofile, "\n"); /* encapsulating the last incomplete line */ + printf(" Resuming with -f %d -c %d\n", first_spq, sieve_count); + first_spq1 = first_spq; + } + + if(J_bits == U32_MAX) + J_bits = I_bits-1; + if(first_psp_side == 2) + first_psp_side = first_mpqs_side; #ifndef I_bits #error Must #define I_bits #endif - -if(optind<argc&&basename==NULL){ -basename= argv[optind]; -optind++; -} -if(optind<argc)fprintf(stderr,"Ignoring %u trailing command line args\n", -argc-optind); -if(basename==NULL)basename= "gnfs"; -if((input_data= fopen(basename,"r"))==NULL){ -complain("Cannot open %s for input of nfs polynomials: %m\n",basename); -} -mpz_init(N); -mpz_init(m); -mpz_init(aux1); -mpz_init(aux2); -mpz_init(aux3); -mpz_init(sr_a); -mpz_init(sr_b); -mpz_ull_init(); -mpz_init(rational_rest); -mpz_init(algebraic_rest); -//input_poly(N,poly,poldeg,poly+1,poldeg+1,m,input_data); + + if(optind<argc&&base_name == NULL) { + base_name= argv[optind]; + optind++; + } + if(optind<argc)fprintf(stderr,"Ignoring %u trailing command line args\n", + argc-optind); + if(base_name == NULL)base_name= "gnfs"; + if((input_data= fopen(base_name,"r")) == NULL) { + complain("Cannot open %s for input of nfs polynomials: %m\n",base_name); + } + mpz_init(N); + mpz_init(m); + mpz_init(aux1); + mpz_init(aux2); + mpz_init(aux3); + mpz_init(sr_a); + mpz_init(sr_b); + mpz_ull_init(); + mpz_init(rational_rest); + mpz_init(algebraic_rest); + //input_poly(N,poly,poldeg,poly+1,poldeg+1,m,input_data); #if 0 -if(poldeg[1]> 1){ -if(poldeg[0]==1){ -mpz_t*X; -poldeg[0]= poldeg[1]; -poldeg[1]= 1; -X= poly[0]; -poly[0]= poly[1]; -poly[1]= X; -}else{ -complain("Degrees >1 on both sides not implemented\n"); -} -} + if(poldeg[1]> 1) { + if(poldeg[0] == 1) { + mpz_t*X; + poldeg[0]= poldeg[1]; + poldeg[1]= 1; + X= poly[0]; + poly[0]= poly[1]; + poly[1]= X; + } else { + complain("Degrees >1 on both sides not implemented\n"); + } + } #endif -//skip_blanks_comments(&input_line,&input_line_alloc,input_data); -close(input_data); - { FILE *fp; - char token[256], value[512], thisLine[1024]; - - - sieve_min[0] = sieve_min[1]=0; - - if (!(fp = fopen(basename, "rb"))) { - printf("Error opening %s for read!\n", basename); - return -1; - } - input_poly(N, poly, poldeg, poly + 1, poldeg + 1, m, fp); - rewind(fp); - while (!(feof(fp))) { - thisLine[0] = 0; - fgets(thisLine, 1023, fp); - /* Special case: If there's a polynomial, handle it seperately: */ - if (strncmp(thisLine, "START_POLY", 10)==0) { - while (!(feof(fp)) && strncmp(thisLine, "END_POLY", 8)) - fgets(thisLine, 1023, fp); - } else if ((sscanf(thisLine, "%255s %511s", token, value)==2) && - (thisLine[0] != '#')) { - - token[sizeof(token)-1] = 0; - if (strncmp(token, "skew:", 5)==0) { - sigma = (float)atof(value); - } else if (strncmp(token, "q0:", 3)==0) { - first_spq = atol(value); - first_spq1= first_spq; - first_root= 0; - - } else if (strncmp(token, "qintsize:", 9)==0) { - sieve_count = atol(value); - } else if ((strncmp(token, "skip0:", 6)==0) || - (strncmp(token, "askip:", 6)==0)) { - sieve_min[0] = atol(value); - } else if ((strncmp(token, "skip1:", 6)==0) || - (strncmp(token, "rskip:", 6)==0)) { - sieve_min[1] = atol(value); - } else if ((strncmp(token, "lim0:", 5)==0) || - (strncmp(token, "alim:", 5)==0)) { - FB_bound[0] = (float)atol(value); - } else if ((strncmp(token, "lim1:", 5)==0)|| - (strncmp(token, "rlim:", 5)==0)) { - FB_bound[1] = (float)atof(value); - } else if ((strncmp(token, "lpb0:", 5)==0) || - (strncmp(token, "lpba:", 5)==0)) { - max_primebits[0] = atoi(value); - } else if ((strncmp(token, "lpb1:", 5)==0) || - (strncmp(token, "lpbr:", 5)==0)) { - max_primebits[1] = atoi(value); - } else if ((strncmp(token, "mfb0:", 5)==0) || - (strncmp(token, "mfba:", 5)==0)) { - max_factorbits[0] = atoi(value); - } else if ((strncmp(token, "mfb1:", 5)==0) || - (strncmp(token, "mfbr:", 5)==0)) { - value[sizeof(value)-1] = 0; - max_factorbits[1] = atoi(value); - } else if ((strncmp(token, "lambda0:", 8)==0) || - (strncmp(token, "alambda:", 8)==0)) { - sieve_report_multiplier[0] = (float)atof(value); - } else if ((strncmp(token, "lambda1:", 8)==0) || - (strncmp(token, "rlambda:", 8)==0)) { - sieve_report_multiplier[1] = (float)atof(value); - } + //skip_blanks_comments(&input_line,&input_line_alloc,input_data); + close(input_data); + { FILE *fp; + char token[256], value[512], thisLine[1024]; + + + sieve_min[0] = sieve_min[1]=0; + + if (!(fp = fopen(base_name, "rb"))) { + printf("Error opening %s for read!\n", base_name); + return -1; + } + input_poly(N, poly, poldeg, poly + 1, poldeg + 1, m, fp); + rewind(fp); + while (!(feof(fp))) { + thisLine[0] = 0; + fgets(thisLine, 1023, fp); + /* Special case: If there's a polynomial, handle it seperately: */ + if (strncmp(thisLine, "START_POLY", 10) == 0) { + while (!(feof(fp)) && strncmp(thisLine, "END_POLY", 8)) + fgets(thisLine, 1023, fp); + } else if ((sscanf(thisLine, "%255s %511s", token, value) == 2) && + (thisLine[0] != '#')) { + + token[sizeof(token)-1] = 0; + if (strncmp(token, "skew:", 5) == 0) { + sigma = (float)atof(value); + } else if (strncmp(token, "q0:", 3) == 0) { + first_spq = atol(value); + first_spq1= first_spq; + first_root= 0; + + } else if (strncmp(token, "qintsize:", 9) == 0) { + sieve_count = atol(value); + } else if ((strncmp(token, "skip0:", 6) == 0) || + (strncmp(token, "askip:", 6) == 0)) { + sieve_min[0] = atol(value); + } else if ((strncmp(token, "skip1:", 6) == 0) || + (strncmp(token, "rskip:", 6) == 0)) { + sieve_min[1] = atol(value); + } else if ((strncmp(token, "lim0:", 5) == 0) || + (strncmp(token, "alim:", 5) == 0)) { + FB_bound[0] = (float)atol(value); + } else if ((strncmp(token, "lim1:", 5) == 0)|| + (strncmp(token, "rlim:", 5) == 0)) { + FB_bound[1] = (float)atof(value); + } else if ((strncmp(token, "lpb0:", 5) == 0) || + (strncmp(token, "lpba:", 5) == 0)) { + max_primebits[0] = atoi(value); + } else if ((strncmp(token, "lpb1:", 5) == 0) || + (strncmp(token, "lpbr:", 5) == 0)) { + max_primebits[1] = atoi(value); + } else if ((strncmp(token, "mfb0:", 5) == 0) || + (strncmp(token, "mfba:", 5) == 0)) { + max_factorbits[0] = atoi(value); + } else if ((strncmp(token, "mfb1:", 5) == 0) || + (strncmp(token, "mfbr:", 5) == 0)) { + value[sizeof(value)-1] = 0; + max_factorbits[1] = atoi(value); + } else if ((strncmp(token, "lambda0:", 8) == 0) || + (strncmp(token, "alambda:", 8) == 0)) { + sieve_report_multiplier[0] = (float)atof(value); + } else if ((strncmp(token, "lambda1:", 8) == 0) || + (strncmp(token, "rlambda:", 8) == 0)) { + sieve_report_multiplier[1] = (float)atof(value); + } #ifdef _NO - else { - printf("Warning: Ignoring input line:\n%s\n", thisLine); - } + else { + printf("Warning: Ignoring input line:\n%s\n", thisLine); + } #endif - } - } - fclose(fp); - } - last_spq= first_spq+sieve_count; -if(last_spq>=I32_MAX/2){ -complain("Cannot handle special q >= %d\n",I32_MAX/2); -} -for(i= 0;i<2;i++){ -if(FB_bound[i]<4||sieve_report_multiplier[i]<=0){ -complain("Please set all bounds to reasonable values!\n"); -} + } + } + fclose(fp); + } + last_spq= first_spq+sieve_count; + if(last_spq>=I32_MAX/2) { + complain("Cannot handle special q >= %d\n",I32_MAX/2); + } + for(i= 0;i<2;i++) { + if(FB_bound[i]<4||sieve_report_multiplier[i]<=0) { + complain("Please set all bounds to reasonable values!\n"); + } #if 1 -if(max_primebits[i]> 33){ -complain("Only large primes up to 33 bits are allowed.\n"); -} + if(max_primebits[i]> 33) { + complain("Only large primes up to 33 bits are allowed.\n"); + } #endif -} -if(sieve_count!=0){ -if(sigma==0)complain("Please set a skewness\n"); -if(special_q_side==NO_SIDE){ -errprintf("Please use -a or -r\n"); -Usage(); -} -if(FB_bound[special_q_side]> first_spq){ -FB_bound[special_q_side]=(float) first_spq-1; -printf("Warning: lowering FB_bound to %u.\n",first_spq-1); -//complain("Special q lower bound %u below rFB bound %g\n", -//first_spq,FB_bound[special_q_side]); -} -} -fclose(input_data); -if(poldeg[0]<poldeg[1])poldeg_max= poldeg[1]; -else poldeg_max= poldeg[0]; - - - -i_shift= 1<<(I_bits-1); -n_I= 1<<I_bits; -n_i= n_I/2; -i_bits= I_bits-1; -n_J= 1<<J_bits; -n_j= n_J/2; -j_bits= J_bits-1; -/*22:*/ -// #line 775 "gnfs-lasieve4e.w" - -{ -u32_t i,j; -double x,y,z; - -x= sqrt(first_spq*sigma)*n_I; -y= x/sigma; -for(j= 0;j<2;j++){ -poly_f[j]= xmalloc((poldeg[j]+1)*sizeof(*poly_f[j])); - -for(i= 0,z= 1,poly_norm[j]= 0; -i<=poldeg[j];i++){ -poly_f[j][i]= mpz_get_d(poly[j][i]); -poly_norm[j]= poly_norm[j]*y+fabs(poly_f[j][i])*z; -z*= x; -} -} -} - -/*:22*/ -// #line 771 "gnfs-lasieve4e.w" - -} - -/*:21*/ -// #line 301 "gnfs-lasieve4e.w" - -siever_init(); -/*23:*/ -// #line 795 "gnfs-lasieve4e.w" - -if(sieve_count!=0){ - -if(ofile_name==NULL){ -if(zip_output==0){ -asprintf(&ofile_name,"%s.lasieve-%u.%u-%u",basename, -special_q_side,first_spq,last_spq); -}else{ -asprintf(&ofile_name, -append_output==0? -"gzip --best --stdout > %s.lasieve-%u.%u-%u.gz": -"gzip --best --stdout >> %s.lasieve-%u.%u-%u.gz", -basename,special_q_side,first_spq,last_spq); -} -}else{ -if(strcmp(ofile_name,"-")==0){ -if(zip_output==0){ -ofile= stdout; -ofile_name= "to stdout"; -goto done_opening_output; -}else ofile_name= "gzip --best --stdout"; -}else{ -if(fnmatch("*.gz",ofile_name,0)==0){ -char*on1; - -zip_output= 1; -on1= strdup(ofile_name); -asprintf(&ofile_name,"gzip --best --stdout > %s",on1); -free(on1); -}else zip_output= 0; -} -} -if(zip_output==0){ -if(append_output> 0){ -ofile= fopen(ofile_name,"a"); -}else ofile= fopen(ofile_name,"w"); -if(ofile==NULL)complain("Cannot open %s for output: %m\n",ofile_name); -}else{ -if((ofile= popen(ofile_name,"w"))==NULL) -complain("Cannot exec %s for output: %m\n",ofile_name); -} -done_opening_output: -fprintf(ofile,""); -} - -/*:23*/ -// #line 303 "gnfs-lasieve4e.w" - -/*24:*/ -// #line 845 "gnfs-lasieve4e.w" - -{ -size_t FBS_alloc= 4096; -u32_t prime; -pr32_struct ps; -char*afbname; -FILE*afbfile; -u32_t side; - -initprime32(&ps); - -for(side= 0;side<2;side++){ -if(poldeg[side]==1){ -FB[side]= xmalloc(FBS_alloc*sizeof(u32_t)); -proots[side]= xmalloc(FBS_alloc*sizeof(u32_t)); -prime= firstprime32(&ps); -for(prime= nextprime32(&ps),fbi1[side]= 0,FBsize[side]= 0; -prime<FB_bound[side];prime= nextprime32(&ps)){ -u32_t x; -x= mpz_fdiv_ui(poly[side][1],prime); -if(x> 0){ -modulo32= prime; -x= modmul32(modinv32(x),mpz_fdiv_ui(poly[side][0],prime)); -x= x> 0?prime-x:0; -}else x= prime; -if(prime<L1_SIZE)fbi1[side]= FBsize[side]; -if(prime<n_i)fbis[side]= FBsize[side]; -if(FBsize[side]==FBS_alloc){ -FBS_alloc*= 2; -FB[side]= xrealloc(FB[side],FBS_alloc*sizeof(u32_t)); -proots[side]= xrealloc(proots[side],FBS_alloc*sizeof(u32_t)); -} -proots[side][FBsize[side]]= x; -FB[side][FBsize[side]++]= prime; -} -proots[side]= xrealloc(proots[side],FBsize[side]*sizeof(u32_t)); -FB[side]= xrealloc(FB[side],FBsize[side]*sizeof(u32_t)); -fbi1[side]++; -fbis[side]++; -if(fbi1[side]<fbis[side])fbi1[side]= fbis[side]; -}else{ -u32_t j,k,l; -asprintf(&afbname,"%s.afb.%u",basename,side); -if(force_aFBcalc> 0||(afbfile= fopen(afbname,"r"))==NULL){ -/*25:*/ -// #line 930 "gnfs-lasieve4e.w" - -u32_t*root_buffer; -size_t aFB_alloc; - -root_buffer= xmalloc(poldeg[side]*sizeof(*root_buffer)); -aFB_alloc= 4096; -FB[side]= xmalloc(aFB_alloc*sizeof(**FB)); -proots[side]= xmalloc(aFB_alloc*sizeof(**proots)); -for(prime= firstprime32(&ps),FBsize[side]= 0; -prime<FB_bound[side];prime= nextprime32(&ps)){ -u32_t i,nr; - -nr= root_finder(root_buffer,poly[side],poldeg[side],prime); -for(i= 0;i<nr;i++){ -if(aFB_alloc<=FBsize[side]){ -aFB_alloc*= 2; -FB[side]= xrealloc(FB[side],aFB_alloc*sizeof(**FB)); -proots[side]= xrealloc(proots[side],aFB_alloc*sizeof(**proots)); -} -FB[side][FBsize[side]]= prime; -proots[side][FBsize[side]]= root_buffer[i]; -if(prime> 2)FBsize[side]++; -} -} -FB[side]= xrealloc(FB[side],FBsize[side]*sizeof(**FB)); -proots[side]= xrealloc(proots[side],FBsize[side]*sizeof(**proots)); -free(root_buffer); - -/*:25*/ -// #line 889 "gnfs-lasieve4e.w" - -if(keep_factorbase> 0)/*27:*/ -// #line 975 "gnfs-lasieve4e.w" - -{ -if((afbfile= fopen(afbname,"w"))==NULL){ -complain("Cannot open %s for output of aFB: %m\n",afbname); -} -if(write_u32(afbfile,&(FBsize[side]),1)!=1){ -complain("Cannot write aFBsize to %s: %m\n",afbname); -} -if(write_u32(afbfile,FB[side],FBsize[side])!=FBsize[side]|| -write_u32(afbfile,proots[side],FBsize[side])!=FBsize[side]){ -complain("Cannot write aFB to %s: %m\n",afbname); -} -if(write_u32(afbfile,&xFBs[side],1)!=1){ -complain("Cannot write aFBsize to %s: %m\n",afbname); -} -fclose(afbfile); -} - -/*:27*/ -// #line 890 "gnfs-lasieve4e.w" - -}else{ -/*26:*/ -// #line 959 "gnfs-lasieve4e.w" - -if(read_u32(afbfile,&(FBsize[side]),1)!=1){ -complain("Cannot read aFB size from %s: %m\n",afbname); -} -FB[side]= xmalloc(FBsize[side]*sizeof(u32_t)); -proots[side]= xmalloc(FBsize[side]*sizeof(u32_t)); -if(read_u32(afbfile,FB[side],FBsize[side])!=FBsize[side]|| -read_u32(afbfile,proots[side],FBsize[side])!=FBsize[side]){ -complain("Cannot read aFB from %s: %m\n",afbname); -} -if(read_u32(afbfile,&xFBs[side],1)!=1){ -complain("%s: Cannot read xFBsize\n",afbname); -} -fclose(afbfile); - -/*:26*/ -// #line 892 "gnfs-lasieve4e.w" - -} - - -for(j= 0,k= 0,l= 0;j<FBsize[side];j++){ -if(FB[side][j]<L1_SIZE)k= j; -if(FB[side][j]<n_i)l= j; -if(FB[side][j]> L1_SIZE&&FB[side][j]> n_I)break; -} -if(FBsize[side]> 0){ -if(k<l)k= l; -fbis[side]= l+1; -fbi1[side]= k+1; -}else{ -fbis[side]= 0; -fbi1[side]= 0; -} -} -} - -{ -u32_t i,srfbs,safbs; - -for(i= 0,srfbs= 0;i<xFBs[1];i++){ -if(xFB[1][i].p==xFB[1][i].pp)srfbs++; -} -for(i= 0,safbs= 0;i<xFBs[0];i++){ -if(xFB[0][i].p==xFB[0][i].pp)safbs++; -} -logbook(0,"FBsize %u+%u (deg %u), %u+%u (deg %u)\n", -FBsize[0],safbs,poldeg[0],FBsize[1],srfbs,poldeg[1]); -} -free(afbname); - -/*45:*/ -// #line 1617 "gnfs-lasieve4e.w" - -{ -u32_t i; -size_t si,sj; - -n_srb_i= 2*((n_i+2*CANDIDATE_SEARCH_STEPS-1)/(2*CANDIDATE_SEARCH_STEPS)); -n_srb_j= (n_J+2*CANDIDATE_SEARCH_STEPS-1)/(2*CANDIDATE_SEARCH_STEPS); -sj= n_srb_j*sizeof(*(sieve_report_bounds[0])); -si= n_srb_i*sizeof(**(sieve_report_bounds[0])); -for(i= 0;i<2;i++){ -u32_t j; - -tpoly_f[i]= xmalloc((1+poldeg[i])*sizeof(**tpoly_f)); -sieve_report_bounds[i]= xmalloc(sj); -for(j= 0;j<n_srb_j;j++) -sieve_report_bounds[i][j]= xmalloc(si); -} -} - -/*:45*/ -// #line 926 "gnfs-lasieve4e.w" - -} - -/*:24*/ -// #line 304 "gnfs-lasieve4e.w" - -if(sieve_count==0)exit(0); -/*30:*/ -// #line 1004 "gnfs-lasieve4e.w" - -{ -u32_t side,i; - -for(side= 0;side<2;side++){ -u32_t prime,nr; -struct xFBstruct*s; -u32_t*root_buffer; -size_t xaFB_alloc= 0; -FB_logs[side]= xmalloc(FBsize[side]); -sieve_multiplier[side]= (UCHAR_MAX-50)/log(poly_norm[side]); - -root_buffer= xmalloc(poldeg[side]*sizeof(*root_buffer)); -prime= 2; -nr= root_finder(root_buffer,poly[side],poldeg[side],prime); - -for(i= 0;i<nr;i++){ -adjust_bufsize((void**)&(xFB[side]),&xaFB_alloc,1+xFBs[side], -16,sizeof(**xFB)); -s= xFB[side]+xFBs[side]; -s->p= prime; -s->pp= prime; -if(root_buffer[i]==prime){ -s->qq= prime; -s->q= 1; -s->r= 1; -}else{ -s->qq= 1; -s->q= prime; -s->r= root_buffer[i]; -} -xFBs[side]++; -add_primepowers2xaFB(&xaFB_alloc,n_I,side,0,0); -} -free(root_buffer); -for(i= 0;i<FBsize[side];i++){ -double l; -u32_t l1; - -prime= FB[side][i]; -if(prime> n_I/prime)break; -l= log(prime); -l1= add_primepowers2xaFB(&xaFB_alloc,n_I,side,prime,proots[side][i]); -FB_logs[side][i]= rint(l1*l*sieve_multiplier[side]); -} -while(i<FBsize[side]){ -double l; - -l= log(FB[side][i]); -if(l> FB_maxlog[side])FB_maxlog[side]= l; -FB_logs[side][i++]= rint(sieve_multiplier[side]*l); -} -FB_maxlog[side]*= sieve_multiplier[side]; -qsort(xFB[side],xFBs[side],sizeof(*(xFB[side])),xFBcmp); -} -} - -/*:30*/ -// #line 306 "gnfs-lasieve4e.w" - -/*35:*/ -// #line 1133 "gnfs-lasieve4e.w" - -sieve_interval= xvalloc(L1_SIZE); -cand= xvalloc(L1_SIZE*sizeof(*cand)); -fss_sv= xvalloc(L1_SIZE); -tiny_sieve_buffer= xmalloc(TINY_SIEVEBUFFER_SIZE); -if(n_i> L1_SIZE) -complain("Strip length %u exceeds L1 size %u\n",n_i,L1_SIZE); -j_per_strip= L1_SIZE/n_i; -jps_bits= L1_BITS-i_bits; -jps_mask= j_per_strip-1; -if(j_per_strip!=1<<jps_bits) -Schlendrian("Expected %u j per strip, calculated %u\n", -j_per_strip,1<<jps_bits); -n_strips= n_j>>(L1_BITS-i_bits); -rec_info_init(n_i,n_j); -/*58:*/ -// #line 1796 "gnfs-lasieve4e.w" - -{ -u32_t s; + } + if(sieve_count!=0) { + if(sigma == 0)complain("Please set a skewness\n"); + if(special_q_side == NO_SIDE) { + errprintf("Please use -a or -r\n"); + Usage(); + } + if(FB_bound[special_q_side]> first_spq) { + FB_bound[special_q_side]=(float) first_spq-1; + printf("Warning: lowering FB_bound to %u.\n",first_spq-1); + //complain("Special q lower bound %u below rFB bound %g\n", + //first_spq,FB_bound[special_q_side]); + } + } + fclose(input_data); + if(poldeg[0]<poldeg[1])poldeg_max= poldeg[1]; + else poldeg_max= poldeg[0]; + + + + i_shift= 1<<(I_bits-1); + n_I= 1<<I_bits; + n_i= n_I/2; + i_bits= I_bits-1; + n_J= 1<<J_bits; + n_j= n_J/2; + j_bits= J_bits-1; + { + u32_t i,j; + double x,y,z; + + x= sqrt(first_spq*sigma)*n_I; + y= x/sigma; + for(j= 0;j<2;j++) { + poly_f[j]= xmalloc((poldeg[j]+1)*sizeof(*poly_f[j])); + + for(i= 0,z= 1,poly_norm[j]= 0; + i<=poldeg[j];i++) { + poly_f[j][i]= mpz_get_d(poly[j][i]); + poly_norm[j]= poly_norm[j]*y+fabs(poly_f[j][i])*z; + z*= x; + } + } + } + + } + + siever_init(); + if(sieve_count!=0) { + if(g_ofile_name == NULL) { + if(zip_output == 0) { + asprintf(&g_ofile_name,"%s.lasieve-%u.%u-%u",base_name, + special_q_side,first_spq,last_spq); + } else { + asprintf(&g_ofile_name, + append_output == 0? + "gzip --best --stdout > %s.lasieve-%u.%u-%u.gz": + "gzip --best --stdout >> %s.lasieve-%u.%u-%u.gz", + base_name,special_q_side,first_spq,last_spq); + } + } else { + if(strcmp(g_ofile_name,"-") == 0) { + if(zip_output == 0) { + g_ofile= stdout; + g_ofile_name= "to stdout"; + goto done_opening_output; + } else g_ofile_name= "gzip --best --stdout"; + } else { + if(fnmatch("*.gz",g_ofile_name,0) == 0) { + char*on1; + + zip_output= 1; + on1= strdup(g_ofile_name); + asprintf(&g_ofile_name,"gzip --best --stdout > %s",on1); + free(on1); + } else zip_output= 0; + } + } + if(zip_output == 0) { + if (g_resume != 0) { + goto done_opening_output; + } + if(append_output> 0) { + g_ofile= fopen(g_ofile_name,"a"); + } else { + if ((g_ofile = fopen(g_ofile_name, "r")) != NULL) + complain(" Will not overwrite existing file %s for output; rename it, move it away, or use -R option (resume)\n", g_ofile_name); + g_ofile= fopen(g_ofile_name,"w"); + } + if(g_ofile == NULL)complain("Cannot open %s for output: %m\n",g_ofile_name); + } else { + if ((g_ofile= popen(g_ofile_name,"w")) == NULL) + complain("Cannot exec %s for output: %m\n",g_ofile_name); + } + done_opening_output: + fprintf(g_ofile,""); + } + + { + size_t FBS_alloc= 4096; + u32_t prime; + pr32_struct ps; + char*afbname; + FILE*afbfile; + u32_t side; + + initprime32(&ps); + + for(side= 0;side<2;side++) { + if(poldeg[side] == 1) { + FB[side]= xmalloc(FBS_alloc*sizeof(u32_t)); + proots[side]= xmalloc(FBS_alloc*sizeof(u32_t)); + prime= firstprime32(&ps); + for(prime= nextprime32(&ps),fbi1[side]= 0,FBsize[side]= 0; + prime<FB_bound[side];prime= nextprime32(&ps)) { + u32_t x; + x= mpz_fdiv_ui(poly[side][1],prime); + if(x> 0) { + modulo32= prime; + x= modmul32(modinv32(x),mpz_fdiv_ui(poly[side][0],prime)); + x= x> 0?prime-x:0; + } else x= prime; + if(prime<L1_SIZE)fbi1[side]= FBsize[side]; + if(prime<n_i)fbis[side]= FBsize[side]; + if(FBsize[side] == FBS_alloc) { + FBS_alloc*= 2; + FB[side]= xrealloc(FB[side],FBS_alloc*sizeof(u32_t)); + proots[side]= xrealloc(proots[side],FBS_alloc*sizeof(u32_t)); + } + proots[side][FBsize[side]]= x; + FB[side][FBsize[side]++]= prime; + } + proots[side]= xrealloc(proots[side],FBsize[side]*sizeof(u32_t)); + FB[side]= xrealloc(FB[side],FBsize[side]*sizeof(u32_t)); + fbi1[side]++; + fbis[side]++; + if(fbi1[side]<fbis[side])fbi1[side]= fbis[side]; + } else { + u32_t j,k,l; + asprintf(&afbname,"%s.afb.%u",base_name,side); + if(force_aFBcalc> 0||(afbfile= fopen(afbname,"r")) == NULL) { + u32_t*root_buffer; + size_t aFB_alloc; + + root_buffer= xmalloc(poldeg[side]*sizeof(*root_buffer)); + aFB_alloc= 4096; + FB[side]= xmalloc(aFB_alloc*sizeof(**FB)); + proots[side]= xmalloc(aFB_alloc*sizeof(**proots)); + for(prime= firstprime32(&ps),FBsize[side]= 0; + prime<FB_bound[side];prime= nextprime32(&ps)) { + u32_t i,nr; + + nr= root_finder(root_buffer,poly[side],poldeg[side],prime); + for(i= 0;i<nr;i++) { + if(aFB_alloc<=FBsize[side]) { + aFB_alloc*= 2; + FB[side]= xrealloc(FB[side],aFB_alloc*sizeof(**FB)); + proots[side]= xrealloc(proots[side],aFB_alloc*sizeof(**proots)); + } + FB[side][FBsize[side]]= prime; + proots[side][FBsize[side]]= root_buffer[i]; + if(prime> 2)FBsize[side]++; + } + } + FB[side]= xrealloc(FB[side],FBsize[side]*sizeof(**FB)); + proots[side]= xrealloc(proots[side],FBsize[side]*sizeof(**proots)); + free(root_buffer); + + if(keep_factorbase> 0) { + if((afbfile= fopen(afbname,"w")) == NULL) { + complain("Cannot open %s for output of aFB: %m\n",afbname); + } + if(write_u32(afbfile,&(FBsize[side]),1)!=1) { + complain("Cannot write aFBsize to %s: %m\n",afbname); + } + if(write_u32(afbfile,FB[side],FBsize[side])!=FBsize[side]|| + write_u32(afbfile,proots[side],FBsize[side])!=FBsize[side]) { + complain("Cannot write aFB to %s: %m\n",afbname); + } + if(write_u32(afbfile,&xFBs[side],1)!=1) { + complain("Cannot write aFBsize to %s: %m\n",afbname); + } + fclose(afbfile); + } + + } else { + if(read_u32(afbfile,&(FBsize[side]),1)!=1) { + complain("Cannot read aFB size from %s: %m\n",afbname); + } + FB[side]= xmalloc(FBsize[side]*sizeof(u32_t)); + proots[side]= xmalloc(FBsize[side]*sizeof(u32_t)); + if(read_u32(afbfile,FB[side],FBsize[side])!=FBsize[side]|| + read_u32(afbfile,proots[side],FBsize[side])!=FBsize[side]) { + complain("Cannot read aFB from %s: %m\n",afbname); + } + if(read_u32(afbfile,&xFBs[side],1)!=1) { + complain("%s: Cannot read xFBsize\n",afbname); + } + fclose(afbfile); + + } + + + for(j= 0,k= 0,l= 0;j<FBsize[side];j++) { + if(FB[side][j]<L1_SIZE)k= j; + if(FB[side][j]<n_i)l= j; + if(FB[side][j]> L1_SIZE&&FB[side][j]> n_I)break; + } + if(FBsize[side]> 0) { + if(k<l)k= l; + fbis[side]= l+1; + fbi1[side]= k+1; + } else { + fbis[side]= 0; + fbi1[side]= 0; + } + } + } + + { + u32_t i,srfbs,safbs; + + for(i= 0,srfbs= 0;i<xFBs[1];i++) { + if(xFB[1][i].p == xFB[1][i].pp)srfbs++; + } + for(i= 0,safbs= 0;i<xFBs[0];i++) { + if(xFB[0][i].p == xFB[0][i].pp)safbs++; + } + logbook(0,"FBsize %u+%u (deg %u), %u+%u (deg %u)\n", + FBsize[0],safbs,poldeg[0],FBsize[1],srfbs,poldeg[1]); + } + free(afbname); + + { + u32_t i; + size_t si,sj; + + n_srb_i= 2*((n_i+2*CANDIDATE_SEARCH_STEPS-1)/(2*CANDIDATE_SEARCH_STEPS)); + n_srb_j= (n_J+2*CANDIDATE_SEARCH_STEPS-1)/(2*CANDIDATE_SEARCH_STEPS); + sj= n_srb_j*sizeof(*(sieve_report_bounds[0])); + si= n_srb_i*sizeof(**(sieve_report_bounds[0])); + for(i= 0;i<2;i++) { + u32_t j; + + tpoly_f[i]= xmalloc((1+poldeg[i])*sizeof(**tpoly_f)); + sieve_report_bounds[i]= xmalloc(sj); + for(j= 0;j<n_srb_j;j++) + sieve_report_bounds[i][j]= xmalloc(si); + } + } + + } + + if(sieve_count == 0)exit(0); + { + u32_t side,i; + + for(side= 0;side<2;side++) { + u32_t prime,nr; + struct xFBstruct*s; + u32_t*root_buffer; + size_t xaFB_alloc= 0; + FB_logs[side]= xmalloc(FBsize[side]); + sieve_multiplier[side]= (UCHAR_MAX-50)/log(poly_norm[side]); + + root_buffer= xmalloc(poldeg[side]*sizeof(*root_buffer)); + prime= 2; + nr= root_finder(root_buffer,poly[side],poldeg[side],prime); + + for(i= 0;i<nr;i++) { + adjust_bufsize((void**)&(xFB[side]),&xaFB_alloc,1+xFBs[side], + 16,sizeof(**xFB)); + s= xFB[side]+xFBs[side]; + s->p= prime; + s->pp= prime; + if(root_buffer[i] == prime) { + s->qq= prime; + s->q= 1; + s->r= 1; + } else { + s->qq= 1; + s->q= prime; + s->r= root_buffer[i]; + } + xFBs[side]++; + add_primepowers2xaFB(&xaFB_alloc,n_I,side,0,0); + } + free(root_buffer); + for(i= 0;i<FBsize[side];i++) { + double l; + u32_t l1; + + prime= FB[side][i]; + if(prime> n_I/prime)break; + l= log(prime); + l1= add_primepowers2xaFB(&xaFB_alloc,n_I,side,prime,proots[side][i]); + FB_logs[side][i]= rint(l1*l*sieve_multiplier[side]); + } + while(i<FBsize[side]) { + double l; + + l= log(FB[side][i]); + if(l> FB_maxlog[side])FB_maxlog[side]= l; + FB_logs[side][i++]= rint(sieve_multiplier[side]*l); + } + FB_maxlog[side]*= sieve_multiplier[side]; + qsort(xFB[side],xFBs[side],sizeof(*(xFB[side])),xFBcmp); + } + } + + sieve_interval= xvalloc(L1_SIZE); + cand= xvalloc(L1_SIZE*sizeof(*cand)); + fss_sv= xvalloc(L1_SIZE); + tiny_sieve_buffer= xmalloc(TINY_SIEVEBUFFER_SIZE); + if(n_i> L1_SIZE) + complain("Strip length %u exceeds L1 size %u\n",n_i,L1_SIZE); + j_per_strip= L1_SIZE/n_i; + jps_bits= L1_BITS-i_bits; + jps_mask= j_per_strip-1; + if(j_per_strip!=1<<jps_bits) + Schlendrian("Expected %u j per strip, calculated %u\n", + j_per_strip,1<<jps_bits); + n_strips= n_j>>(L1_BITS-i_bits); + rec_info_init(n_i,n_j); + { + u32_t s; #define MAX_TINY_2POW 4 - -if(poldeg[0]<poldeg[1])s= poldeg[1]; -else s= poldeg[0]; -tinysieve_curpos= xmalloc(TINY_SIEVE_MIN*s*sizeof(*tinysieve_curpos)); -horizontal_sievesums= xmalloc(j_per_strip*sizeof(*horizontal_sievesums)); -for(s= 0;s<2;s++){ -u32_t fbi; -size_t maxent; - -smallsieve_aux[s]= xmalloc(4*fbis[s]*sizeof(*(smallsieve_aux[s]))); + + if(poldeg[0]<poldeg[1])s= poldeg[1]; + else s= poldeg[0]; + tinysieve_curpos= xmalloc(TINY_SIEVE_MIN*s*sizeof(*tinysieve_curpos)); + horizontal_sievesums= xmalloc(j_per_strip*sizeof(*horizontal_sievesums)); + for(s= 0;s<2;s++) { + u32_t fbi; + size_t maxent; + + smallsieve_aux[s]= xmalloc(4*fbis[s]*sizeof(*(smallsieve_aux[s]))); #ifndef MMX_TD #ifdef PREINVERT -smalltd_pi[s]= xmalloc(fbis[s]*sizeof(*(smalltd_pi[s]))); + smalltd_pi[s]= xmalloc(fbis[s]*sizeof(*(smalltd_pi[s]))); #endif -smalltdsieve_aux[s]= xmalloc(j_per_strip*sizeof(*(smalltdsieve_aux[s]))); -for(fbi= 0;fbi<j_per_strip;fbi++) -smalltdsieve_aux[s][fbi]= -xmalloc(fbis[s]*sizeof(**(smalltdsieve_aux[s]))); + smalltdsieve_aux[s]= xmalloc(j_per_strip*sizeof(*(smalltdsieve_aux[s]))); + for(fbi= 0;fbi<j_per_strip;fbi++) + smalltdsieve_aux[s][fbi]= + xmalloc(fbis[s]*sizeof(**(smalltdsieve_aux[s]))); #else - -MMX_TdAllocate(j_per_strip,fbis[0],fbis[1]); + + MMX_TdAllocate(j_per_strip,fbis[0],fbis[1]); #endif -smallsieve_aux1[s]= xmalloc(6*xFBs[s]*sizeof(*(smallsieve_aux1[s]))); - - -maxent= fbis[s]; -maxent+= xFBs[s]; -smallpsieve_aux[s]= xmalloc(3*maxent*sizeof(*(smallpsieve_aux[s]))); -maxent= 0; -for(fbi= 0;fbi<xFBs[s];fbi++){ -if(xFB[s][fbi].p==2) -maxent++; -} -smallsieve_aux2[s]= xmalloc(4*maxent*sizeof(*(smallsieve_aux2[s]))); -x2FB[s]= xmalloc(maxent*6*sizeof(*(x2FB[s]))); -} -} - -/*:58*//*59:*/ -// #line 1839 "gnfs-lasieve4e.w" - + smallsieve_aux1[s]= xmalloc(6*xFBs[s]*sizeof(*(smallsieve_aux1[s]))); + + + maxent= fbis[s]; + maxent+= xFBs[s]; + smallpsieve_aux[s]= xmalloc(3*maxent*sizeof(*(smallpsieve_aux[s]))); + maxent= 0; + for(fbi= 0;fbi<xFBs[s];fbi++) { + if(xFB[s][fbi].p == 2) + maxent++; + } + smallsieve_aux2[s]= xmalloc(4*maxent*sizeof(*(smallsieve_aux2[s]))); + x2FB[s]= xmalloc(maxent*6*sizeof(*(x2FB[s]))); + } + } + #ifdef GCD_SIEVE_BOUND -{ -u32_t p,i; - -firstprime32(&special_q_ps); -np_gcd_sieve= 0; -for(p= nextprime32(&special_q_ps);p<GCD_SIEVE_BOUND; -p= nextprime32(&special_q_ps))np_gcd_sieve++; -gcd_sieve_buffer= xmalloc(2*np_gcd_sieve*sizeof(*gcd_sieve_buffer)); - -firstprime32(&special_q_ps); -i= 0; -for(p= nextprime32(&special_q_ps);p<GCD_SIEVE_BOUND; -p= nextprime32(&special_q_ps))gcd_sieve_buffer[2*i++]= p; -} + { + u32_t p,i; + + firstprime32(&special_q_ps); + np_gcd_sieve= 0; + for(p= nextprime32(&special_q_ps);p<GCD_SIEVE_BOUND; + p= nextprime32(&special_q_ps))np_gcd_sieve++; + gcd_sieve_buffer= xmalloc(2*np_gcd_sieve*sizeof(*gcd_sieve_buffer)); + + firstprime32(&special_q_ps); + i= 0; + for(p= nextprime32(&special_q_ps);p<GCD_SIEVE_BOUND; + p= nextprime32(&special_q_ps))gcd_sieve_buffer[2*i++]= p; + } #endif - -/*:59*/ -// #line 1148 "gnfs-lasieve4e.w" - -{ -u32_t s; -for(s= 0;s<2;s++){ -if(sieve_min[s]<TINY_SIEVE_MIN&&sieve_min[s]!=0){ -errprintf("Sieving with all primes on side %u since\n",s); -errprintf("tiny sieve procedure is being used\n"); -sieve_min[s]= 0; -} -current_ij[s]= xmalloc(FBsize[s]*sizeof(*current_ij[s])); -LPri[s]= xmalloc(FBsize[s]*sizeof(**LPri)*RI_SIZE); -} -} - -/*:35*//*36:*/ -// #line 1175 "gnfs-lasieve4e.w" - -{ -u32_t s; -size_t total_alloc; -u16_t*sched_buf; -double pvl_max[2]; - -total_alloc= 0; -for(s= 0;s<2;s++){ -u32_t i,fbi_lb; - -if(sigma>=1)pvl_max[s]= poldeg[s]*log(last_spq*sqrt(sigma)); -else pvl_max[s]= poldeg[s]*log(last_spq/sqrt(sigma)); -pvl_max[s]+= log(poly_norm[s]); -if(fbi1[s]>=FBsize[s]||i_bits+j_bits<=L1_BITS){ -n_schedules[s]= 0; -continue; -} -for(i= 0;i<N_PRIMEBOUNDS;i++) -if(FB_bound[s]<=schedule_primebounds[i]|| -i_bits+j_bits<=schedule_sizebits[i]) -break; -n_schedules[s]= i+1; -schedules[s]= xmalloc(n_schedules[s]*sizeof(**schedules)); -fbi_lb= fbi1[s]; -for(i= 0;i<n_schedules[s];i++){ -u32_t fbp_lb,fbp_ub; -u32_t fbi,fbi_ub; -u32_t sp_i; -u32_t n,sl_i; -u32_t ns; -size_t allocate,all1; - -if(i==n_schedules[s]-1)fbp_ub= FB_bound[s]; -else fbp_ub= schedule_primebounds[i]; -if(i==0)fbp_lb= FB[s][fbi1[s]]; -else fbp_lb= schedule_primebounds[i-1]; - -if(i_bits+j_bits<schedule_sizebits[i])ns= 1<<(i_bits+j_bits-L1_BITS); -else ns= 1<<(schedule_sizebits[i]-L1_BITS); -schedules[s][i].n_strips= ns; - - - + + { + u32_t s; + for(s= 0;s<2;s++) { + if(sieve_min[s]<TINY_SIEVE_MIN&&sieve_min[s]!=0) { + errprintf("Sieving with all primes on side %u since\n",s); + errprintf("tiny sieve procedure is being used\n"); + sieve_min[s]= 0; + } + current_ij[s]= xmalloc(FBsize[s]*sizeof(*current_ij[s])); + LPri[s]= xmalloc(FBsize[s]*sizeof(**LPri)*RI_SIZE); + } + } + + { + u32_t s; + size_t total_alloc; + u16_t*sched_buf; + double pvl_max[2]; + + total_alloc= 0; + for(s= 0;s<2;s++) { + u32_t i,fbi_lb; + + if(sigma>=1)pvl_max[s]= poldeg[s]*log(last_spq*sqrt(sigma)); + else pvl_max[s]= poldeg[s]*log(last_spq/sqrt(sigma)); + pvl_max[s]+= log(poly_norm[s]); + if(fbi1[s]>=FBsize[s]||i_bits+j_bits<=L1_BITS) { + n_schedules[s]= 0; + continue; + } + for(i= 0;i<N_PRIMEBOUNDS;i++) + if(FB_bound[s]<=schedule_primebounds[i]|| + i_bits+j_bits<=schedule_sizebits[i]) + break; + n_schedules[s]= i+1; + schedules[s]= xmalloc(n_schedules[s]*sizeof(**schedules)); + fbi_lb= fbi1[s]; + for(i= 0;i<n_schedules[s];i++) { + u32_t fbp_lb,fbp_ub; + u32_t fbi,fbi_ub; + u32_t sp_i; + u32_t n,sl_i; + u32_t ns; + size_t allocate,all1; + + if(i == n_schedules[s]-1)fbp_ub= FB_bound[s]; + else fbp_ub= schedule_primebounds[i]; + if(i == 0)fbp_lb= FB[s][fbi1[s]]; + else fbp_lb= schedule_primebounds[i-1]; + + if(i_bits+j_bits<schedule_sizebits[i])ns= 1<<(i_bits+j_bits-L1_BITS); + else ns= 1<<(schedule_sizebits[i]-L1_BITS); + schedules[s][i].n_strips= ns; + + + #ifndef SCHED_TOL #ifndef NO_SCHEDTOL +/* these values are experimental; report SCHED_PATHOLOGY to http://mersenneforum.org/showthread.php?t=11430 */ +#define SCHED_PAD 48 +#if I_bits<15 #define SCHED_TOL 2 +#else +#define SCHED_TOL 1.2 #endif #endif +#endif #ifdef SCHED_TOL -allocate= rint(SCHED_TOL*n_i*j_per_strip*log(log(fbp_ub)/log(fbp_lb))); + allocate = rint(SCHED_PAD + SCHED_TOL * n_i * j_per_strip * log(log(fbp_ub) / log(fbp_lb))); #else -allocate= rint(sched_tol[i]*n_i*j_per_strip*log(log(fbp_ub)/log(fbp_lb))); + allocate = rint(sched_tol[i]*n_i*j_per_strip*log(log(fbp_ub)/log(fbp_lb))); #endif -allocate*= SE_SIZE; - - - -all1= allocate+n_i*ceil(pvl_max[s]/log(fbp_lb))*SE_SIZE; -schedules[s][i].alloc= allocate; -schedules[s][i].alloc1= all1; - -for(n= 0,fbi= fbi_lb;fbi<FBsize[s];){ -u32_t fbi_ub1; -fbi_ub1= fbi+SCHEDFBI_MAXSTEP; -if(fbi_ub1>=FBsize[s])fbi_ub1= FBsize[s]; -else{ -if(FB[s][fbi_ub1]> fbp_ub){ -while(FB[s][fbi_ub1]> fbp_ub) -fbi_ub1--; -fbi_ub1++; -} -} -if(FB_logs[s][fbi]==FB_logs[s][fbi_ub1-1]){ -n++; -fbi= fbi_ub1; -}else{ -u32_t l; -n+= FB_logs[s][fbi_ub1-1]-FB_logs[s][fbi]; -fbi= fbi_ub1-1; -l= FB_logs[s][fbi]; -while(FB_logs[s][fbi]==l)fbi--; -fbi++; -} -if(fbi>=FBsize[s]||FB[s][fbi]> fbp_ub)break; -} -fbi_ub= fbi; -schedules[s][i].n_pieces= n; -n++; -schedules[s][i].schedule= xmalloc(n*sizeof(*(schedules[s][i].schedule))); -for(sl_i= 0;sl_i<n;sl_i++) -schedules[s][i].schedule[sl_i]= -xmalloc(ns*sizeof(**(schedules[s][i].schedule))); -schedules[s][i].schedule[0][0]= (u16_t*)total_alloc; -total_alloc+= all1; -for(sp_i= 1;sp_i<ns;sp_i++){ -schedules[s][i].schedule[0][sp_i]= (u16_t*)total_alloc; -total_alloc+= allocate; -} -schedules[s][i].fbi_bounds= -xmalloc(n*sizeof(*(schedules[s][i].fbi_bounds))); -schedules[s][i].schedlogs= xmalloc(n); -for(n= 0,fbi= fbi_lb;fbi<fbi_ub;){ -u32_t fbi_ub1; -fbi_ub1= fbi+SCHEDFBI_MAXSTEP; -if(fbi_ub1> fbi_ub)fbi_ub1= fbi_ub; -if(FB_logs[s][fbi]==FB_logs[s][fbi_ub1-1]){ -schedules[s][i].fbi_bounds[n++]= fbi; -fbi= fbi_ub1; -}else{ -u32_t l,lmax; - -lmax= FB_logs[s][fbi_ub1-1]; -for(l= FB_logs[s][fbi];l<lmax;l++){ -schedules[s][i].fbi_bounds[n++]= fbi; -while(fbi<fbi_ub&&FB_logs[s][fbi]==l)fbi++; -} -} -} -if(n!=schedules[s][i].n_pieces) -Schlendrian("Expected %u schedule pieces on side %u, have %u\n", -schedules[s][i].n_pieces,s,n); -schedules[s][i].fbi_bounds[n++]= fbi; -for(n= 0;n<schedules[s][i].n_pieces;n++) -schedules[s][i].schedlogs[n]= FB_logs[s][schedules[s][i].fbi_bounds[n]]; -schedules[s][i].ri= -LPri[s]+(schedules[s][i].fbi_bounds[0]-fbis[s])*RI_SIZE; -fbi_lb= fbi_ub; -} -} -/*37:*/ -// #line 1323 "gnfs-lasieve4e.w" - -sched_buf= xmalloc((total_alloc+65536*SE_SIZE*j_per_strip)* -sizeof(**((**schedules).schedule))); -for(s= 0;s<2;s++){ -u32_t i; -for(i= 0;i<n_schedules[s];i++){ -u32_t sp_i; - -for(sp_i= 0;sp_i<schedules[s][i].n_strips;sp_i++) -schedules[s][i].schedule[0][sp_i]= -sched_buf+(size_t)(schedules[s][i].schedule[0][sp_i]); -} -} - -/*:37*/ -// #line 1305 "gnfs-lasieve4e.w" - -/*39:*/ -// #line 1349 "gnfs-lasieve4e.w" - + allocate*= SE_SIZE; + + all1= allocate+n_i*ceil(pvl_max[s]/log(fbp_lb))*SE_SIZE; + schedules[s][i].alloc= allocate; + schedules[s][i].alloc1= all1; + //printf("### [%d][%d] alloc = %ld %ld %ld %ld\n",s,i,allocate,all1,n_i,j_per_strip); + + for(n= 0,fbi= fbi_lb;fbi<FBsize[s];) { + u32_t fbi_ub1; + fbi_ub1= fbi+SCHEDFBI_MAXSTEP; + if(fbi_ub1>=FBsize[s])fbi_ub1= FBsize[s]; + else{ + if(FB[s][fbi_ub1]> fbp_ub) { + while(FB[s][fbi_ub1]> fbp_ub) + fbi_ub1--; + fbi_ub1++; + } + } + if(FB_logs[s][fbi] == FB_logs[s][fbi_ub1-1]) { + n++; + fbi= fbi_ub1; + } else { + u32_t l; + n+= FB_logs[s][fbi_ub1-1]-FB_logs[s][fbi]; + fbi= fbi_ub1-1; + l= FB_logs[s][fbi]; + while(FB_logs[s][fbi] == l)fbi--; + fbi++; + } + if(fbi>=FBsize[s]||FB[s][fbi]> fbp_ub)break; + } + fbi_ub= fbi; + schedules[s][i].n_pieces= n; + n++; + schedules[s][i].schedule... [truncated message content] |
From: <Ba...@us...> - 2009-04-19 18:47:54
|
Revision: 354 http://ggnfs.svn.sourceforge.net/ggnfs/?rev=354&view=rev Author: Batalov Date: 2009-04-19 18:47:45 +0000 (Sun, 19 Apr 2009) Log Message: ----------- Two bug fixes Modified Paths: -------------- trunk/src/experimental/lasieve4_64/athlon64/siever-config.h trunk/src/experimental/lasieve4_64/gnfs-lasieve4e.c Modified: trunk/src/experimental/lasieve4_64/athlon64/siever-config.h =================================================================== --- trunk/src/experimental/lasieve4_64/athlon64/siever-config.h 2009-04-18 03:58:53 UTC (rev 353) +++ trunk/src/experimental/lasieve4_64/athlon64/siever-config.h 2009-04-19 18:47:45 UTC (rev 354) @@ -27,6 +27,7 @@ #if 1 void MMX_TdAllocate(int,size_t,size_t); u16_t*MMX_TdInit(int,u16_t*,u16_t*,u32_t*,int); +u32_t*MMX_Td(u32_t *pbuf,int side,u16_t strip_i); void MMX_TdUpdate(int,int); #define MMX_TD #define MMX_REGW 8 Modified: trunk/src/experimental/lasieve4_64/gnfs-lasieve4e.c =================================================================== --- trunk/src/experimental/lasieve4_64/gnfs-lasieve4e.c 2009-04-18 03:58:53 UTC (rev 353) +++ trunk/src/experimental/lasieve4_64/gnfs-lasieve4e.c 2009-04-19 18:47:45 UTC (rev 354) @@ -593,7 +593,7 @@ } #endif //skip_blanks_comments(&input_line,&input_line_alloc,input_data); - close(input_data); + fclose(input_data); { FILE *fp; char token[256], value[512], thisLine[1024]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ba...@us...> - 2009-10-30 02:07:57
|
Revision: 370 http://ggnfs.svn.sourceforge.net/ggnfs/?rev=370&view=rev Author: Batalov Date: 2009-10-30 02:07:48 +0000 (Fri, 30 Oct 2009) Log Message: ----------- mpqs will not fail on a prime square Modified Paths: -------------- trunk/src/experimental/lasieve4_64/athlon64/siever-config.h trunk/src/experimental/lasieve4_64/gnfs-lasieve4e.c Modified: trunk/src/experimental/lasieve4_64/athlon64/siever-config.h =================================================================== --- trunk/src/experimental/lasieve4_64/athlon64/siever-config.h 2009-10-29 05:23:37 UTC (rev 369) +++ trunk/src/experimental/lasieve4_64/athlon64/siever-config.h 2009-10-30 02:07:48 UTC (rev 370) @@ -20,7 +20,7 @@ void asm_getbc(u32_t,u32_t,u32_t,u32_t*,u32_t*,u32_t*,u32_t*); #define ASM_SCHEDSIEVE #define ASM_SCHEDTDSIEVE2 -u16_t**tdsieve_sched2buf(u16_t*,u16_t*,unsigned char*,u16_t**,u16_t**); +u16_t**tdsieve_sched2buf(u16_t**,u16_t*,unsigned char*,u16_t**,u16_t**); #define ASM_MPZ_TD #define PREINVERT Modified: trunk/src/experimental/lasieve4_64/gnfs-lasieve4e.c =================================================================== --- trunk/src/experimental/lasieve4_64/gnfs-lasieve4e.c 2009-10-29 05:23:37 UTC (rev 369) +++ trunk/src/experimental/lasieve4_64/gnfs-lasieve4e.c 2009-10-30 02:07:48 UTC (rev 370) @@ -2708,12 +2708,12 @@ tNow = sTime(); if (tNow > lastReport + 5.0) { lastReport = tNow; - fprintf(stderr, "\rtotal yield: %u, q=%u (%1.5lf sec/rel)", + fprintf(stderr, "\rtotal yield: %u, q=%u (%1.5lf sec/rel) ", (unsigned int)yield, (unsigned int)special_q, (tNow - tStart)/yield); fflush(stderr); } } - fprintf(stderr, "\rtotal yield: %u, q=%u (%1.5lf sec/rel)\n", + fprintf(stderr, "\rtotal yield: %u, q=%u (%1.5lf sec/rel) \n", (unsigned int)yield, (unsigned int)special_q, (sTime() - tStart)/yield); free(r); } @@ -3942,6 +3942,19 @@ mpz_neg(large_factors[s1],large_factors[s1]); if((nf= mpqs_factor(large_factors[s1],max_primebits[s1],&mf))<0) { + /* did it fail on a square? */ + mpz_sqrtrem(large_primes[s1][0],large_primes[s1][1],large_factors[s1]); + if(mpz_sgn(large_primes[s1][1]) == 0) { /* remainder == 0? */ + mpz_set(large_primes[s1][1],large_primes[s1][0]); + nlp[s1]= 2; + if(verbose) { + fprintf(stderr," mpqs on a prime square "); + mpz_out_str(stderr,10,large_primes[s1][0]); + fprintf(stderr,"^2 "); + } + continue; + } + if(verbose) { fprintf(stderr,"mpqs failed for "); mpz_out_str(stderr,10,large_factors[s1]); fprintf(stderr,"(a,b): "); @@ -3949,6 +3962,7 @@ fprintf(stderr," "); mpz_out_str(stderr,10,sr_b); fprintf(stderr,"\n"); + } n_mpqsfail[s1]++; break; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ba...@us...> - 2009-11-04 03:57:57
|
Revision: 376 http://ggnfs.svn.sourceforge.net/ggnfs/?rev=376&view=rev Author: Batalov Date: 2009-11-04 03:57:36 +0000 (Wed, 04 Nov 2009) Log Message: ----------- faster sieving (up to 20%) Modified Paths: -------------- trunk/src/experimental/lasieve4_64/athlon64/ls-defs.asm trunk/src/experimental/lasieve4_64/athlon64/siever-config.h trunk/src/experimental/lasieve4_64/gnfs-lasieve4e.c trunk/src/experimental/lasieve4_64/mpqs.c Modified: trunk/src/experimental/lasieve4_64/athlon64/ls-defs.asm =================================================================== --- trunk/src/experimental/lasieve4_64/athlon64/ls-defs.asm 2009-11-01 21:30:54 UTC (rev 375) +++ trunk/src/experimental/lasieve4_64/athlon64/ls-defs.asm 2009-11-04 03:57:36 UTC (rev 376) @@ -1,4 +1,4 @@ -define(l1_bits,15)dnl +define(l1_bits,16)dnl define(n_i,eval(2**n_i_bits))dnl define(n_i_mask,eval(n_i-1))dnl define(l1_size,eval(2**l1_bits))dnl Modified: trunk/src/experimental/lasieve4_64/athlon64/siever-config.h =================================================================== --- trunk/src/experimental/lasieve4_64/athlon64/siever-config.h 2009-11-01 21:30:54 UTC (rev 375) +++ trunk/src/experimental/lasieve4_64/athlon64/siever-config.h 2009-11-04 03:57:36 UTC (rev 376) @@ -5,7 +5,7 @@ #define __SIEVER_CONFIG_H__ #include <stddef.h> #include <limits.h> -#define L1_BITS 15 +#define L1_BITS 16 #define ULONG_RI typedef unsigned u32_t; typedef int i32_t; Modified: trunk/src/experimental/lasieve4_64/gnfs-lasieve4e.c =================================================================== --- trunk/src/experimental/lasieve4_64/gnfs-lasieve4e.c 2009-11-01 21:30:54 UTC (rev 375) +++ trunk/src/experimental/lasieve4_64/gnfs-lasieve4e.c 2009-11-04 03:57:36 UTC (rev 376) @@ -147,7 +147,7 @@ u32_t fbis[2]; -#if I_bits<16 +#if I_bits<17 static u32_t j_per_strip,jps_bits; #else #define j_per_strip 1 @@ -1002,7 +1002,7 @@ tiny_sieve_buffer= xmalloc(TINY_SIEVEBUFFER_SIZE); if(n_i> L1_SIZE) complain("Strip length %u exceeds L1 size %u\n",n_i,L1_SIZE); -#if I_bits<16 +#if I_bits<17 j_per_strip= L1_SIZE/n_i; jps_bits= L1_BITS-i_bits; #endif @@ -2285,7 +2285,7 @@ p= x[0]; l= x[1]; d= x[2]; -#if I_bits<16 +#if I_bits<17 while(d<j_per_strip) { horizontal_sievesums[d]+= l; d+= p; Modified: trunk/src/experimental/lasieve4_64/mpqs.c =================================================================== --- trunk/src/experimental/lasieve4_64/mpqs.c 2009-11-01 21:30:54 UTC (rev 375) +++ trunk/src/experimental/lasieve4_64/mpqs.c 2009-11-04 03:57:36 UTC (rev 376) @@ -1227,10 +1227,13 @@ i1=sv[s1]; i2=sv[s2]; sv+=p; if (i1||i2) { if (i1) { nr=rels[i1][4]; rels[i1][nr+5]=mpqs_nFBk_1+i; rels[i1][4]++; } - if (i2) { nr=rels[i2][4]; rels[i2][nr+5]=mpqs_nFBk_1+i; rels[i2][4]++; } } + if (i2) { nr=rels[i2][4]; rels[i2][nr+5]=mpqs_nFBk_1+i; rels[i2][4]++; } + } i1=sv[s1]; i2=sv[s2]; sv+=p; if (i1||i2) { - if (i1) { nr=rels[i1][4]; rels[i1][nr+5]=mpqs_nFBk_1+i; rels[i1][4]++; } if (i2) { nr=rels[i2][4]; rels[i2][nr+5]=mpqs_nFBk_1+i; rels[i2][4]++; } } + if (i1) { nr=rels[i1][4]; rels[i1][nr+5]=mpqs_nFBk_1+i; rels[i1][4]++; } + if (i2) { nr=rels[i2][4]; rels[i2][nr+5]=mpqs_nFBk_1+i; rels[i2][4]++; } + } } svend+=p; while (sv<svend) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ba...@us...> - 2009-11-06 23:57:21
|
Revision: 382 http://ggnfs.svn.sourceforge.net/ggnfs/?rev=382&view=rev Author: Batalov Date: 2009-11-06 23:57:07 +0000 (Fri, 06 Nov 2009) Log Message: ----------- better L1_BITS definition Modified Paths: -------------- trunk/src/experimental/lasieve4_64/INSTALL trunk/src/experimental/lasieve4_64/gnfs-lasieve4e.c Modified: trunk/src/experimental/lasieve4_64/INSTALL =================================================================== --- trunk/src/experimental/lasieve4_64/INSTALL 2009-11-06 23:52:37 UTC (rev 381) +++ trunk/src/experimental/lasieve4_64/INSTALL 2009-11-06 23:57:07 UTC (rev 382) @@ -2,6 +2,12 @@ follow these steps to build the binaries on a 64-bit machine. These should build and run on Athlon64, or Core2 cpus. +****************************** +NOTE: on Core2 replace in athlon64/ls-defs.asm +- define(l1_bits,16)dnl ++ define(l1_bits,15)dnl +****************************** (don't know how to automate this) + Prerequisites: gmp.h libgmp cd athlon64 Modified: trunk/src/experimental/lasieve4_64/gnfs-lasieve4e.c =================================================================== --- trunk/src/experimental/lasieve4_64/gnfs-lasieve4e.c 2009-11-06 23:52:37 UTC (rev 381) +++ trunk/src/experimental/lasieve4_64/gnfs-lasieve4e.c 2009-11-06 23:57:07 UTC (rev 382) @@ -147,7 +147,7 @@ u32_t fbis[2]; -#if I_bits<17 +#if I_bits<=L1_BITS static u32_t j_per_strip,jps_bits; #else #define j_per_strip 1 @@ -1002,7 +1002,7 @@ tiny_sieve_buffer= xmalloc(TINY_SIEVEBUFFER_SIZE); if(n_i> L1_SIZE) complain("Strip length %u exceeds L1 size %u\n",n_i,L1_SIZE); -#if I_bits<17 +#if I_bits<=L1_BITS j_per_strip= L1_SIZE/n_i; jps_bits= L1_BITS-i_bits; #endif @@ -2285,7 +2285,7 @@ p= x[0]; l= x[1]; d= x[2]; -#if I_bits<17 +#if I_bits<=L1_BITS while(d<j_per_strip) { horizontal_sievesums[d]+= l; d+= p; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ba...@us...> - 2009-12-21 08:44:14
|
Revision: 383 http://ggnfs.svn.sourceforge.net/ggnfs/?rev=383&view=rev Author: Batalov Date: 2009-12-21 08:44:06 +0000 (Mon, 21 Dec 2009) Log Message: ----------- define L1_BITS 15; for k8+ CPUs read INSTALL Modified Paths: -------------- trunk/src/experimental/lasieve4_64/INSTALL trunk/src/experimental/lasieve4_64/athlon64/ls-defs.asm trunk/src/experimental/lasieve4_64/athlon64/siever-config.h Modified: trunk/src/experimental/lasieve4_64/INSTALL =================================================================== --- trunk/src/experimental/lasieve4_64/INSTALL 2009-11-06 23:57:07 UTC (rev 382) +++ trunk/src/experimental/lasieve4_64/INSTALL 2009-12-21 08:44:06 UTC (rev 383) @@ -3,11 +3,20 @@ These should build and run on Athlon64, or Core2 cpus. ****************************** -NOTE: on Core2 replace in athlon64/ls-defs.asm -- define(l1_bits,16)dnl -+ define(l1_bits,15)dnl -****************************** (don't know how to automate this) +NOTE for Phenom/K8 users: replace in athlon64/ls-defs.asm + define(l1_bits,15)dnl +=> + define(l1_bits,16)dnl +and in athlon64/siever-config.h +#define L1_BITS 15 +=> +#define L1_BITS 16 + +This may add 5-10% speed to your sieving speed. +But try it both ways and decide for yourself. Caveat emptor! +****************************** + Prerequisites: gmp.h libgmp cd athlon64 Modified: trunk/src/experimental/lasieve4_64/athlon64/ls-defs.asm =================================================================== --- trunk/src/experimental/lasieve4_64/athlon64/ls-defs.asm 2009-11-06 23:57:07 UTC (rev 382) +++ trunk/src/experimental/lasieve4_64/athlon64/ls-defs.asm 2009-12-21 08:44:06 UTC (rev 383) @@ -1,4 +1,4 @@ -define(l1_bits,16)dnl +define(l1_bits,15)dnl define(n_i,eval(2**n_i_bits))dnl define(n_i_mask,eval(n_i-1))dnl define(l1_size,eval(2**l1_bits))dnl Modified: trunk/src/experimental/lasieve4_64/athlon64/siever-config.h =================================================================== --- trunk/src/experimental/lasieve4_64/athlon64/siever-config.h 2009-11-06 23:57:07 UTC (rev 382) +++ trunk/src/experimental/lasieve4_64/athlon64/siever-config.h 2009-12-21 08:44:06 UTC (rev 383) @@ -6,15 +6,12 @@ #include <stddef.h> #include <limits.h> -#if defined(__amdfam10__) || defined(__k8__) || defined(__athlon__) -#define L1_BITS 16 -#else #define L1_BITS 15 +/* ===if you change L1_BITS here, change l1_bits define in ls-defs.asm ===*/ /* L1_BITS 15 for Intel Core2 (32Kb L1 data cache), AMD K6 */ /* L1_BITS 16 for Phenom/Opteron... AMD K7 and up */ /* L1_BITS 14 was here before. PentiumIII had 16Kb */ /* L1_BITS 13 for Pentium4 ? (only 8Kb L1 Dcache) */ -#endif #define ULONG_RI typedef unsigned u32_t; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ba...@us...> - 2012-02-12 22:23:50
|
Revision: 425 http://ggnfs.svn.sourceforge.net/ggnfs/?rev=425&view=rev Author: Batalov Date: 2012-02-12 22:23:43 +0000 (Sun, 12 Feb 2012) Log Message: ----------- minor Modified Paths: -------------- trunk/src/experimental/lasieve4_64/gmp-aux.h trunk/src/experimental/lasieve4_64/gnfs-lasieve4e.c Modified: trunk/src/experimental/lasieve4_64/gmp-aux.h =================================================================== --- trunk/src/experimental/lasieve4_64/gmp-aux.h 2011-12-20 09:14:29 UTC (rev 424) +++ trunk/src/experimental/lasieve4_64/gmp-aux.h 2012-02-12 22:23:43 UTC (rev 425) @@ -3,7 +3,7 @@ void adjust_mpz_bufsize(mpz_t**x,size_t*alloc_ptr,size_t size,size_t increment); int string2mpz(mpz_t rop,char*x,int base); -#if __GNU_MP_VERSION < 3 || __GNU_MP_VERSION_MINOR == 0 +#if __GNU_MP_VERSION < 3 || GNU_MP_VERSION == 3 && GNU_MP_VERSION_MINOR == 0 #define NEED_MPZ_MUL_SI void mpz_mul_si(mpz_t x,mpz_t y,long int z); #endif Modified: trunk/src/experimental/lasieve4_64/gnfs-lasieve4e.c =================================================================== --- trunk/src/experimental/lasieve4_64/gnfs-lasieve4e.c 2011-12-20 09:14:29 UTC (rev 424) +++ trunk/src/experimental/lasieve4_64/gnfs-lasieve4e.c 2012-02-12 22:23:43 UTC (rev 425) @@ -3992,11 +3992,13 @@ if(mpz_sgn(large_primes[s1][1]) == 0) { /* remainder == 0? */ mpz_set(large_primes[s1][1],large_primes[s1][0]); nlp[s1]= 2; +#if 0 /* this is now tested well enough, no need for a message */ if(verbose > 1) { fprintf(stderr," mpqs on a prime square "); mpz_out_str(stderr,10,large_primes[s1][0]); fprintf(stderr,"^2 "); } +#endif continue; } if(verbose > 1) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |