[Ecm-commits] r2583 - trunk

cvs commits ecm-commits at lists.gforge.inria.fr
Fri Feb 6 10:27:44 CET 2015


Author: zimmerma
Date: 2015-02-06 10:27:44 +0100 (Fri, 06 Feb 2015)
New Revision: 2583

Modified:
   trunk/ecm.c
   trunk/main.c
   trunk/test.ecm
Log:
added tests for bsaves/bloads


Modified: trunk/ecm.c
===================================================================
--- trunk/ecm.c	2015-02-06 08:35:03 UTC (rev 2582)
+++ trunk/ecm.c	2015-02-06 09:27:44 UTC (rev 2583)
@@ -1115,7 +1115,7 @@
     }
 #endif
  
-  /* If the parametrization is not given, choose it.*/
+  /* If the parametrization is not given, choose it. */
   if (*param == ECM_PARAM_DEFAULT)
       *param = get_default_param (sigma_is_A, sigma, B1, *B1done);
 
@@ -1168,6 +1168,13 @@
       return ECM_ERROR;
     }
 
+  /* loading stage 1 exponent makes sense only in batch mode */
+  if (!IS_BATCH_MODE(*param) && mpz_cmp_ui (batch_s, 1) > 0)
+    {
+      fprintf (stderr, "Error, -bsaves/-bloads makes sense in batch mode only\n");
+      exit (EXIT_FAILURE);
+    }
+
   /* Compute s for the batch mode */
   if (IS_BATCH_MODE(*param) && ECM_IS_DEFAULT_B1_DONE(*B1done) &&
       (B1 != *batch_last_B1_used || mpz_cmp_ui (batch_s, 1) <= 0))

Modified: trunk/main.c
===================================================================
--- trunk/main.c	2015-02-06 08:35:03 UTC (rev 2582)
+++ trunk/main.c	2015-02-06 09:27:44 UTC (rev 2583)
@@ -126,7 +126,6 @@
     printf ("  -maxmem n    use at most n MB of memory in stage 2\n");
     printf ("  -stage1time n add n seconds to ECM stage 1 time (for expected time est.)\n");
 
-    /*printf ("  -extra functions added by JimF\n"); */
     printf ("  -i n         increment B1 by this constant on each run\n");
     printf ("  -I f         increment B1 by f*sqrt(B1) on each run\n");
     printf ("  -inp file    Use file as input (instead of redirecting stdin)\n");
@@ -135,8 +134,8 @@
     printf ("               or can use N as a placeholder for the number being factored.\n");
     printf ("  -printconfig Print compile-time configuration and exit.\n");
 
-    printf ("  -bsaves file In the batch mode, save s in file.\n");
-    printf ("  -bloads file In the batch mode, load s from file.\n");
+    printf ("  -bsaves file With -param 1-3, save stage 1 exponent in file.\n");
+    printf ("  -bloads file With -param 1-3, load stage 1 exponent from file.\n");
 #ifdef WITH_GPU
     printf ("  -gpu         Use GPU-ECM for stage 1.\n");
     printf ("  -gpudevice n Use device n to execute GPU code (by default, "
@@ -836,7 +835,7 @@
       fprintf (stderr, "Error, library version %s differs from header "
                "version %s with which this file was compiled\n",
                ecm_version(), ECM_VERSION);
-      exit(EXIT_FAILURE);
+      exit (EXIT_FAILURE);
     }
 
   /* start of the program */
@@ -1348,7 +1347,12 @@
         }
       if (params->param == ECM_PARAM_DEFAULT)
           params->param = param;
-    
+
+      /* this is a hack to produce an error in ecm() when -bsaves is used
+         but we are not in batch mode */
+      if (savefile_s != NULL)
+        mpz_set_ui (params->batch_s, 2);
+
       /* load batch product s from a file */
       if (loadfile_s != NULL)
         {
@@ -1529,8 +1533,8 @@
         {
           int ret = write_s_in_file (savefile_s, params->batch_s);
           if (verbose >= OUTPUT_VERBOSE && ret > 0)
-              printf ("Save batch product (of %u bytes) in %s.", ret, 
-                                                                 savefile_s);
+              printf ("Saved batch product (of %u bytes) in %s\n", ret, 
+                      savefile_s);
         }
 
       /* advance B1, if autoincrement value had been set during command line 

Modified: trunk/test.ecm
===================================================================
--- trunk/test.ecm	2015-02-06 08:35:03 UTC (rev 2582)
+++ trunk/test.ecm	2015-02-06 09:27:44 UTC (rev 2583)
@@ -211,6 +211,13 @@
 echo 18446744073709551557 | $ECM -param 1 -A 312656731337392125 11000
 checkcode $? 8
 
+# test -bsaves/-bloads
+echo 18446744073709551557 | $ECM -param 1 -A 1 -bsaves test.ecm.s 11000
+echo 18446744073709551557 | $ECM -param 1 -A 312656731337392125 -bloads test.ecm.s 11000
+C=$?
+/bin/rm -f test.ecm.s
+checkcode $C 8
+
 # non-regression test for bug fixed by changeset r1819 on 32-bit
 echo 4294967291 | $ECM -param 1 -A 17 1000
 checkcode $? 8
@@ -303,10 +310,11 @@
 
 echo 10000000000000000000000000000000000000121 | $ECM -param 0 -sigma 291 -go 5994496018878137 4372759;  checkcode $? 8
 
+if [ "$MUL" == "modmuln" ]; then
 # exercise batch mode
 echo 33852066257429811148979390609187539760850944806763555795340084882048986912482949506591909041130651770779842162499482875755533111808276172876211496409325473343590723224081353129229935527059488811457730702694849036693756201766866018562295004353153066430367 | $ECM -sigma 1:17 1e6; checkcode $? 0
+fi
 
-
 $ECM -printconfig | grep Tuning
 
 echo "All ECM tests are ok."



More information about the Ecm-commits mailing list