Changeset ec23b4 in git


Ignore:
Timestamp:
Nov 19, 2020, 3:09:39 PM (3 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
779deb22a360a6da7bc13629a032985fd826194e
Parents:
2e7c6b095bd02b92f7355c8c0aa193435fd1af8e
Message:
add: parallel chinrem (id_ChineseRemainder_0) over ZZ
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Singular/iparith.cc

    r2e7c6b0 rec23b4  
    66* ABSTRACT: table driven kernel interface, used by interpreter
    77*/
    8 //long all_farey=0L;
    9 //long farey_cnt=0L;
     8long all_farey=0L;
     9long farey_cnt=0L;
    1010
    1111#include "kernel/mod2.h"
     
    21192119  ideal uu=(ideal)u->Data();
    21202120  number vv=(number)v->Data();
    2121   //timespec buf1,buf2;
    2122   //clock_gettime(CLOCK_THREAD_CPUTIME_ID,&buf1);
     2121  timespec buf1,buf2;
     2122  clock_gettime(CLOCK_THREAD_CPUTIME_ID,&buf1);
    21232123  res->data=(void*)id_Farey(uu,vv,currRing);
    2124   //clock_gettime(CLOCK_THREAD_CPUTIME_ID,&buf2);
    2125   //const unsigned long SEC = 1000L*1000L*1000L;
    2126   //all_farey+=((buf2.tv_sec-buf1.tv_sec)*SEC+
    2127   //                              buf2.tv_nsec-buf1.tv_nsec);
    2128   //farey_cnt++;
     2124  clock_gettime(CLOCK_THREAD_CPUTIME_ID,&buf2);
     2125  const unsigned long SEC = 1000L*1000L*1000L;
     2126  all_farey+=((buf2.tv_sec-buf1.tv_sec)*SEC+
     2127                                buf2.tv_nsec-buf1.tv_nsec);
     2128  farey_cnt++;
    21292129  return FALSE;
    21302130}
     
    97429742  else
    97439743  {
    9744     #if 0
     9744    #if 1
    97459745    if (rField_is_Q(currRing))
    97469746      result=id_ChineseRemainder_0(x,q,rl,currRing); // deletes also x
  • kernel/GBEngine/kChinese.cc

    r2e7c6b0 rec23b4  
    9999    if (n->s==3)
    100100    {
     101      ll+=SIZEOF_LONG*2; /* n->s, mpz size */
    101102      long l=mpz_size1(n->z);
    102103      ll+=l*sizeof(mp_limb_t);
     
    104105    else
    105106    {
    106       long l=mpz_size1(n->z);
     107      ll+=SIZEOF_LONG*3; /* n->s, mpz size(n->z) mpz size(n->n)*/
     108      size_t l=mpz_size1(n->z);
    107109      ll+=l*sizeof(mp_limb_t);
    108110      l=mpz_size1(n->n);
     
    204206    return NULL;
    205207  }
     208  int cpus=(int)(long)feOptValue(FE_OPT_CPUS);
     209  if (2*cpus>=cnt) /* at least 2 polys for each process,
     210                     or switch to seriell version */
     211    return id_ChineseRemainder(xx,q,rl,r);
    206212  ideal result=idInit(cnt,xx[0]->rank);
    207213  result->nrows=rw; // for lifting matrices
    208214  result->ncols=cl; // for lifting matrices
    209   int cpus=(int)(long)feOptValue(FE_OPT_CPUS);
    210215  int parent_pid=getpid();
    211216  using namespace vspace;
     
    293298  printf("send len: %d\n",(int)(s-buf));
    294299  long *d=(long*)buf;
    295   for(int i=0;i<=ll/8;i++) printf("%ld ",d[i]);
     300  for(int i=0;i<=ll/SIZEOF_LONG;i++) printf("%ld ",d[i]);
    296301  printf("\n");
    297302  n=NULL;
     
    301306  p_Write(n,currRing);
    302307  PrintLn();
    303 }
     308  omFree(buf);
     309}
Note: See TracChangeset for help on using the changeset viewer.