5
$\begingroup$

EDIT : Finally, the new Mathematica 10.0 seems to fix it.

I have a little parallelization problem. I wrote a code to generate a quasicrystal by dynamical generation. Here the code:

(*===================================================================================*)
    time1 = DateList[] ;
    Print[time1];
(*Constants*)
(*===================================*)
ITERMAX = 9; (* Maximum = 9 *)
(*===================================*)
MIN ={0.9999999999999999`, 0.6180339887498947`, 0.3819660112501049`, 
0.38196601125010465`, 0.23606797749978875`, 0.23606797749978836`, 
   0.23606797749978836`, 0.14589803375031407`, 0.14589803375031385`}[[
  ITERMAX]];
MAX = {1.`, 0.618033988749895`, 0.38196601125010554`, 
    0.38196601125010576`, 0.23606797749979036`, 0.2360679774997906`, 
    0.23606797749979072`, 0.1458980337503173`, 0.1458980337503173`}[[ITERMAX]]; 
Clear[x, xx, zz]
x = 0;
sig := Exp[2*Pi*I/5];
tau := N[GoldenRatio];
CiT := 2*tau^4;

(*Functions*)
complexSplit := Function[z, {Re@z, Im@z}, Listable];
dP[w_, z_] := 1/2*(w*z\[Conjugate] + w\[Conjugate]*z);
zGen[x_] :=
  Module[
   {
    zPlus = Table[x + Exp[2*Pi*I*j/5], {j, 0, 4, 1}],
    zMinus = Table[x - Exp[2*Pi*I*j/5], {j, 0, 4, 1}]
    },
   Return[Join[zPlus, zMinus]]
   ]; 
fctTest[seed_] := 
  1/11*(1 + Sum[Exp[2*Pi*dP[dP[I, sig^i], dP[CiT, seed]]], {i, 4}] + 
     Sum[Exp[-2*Pi*dP[dP[I, sig^i], dP[CiT, seed]]], {i, 4}]);
zTest[x_] := 
 If[Re[fctTest[x]] >= 0.38232, 
  x]; (*Real part for the computation error*)

Generator[x_] := Generator[x] = zTest /@ zGen[x];

(*Point generation*)
zz[0] := {x};
For[i = 0, i < ITERMAX, i++,
  zz[i + 1] = DeleteDuplicates[Flatten[ParallelMap[Generator, zz[i]]]];
  ];
z = DeleteDuplicates[Flatten[Table[zz[k], {k, 0, ITERMAX}], 1]];

(*Line generation*)
Lz = Length[z];
zCart = ParallelTable[{N[Re[z[[i]]]], N[Im[z[[i]]]]}, {i, 1, Lz}];
zline = Cases[Flatten[ParallelTable[
     Table[
      If[zCart[[i]] != zCart[[j]] && 
        MIN <= EuclideanDistance[zCart[[i]], zCart[[j]]] <= 
         MAX, {zCart[[i]], zCart[[j]]}, 0]
      , {j, i, Lz}],
     {i, 1, Lz}], 1],
   Except[0]];

(*PLOT*)
quasicrystal = 
  Graphics[{{PointSize[0.004], Red, 
     Point[complexSplit@z]}, {Thickness[0.00009], Line[zline]}}, 
   ImageSize -> {2000, 2000}];
    time2 = DateList[];
    time3 = DateDifference[time1, time2, "Second"];
    Show[quasicrystal]
    Print[time2];
    Print[time 3];
(*===================================================================================*)

So when I try to run my code for nine or more iterations, I have the following sequence of errors :

LinkObject::linkd: Unable to communicate with closed link LinkObject[/usr/local/Wolfram/Mathematica/9.0/Executables/math -subkernel -noinit -mathlink,250,9]. >>
KernelObject::rdead: Subkernel connected through KernelObject[6,local] appears dead. >>
Parallel`Developer`QueueRun::req: Requeueing evaluations {1162} assigned to KernelObject[6,local,<defunct>].
LaunchKernels::clone: Kernel KernelObject[6,local,<defunct>] resurrected as KernelObject[6,local]. >>
LinkObject::linkd: Unable to communicate with closed link LinkObject[/usr/local/Wolfram/Mathematica/9.0/Executables/math -subkernel -noinit -mathlink,249,8]. >>
KernelObject::rdead: Subkernel connected through KernelObject[5,local] appears dead. >>
Parallel`Developer`QueueRun::req: Requeueing evaluations {1163} assigned to KernelObject[5,local,<defunct>].
LaunchKernels::clone: Kernel KernelObject[5,local,<defunct>] resurrected as KernelObject[5,local]. >>
LinkObject::linkd: Unable to communicate with closed link LinkObject[/usr/local/Wolfram/Mathematica/9.0/Executables/math -subkernel -noinit -mathlink,251,10]. >>
General::stop: Further output of LinkObject::linkd will be suppressed during this calculation. >>
KernelObject::rdead: Subkernel connected through KernelObject[7,local] appears dead. >>
General::stop: Further output of KernelObject::rdead will be suppressed during this calculation. >>
Parallel`Developer`QueueRun::req: Requeueing evaluations {1161} assigned to KernelObject[7,local,<defunct>].
General::stop: Further output of Parallel`Developer`QueueRun::req will be suppressed during this calculation. >>
LaunchKernels::clone: Kernel KernelObject[7,local,<defunct>] resurrected as KernelObject[7,local]. >>
General::stop: Further output of LaunchKernels::clone will be suppressed during this calculation. >>

My PC can also crash and I don't understand the problem because I can run my code without problem on institutional version, but not on my computer with the student version. Not having any idea, I hope someone will have an idea.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.