Install OCTAVE with Parallel and Image libraries, first .
Save the following in "fractalParallel.m" file
and attribute execution status using chmod
#!/usr/bin/octave-cli
pkg load parallel
M=0.012;
N=0.012;
sqbox=1000;
O=[0.143, -0.65];
X=O(1)+linspace(-M,M,sqbox);
Y=O(2)+linspace(-N,N,sqbox);
numCores=nproc();
inputs=vec( repmat(X, sqbox, 1) )+ i* repmat(Y, 1, sqbox)(:);
F=pararrayfun(numCores, @selfsim, inputs );
F=reshape(F,[length(X) length(Y)]);
imwrite(F,'MandelbrotPar.tiff');
Save this function file in "selfsim.m"
function [val]=selfsim(c,limit, Maxcount)
limit=2;
Maxcount=50;
z=0;
kk=0;
while abs(z) z=z^2+c;
++kk;
endwhile
val=1-kk/Maxcount;
endfunction
Save the following in "fractalParallel.m" file
and attribute execution status using chmod
#!/usr/bin/octave-cli
pkg load parallel
M=0.012;
N=0.012;
sqbox=1000;
O=[0.143, -0.65];
X=O(1)+linspace(-M,M,sqbox);
Y=O(2)+linspace(-N,N,sqbox);
numCores=nproc();
inputs=vec( repmat(X, sqbox, 1) )+ i* repmat(Y, 1, sqbox)(:);
F=pararrayfun(numCores, @selfsim, inputs );
F=reshape(F,[length(X) length(Y)]);
imwrite(F,'MandelbrotPar.tiff');
Save this function file in "selfsim.m"
function [val]=selfsim(c,limit, Maxcount)
limit=2;
Maxcount=50;
z=0;
kk=0;
while abs(z)
++kk;
endwhile
val=1-kk/Maxcount;
endfunction
కామెంట్లు లేవు:
కామెంట్ను పోస్ట్ చేయండి