[Ecm-discuss] GPU ECM save and resume

Greg Childers jgchilders at mailaps.org
Ven 8 Avr 21:19:53 CEST 2016


Hi,

Although directly stage 2 worked, resuming from GPU stage 1 save files was
still broken.  The residues at the end of stage 1 were not being passed
back.  The attached patch should fix this, at least for the case of no
stage 1 factor found.  I haven't thought about the case that a stage 1
factor is found.

Thanks,
Greg
-------------- section suivante --------------
Une pièce jointe HTML a été nettoyée...
URL: <http://lists.gforge.inria.fr/pipermail/ecm-discuss/attachments/20160408/2146dd82/attachment.html>
-------------- section suivante --------------
diff -b -B -u ecm-7.0/cudawrapper.c ecm-7.0_GC/cudawrapper.c
--- ecm-7.0/cudawrapper.c       2016-04-08 11:17:20.759218072 -0700
+++ ecm-7.0_GC/cudawrapper.c    2016-04-08 11:01:36.279457879 -0700
@@ -235,7 +235,7 @@
 }
 
 int
-gpu_ecm (mpz_t f, int *param, mpz_t firstsigma, mpz_t n, mpz_t go, 
+gpu_ecm (mpz_t f, mpz_t x, int *param, mpz_t firstsigma, mpz_t n, mpz_t go, 
          double *B1done, double B1, mpz_t B2min_parm, mpz_t B2_parm, 
          unsigned long k, const int S, int verbose, int repr,
          int nobase2step2, int use_ntt, int sigma_is_A, FILE *os, FILE* es, 
@@ -475,6 +475,14 @@
         }
     }
 
+  /* Save stage 1 residues */
+  mpz_set_ui (x, 0);
+  for (i = 0; i < *nb_curves; i++)
+  {
+      mpz_mul (x, x, n);
+      mpz_add (x, x, factors[i]);
+  }
+
   if (mpz_cmp (B2, B2min) < 0)
       goto end_gpu_ecm_rhotable;
 
diff -b -B -u ecm-7.0/ecm-gpu.h ecm-7.0_GC/ecm-gpu.h
--- ecm-7.0/ecm-gpu.h   2016-04-08 11:17:20.741218723 -0700
+++ ecm-7.0_GC/ecm-gpu.h        2016-04-08 11:10:48.286419105 -0700
@@ -39,7 +39,7 @@
 /* cudawrapper.c */
 #define gpu_ecm __ECM(gpu_ecm)
 #ifdef WITH_GPU
-int gpu_ecm (mpz_t, int*, mpz_t, mpz_t, mpz_t, double *, double, mpz_t, 
+int gpu_ecm (mpz_t, mpz_t, int*, mpz_t, mpz_t, mpz_t, double *, double, mpz_t, 
              mpz_t, unsigned long, const int, int, int, int, int, int,
              FILE*, FILE*, char*, char *, double, int (*)(void), mpz_t, 
              double *, int, int*, unsigned int*);
diff -b -B -u ecm-7.0/factor.c ecm-7.0_GC/factor.c
--- ecm-7.0/factor.c    2016-04-08 11:17:20.756218181 -0700
+++ ecm-7.0_GC/factor.c 2016-04-08 10:51:31.696518485 -0700
@@ -157,7 +157,7 @@
         }
       else
         {
-          res = gpu_ecm (f, &(p->param), p->sigma, n, p->go, 
+          res = gpu_ecm (f, p->x, &(p->param), p->sigma, n, p->go, 
                          &(p->B1done), B1, p->B2min, p->B2, p->k,
                          p->S, p->verbose, p->repr, p->nobase2step2, 
                          p->use_ntt, p->sigma_is_A, p->os, p->es,


Plus d'informations sur la liste de diffusion Ecm-discuss