WOLFRAM NOTEBOOK

Try 1 [with callbacks]

Try 2 [without callbacks]

For SW’s rig only:

In[]:=
$SourceCode=
;
In[]:=
Needs["CCompilerDriver`"];
In[]:=
$LibraryLocations=Association[ParallelEvaluate[Needs["CCompilerDriver`"];$MachineName->CreateLibrary[$SourceCode,"lifetimesk2r2","CompileOptions"->"-O3","TargetDirectory"->$TemporaryDirectory],"OneKernelPerMachine"]]
Out[]=
delta/private/var/folders/md/29tnw2xx79j5wm2qgxj30l140000gp/T/lifetimesk2r2.dylib,epsilon/private/var/folders/md/29tnw2xx79j5wm2qgxj30l140000gp/T/lifetimesk2r2.dylib,tremac/private/var/folders/md/29tnw2xx79j5wm2qgxj30l140000gp/T/lifetimesk2r2.dylib,theta/private/var/folders/md/29tnw2xx79j5wm2qgxj30l140000gp/T/lifetimesk2r2.dylib,macstudio-basement/private/var/folders/md/29tnw2xx79j5wm2qgxj30l140000gp/T/lifetimesk2r2.dylib,lambda/private/var/folders/md/29tnw2xx79j5wm2qgxj30l140000gp/T/lifetimesk2r2.dylib,threadripper/tmp/lifetimesk2r2.so,threadripper2/tmp/lifetimesk2r2.so
In[]:=
$LibraryLocations[$MachineName]
Out[]=
/private/var/folders/md/29tnw2xx79j5wm2qgxj30l140000gp/T/lifetimesk2r2.dylib
In[]:=
lifetime=ForeignFunctionLoad[$LibraryLocations[$MachineName],"lifetime",{"CLong","CInt"}->"CInt"]
Out[]=
ForeignFunction
Name: lifetime
Type: {CLong,CInt}CInt
In[]:=
ParallelEvaluate[lifetime=ForeignFunctionLoad[$LibraryLocations[$MachineName],"lifetime",{"CLong","CInt"}->"CInt"]];
In[]:=
Counts[ParallelEvaluate[{$MachineName,lifetime[16788,10]}]]
Out[]=
{delta,2}20,{epsilon,2}24,{tremac,2}20,{theta,2}24,{macstudio-basement,2}24,{lambda,2}20,{threadripper,2}32,{threadripper2,2}64

top level

pre-compute for symmetry

