In[]:=
CloseKernels[]
Out[]=
{}
In[]:=
Needs["SubKernels`LocalKernels`"]Block[{$mathkernel=$mathkernel<>" -threadpriority=2"},LaunchKernels[]]
Out[]=
{KernelObject[1,local],KernelObject[2,local],KernelObject[3,local],KernelObject[4,local],KernelObject[5,local],KernelObject[6,local],KernelObject[7,local],KernelObject[8,local]}
In[]:=
Print["Start time is ",ds=DateString[],"."];prec=5000;(**Numberofrequireddecimals.*.*)ClearSystemCache[];T0=SessionTime[];expM[pre_]:=Module[{a,d,s,k,bb,c,end,iprec,xvals,x,pc,cores=32(*=4*numberofphysicalcores*),tsize=2^7,chunksize,start=1,ll,ctab,pr=Floor[1.005pre]},chunksize=cores*tsize;n=Floor[1.32pr];end=Ceiling[n/chunksize];Print["Iterations required: ",n];Print["Will give ",end," time estimates, each more accurate than the previous."];Print["Will stop at ",end*chunksize," iterations to ensure precsion of around ",pr," decimal places."];d=ChebyshevT[n,3];{b,c,s}={SetPrecision[-1,1.1*n],-d,0};iprec=Ceiling[pr/27];Do[xvals=Flatten[ParallelTable[Table[ll=start+j*tsize+l;x=N[E^(Log[ll]/(ll)),iprec];pc=iprec;While[pc<pr,pc=Min[3pc,pr];x=SetPrecision[x,pc];y=x^ll-ll;x=x(1-2y/((ll+1)y+2llll));];(**N[Exp[Log[ll]/ll],pr]**)x,{l,0,tsize-1}],{j,0,cores-1},Method"EvaluationsPerKernel"64(*apowerof2commensuratewithprocessorstrength*)]];ctab=ParallelTable[Table[c=b-c;ll=start+l-2;b*=2(ll+n)(ll-n)/((ll+1)(2ll+1));c,{l,chunksize}],Method"EvaluationsPerKernel"16(*apowerof2commensuratewithprocessorstrength*)];s+=ctab.(xvals-1);start+=chunksize;st=SessionTime[]-T0;kc=k*chunksize;ti=(st)/(kc+10^-4)*(n)/(3600)/(24);If[kc>1,Print[kc," iterations done in ",N[st,3]," seconds."," Should take ",N[ti,2]," days or ",N[ti*24*3600,2],"s, finish ",DatePlus[ds,ti],"."]];,{k,0,end-1}];N[-s/d,pr]];t2=Timing[MRBtest2=expM[prec];];Print["Finished on ",DateString[],". Processor time was ",t2[[1]]," s. Actual time was ",SessionTime[]-T0,"."];(*Print[*)MRBtest2(*]*)(*Remove(**)orenterMRBtest2toprintoutput*);Print["Enter MRBtest2 to print ",Floor[Precision[MRBtest2]]," digits"];Print["If you saved m3M, the difference between this and 3,014,991 known digits is ",N[MRBtest2-m3M,10]]
Start time is Tue 7 May 2019 21:06:13.
Iterations required: 6631
Will give 2 time estimates, each more accurate than the previous.
Will stop at 8192 iterations to ensure precsion of around 5024 decimal places.
4096 iterations done in 1.41 seconds. Should take 0.000026 days or 2.3s, finish Tue 7 May 2019 21:06:15.
Finished on Tue 7 May 2019 21:06:15. Processor time was 1.26563 s. Actual time was 1.4237371.
Enter MRBtest2 to print 5019 digits
If you saved m3M, the difference between this and 3,014,991 known digits is 0.1878596425-1.000000000m3M
In[]:=
Print["Start time is ",ds=DateString[],"."];prec=10000;(**Numberofrequireddecimals.*.*)ClearSystemCache[];T0=SessionTime[];expM[pre_]:=Module[{a,d,s,k,bb,c,end,iprec,xvals,x,pc,cores=32(*=4*numberofphysicalcores*),tsize=2^7,chunksize,start=1,ll,ctab,pr=Floor[1.005pre]},chunksize=cores*tsize;n=Floor[1.32pr];end=Ceiling[n/chunksize];Print["Iterations required: ",n];Print["Will give ",end," time estimates, each more accurate than the previous."];Print["Will stop at ",end*chunksize," iterations to ensure precsion of around ",pr," decimal places."];d=ChebyshevT[n,3];{b,c,s}={SetPrecision[-1,1.1*n],-d,0};iprec=Ceiling[pr/27];Do[xvals=Flatten[ParallelTable[Table[ll=start+j*tsize+l;x=N[E^(Log[ll]/(ll)),iprec];pc=iprec;While[pc<pr,pc=Min[3pc,pr];x=SetPrecision[x,pc];y=x^ll-ll;x=x(1-2y/((ll+1)y+2llll));];(**N[Exp[Log[ll]/ll],pr]**)x,{l,0,tsize-1}],{j,0,cores-1},Method"EvaluationsPerKernel"64(*apowerof2commensuratewithprocessorstrength*)]];ctab=ParallelTable[Table[c=b-c;ll=start+l-2;b*=2(ll+n)(ll-n)/((ll+1)(2ll+1));c,{l,chunksize}],Method"EvaluationsPerKernel"16(*apowerof2commensuratewithprocessorstrength*)];s+=ctab.(xvals-1);start+=chunksize;st=SessionTime[]-T0;kc=k*chunksize;ti=(st)/(kc+10^-4)*(n)/(3600)/(24);If[kc>1,Print[kc," iterations done in ",N[st,3]," seconds."," Should take ",N[ti,2]," days or ",N[ti*24*3600,2],"s, finish ",DatePlus[ds,ti],"."]];,{k,0,end-1}];N[-s/d,pr]];t2=Timing[MRBtest2=expM[prec];];Print["Finished on ",DateString[],". Processor time was ",t2[[1]]," s. Actual time was ",SessionTime[]-T0,"."];(*Print[*)MRBtest2(*]*)(*Remove(**)orenterMRBtest2toprintoutput*);Print["Enter MRBtest2 to print ",Floor[Precision[MRBtest2]]," digits"];Print["If you saved m3M, the difference between this and 3,014,991 known digits is ",N[MRBtest2-m3M,10]]
Start time is Tue 7 May 2019 20:59:32.
Iterations required: 13264
Will give 4 time estimates, each more accurate than the previous.
Will stop at 16384 iterations to ensure precsion of around 10049 decimal places.
4096 iterations done in 3.05 seconds. Should take 0.00011 days or 9.9s, finish Tue 7 May 2019 20:59:41.
8192 iterations done in 4.56 seconds. Should take 0.000085 days or 7.4s, finish Tue 7 May 2019 20:59:39.
12288 iterations done in 5.96 seconds. Should take 0.000075 days or 6.4s, finish Tue 7 May 2019 20:59:38.
Finished on Tue 7 May 2019 20:59:38. Processor time was 5.34375 s. Actual time was 5.9637134.
Enter MRBtest2 to print 10043 digits
If you saved m3M, the difference between this and 3,014,991 known digits is 0.1878596425-1.000000000m3M
In[]:=
CloseKernels[]
Out[]=
{KernelObject[1,local,<defunct>],KernelObject[2,local,<defunct>],KernelObject[3,local,<defunct>],KernelObject[4,local,<defunct>],KernelObject[5,local,<defunct>],KernelObject[6,local,<defunct>],KernelObject[7,local,<defunct>],KernelObject[8,local,<defunct>]}
In[]:=
Needs["SubKernels`LocalKernels`"]Block[{$mathkernel=$mathkernel<>" -threadpriority=2"},LaunchKernels[]]
Out[]=
{KernelObject[9,2600:1702:fb0:99a0:0:0:0:45],KernelObject[10,2600:1702:fb0:99a0:0:0:0:45],KernelObject[11,2600:1702:fb0:99a0:0:0:0:45],KernelObject[12,2600:1702:fb0:99a0:0:0:0:45],KernelObject[13,2600:1702:fb0:99a0:0:0:0:45],KernelObject[14,2600:1702:fb0:99a0:0:0:0:45],KernelObject[15,2600:1702:fb0:99a0:0:0:0:45],KernelObject[16,2600:1702:fb0:99a0:0:0:0:45],KernelObject[17,2600:1702:fb0:99a0:0:0:0:43],KernelObject[18,2600:1702:fb0:99a0:0:0:0:43],KernelObject[19,2600:1702:fb0:99a0:0:0:0:43],KernelObject[20,2600:1702:fb0:99a0:0:0:0:43],KernelObject[21,2600:1702:fb0:99a0:0:0:0:43],KernelObject[22,2600:1702:fb0:99a0:0:0:0:43],KernelObject[23,2600:1702:fb0:99a0:0:0:0:43],KernelObject[24,2600:1702:fb0:99a0:0:0:0:43],KernelObject[25,local],KernelObject[26,local],KernelObject[27,local],KernelObject[28,local],KernelObject[29,local],KernelObject[30,local],KernelObject[31,local],KernelObject[32,local]}
NEW
In[]:=
Print["Start time is ",ds=DateString[],"."];prec=30000;(**Numberofrequireddecimals.*.*)ClearSystemCache[];T0=SessionTime[];expM[pre_]:=Module[{a,d,s,k,bb,c,end,iprec,xvals,x,pc,cores=32(*=4*numberofphysicalcores*),tsize=2^7,chunksize,start=1,ll,ctab,pr=Floor[1.005pre]},chunksize=cores*tsize;n=Floor[1.32pr];end=Ceiling[n/chunksize];Print["Iterations required: ",n];Print["Will give ",end," time estimates, each more accurate than the previous."];Print["Will stop at ",end*chunksize," iterations to ensure precsion of around ",pr," decimal places."];d=ChebyshevT[n,3];{b,c,s}={SetPrecision[-1,1.1*n],-d,0};iprec=Ceiling[pr/27];Do[xvals=Flatten[ParallelTable[Table[ll=start+j*tsize+l;x=N[E^(Log[ll]/(ll)),iprec];pc=iprec;While[pc<pr,pc=Min[3pc,pr];x=SetPrecision[x,pc];y=x^ll-ll;x=x(1-2y/((ll+1)y+2llll));];(**N[Exp[Log[ll]/ll],pr]**)x,{l,0,tsize-1}],{j,0,cores-1},Method"EvaluationsPerKernel"56(*apowerof2commensuratewithprocessorstrength*)]];ctab=ParallelTable[Table[c=b-c;ll=start+l-2;b*=2(ll+n)(ll-n)/((ll+1)(2ll+1));c,{l,chunksize}],Method"EvaluationsPerKernel"16(*apowerof2commensuratewithprocessorstrength*)];s+=ctab.(xvals-1);start+=chunksize;st=SessionTime[]-T0;kc=k*chunksize;ti=(st)/(kc+10^-4)*(n)/(3600)/(24);If[kc>1,Print[kc," iterations done in ",N[st,3]," seconds."," Should take ",N[ti,2]," days or ",N[ti*24*3600,2],"s, finish ",DatePlus[ds,ti],"."]];,{k,0,end-1}];N[-s/d,pr]];t2=Timing[MRBtest2=expM[prec];];Print["Finished on ",DateString[],". Processor time was ",t2[[1]]," s. Actual time was ",SessionTime[]-T0,"."];(*Print[*)MRBtest2(*]*)(*Remove(**)orenterMRBtest2toprintoutput*);Print["Enter MRBtest2 to print ",Floor[Precision[MRBtest2]]," digits"];Print["If you saved m3M, the difference between this and 3,014,991 known digits is ",N[MRBtest2-m3M,10]]