In[]:=
up=Values[KeySort[Association[Catenate[MapIndexed[Position[Tuples[{1,0},5],#][[1,1]]->#2[[1]]&,GatherBy[Tuples[{1,0},5],Sort[{Reverse[#],#}]&],{2}]]]]];
In[]:=
upSample[ru_]:=FromDigits[IntegerDigits[ru,2,20][[up]],2]
In[]:=
down=Values[Map[First,KeySort[GroupBy[Transpose[{Range[32],up}],Last->First]]]];
In[]:=
downSample[ru_]:=FromDigits[IntegerDigits[ru,2,32][[down]],2]
In[]:=
bitMatchQ[r2_,{r1_,m1_}]:=bitMatchQ[r2,{r1,m1}]=SameQ[BitAnd[BitXor[r2,r1],m1],0]

pattern encoding

In[]:=
tups=Tuples[{1,0},5];
In[]:=
ruleMask[ru_,lt_]:=Module[{data,mask},data=Union[Catenate[Map[Partition[#,5,1]&,CellularAutomaton[{ru,2,2},CenterArray[1,4*(lt+4)+1],lt+2]]]];mask=FromDigits[Lookup[Association[Thread[data->1]],tups,0],2];{BitAnd[ru,mask],mask}]

level and split

In[]:=
getLevel[max_,lt_]:=Module[{item,rm,res},res=Union[ParallelTable[item=ind;res=lifetime[item,lt+2];If[0<=res<=lt,rm=ruleMask[item,lt];rm->res,Nothing],{ind,0,max,2}]];KeySort[GroupBy[res,Last->First]]]

data

test 1

In[]:=
AbsoluteTiming[res=getLevel[2^20-1,10]]
Out[]=
{4.97894,0{{0,65815}},1{{20,16847199},{272,16847199},{276,285295007}},2{{16788,285299167}}}
In[]:=
2^125./60.
Out[]=
341.333
In[]:=
%/60.
Out[]=
5.68889
In[]:=
AbsoluteTiming[res=getLevel[2^25-1,10]]
Out[]=
{11.7016,0{{0,65815}},1{{20,16847199},{272,16847199},{276,285295007}},2{{16788,285299167},{1048868,156317055},{1049892,3507586495}},3{{1082788,3507590655}},4{{5257508,3646012927}},5{{5774180,1507459071},{14162788,1507442687}},8{{14309732,3655335935}}}
In[]:=
AbsoluteTiming[res=getLevel[2^32-1,10]]
Out[]=
In[]:=
Now
Out[]=
Sun 13 Oct 2024 02:35:32GMT-4
In[]:=
AbsoluteTiming[res=getLevel[2^32-1,500]]
LinkObject
:Unable to communicate with closed link LinkObject[65050@127.0.0.1,1871,236].
KernelObject
:Subkernel connected through KernelObject[ContextEvaluators`SshKernels`,PredicateEvaluators`SshKernels`SshNameQ,ConstructorEvaluators`SshKernels`SshKernel,Order10,ClassSshKernels,Version2,39,ForwardPort0,RemoteSshArguments({sh,-s,#1,#2}&),ForkingArguments{2>/tmp/MathLink/forking$$},UseLinkLaunchForForkingFalse,RemoteScriptTemplatet=1; for i in $(seq 1 $1) ; do `1` &>/dev/null & sleep $t ; t=0.05 ; done; wait,5,1,1] appears dead.
LaunchKernels
:Kernel KernelObject[ContextEvaluators`SshKernels`,PredicateEvaluators`SshKernels`SshNameQ,ConstructorEvaluators`SshKernels`SshKernel,Order10,ClassSshKernels,Version2,39,ForwardPort0,RemoteSshArguments({sh,-s,#1,#2}&),ForkingArguments{2>/tmp/MathLink/forking$$},UseLinkLaunchForForkingFalse,RemoteScriptTemplatet=1; for i in $(seq 1 $1) ; do `1` &>/dev/null & sleep $t ; t=0.05 ; done; wait,5,1,1] resurrected as KernelObject[ContextEvaluators`SshKernels`,PredicateEvaluators`SshKernels`SshNameQ,ConstructorEvaluators`SshKernels`SshKernel,Order10,ClassSshKernels,Version2,39,ForwardPort0,RemoteSshArguments({sh,-s,#1,#2}&),ForkingArguments{2>/tmp/MathLink/forking$$},UseLinkLaunchForForkingFalse,RemoteScriptTemplatet=1; for i in $(seq 1 $1) ; do `1` &>/dev/null & sleep $t ; t=0.05 ; done; wait,5,1,1].
Join
:Nonatomic expression expected at position 1 in Join[IterationLimit].
GroupBy
:The argument Join[IterationLimit] is not a valid list of Associations or rules or lists of rules.
KeySort
:The argument GroupBy[Join[IterationLimit],LastFirst] is not a valid Association or a list of rules.
Out[]=
{393.553,KeySort[GroupBy[Join[IterationLimit],LastFirst]]}
In[]:=
Now
Out[]=
Sun 13 Oct 2024 02:35:32GMT-4
In[]:=
AbsoluteTiming[res=getLevel[2^32-1,500]]
Wolfram Cloud

You are using a browser not supported by the Wolfram Cloud

Supported browsers include recent versions of Chrome, Edge, Firefox and Safari.


I understand and wish to continue anyway »

You are using a browser not supported by the Wolfram Cloud. Supported browsers include recent versions of Chrome, Edge, Firefox and Safari.