About this blog

I feel this blog as a reflection of my thoughts to myself , and sometimes as a public diary, and the is my only friend to share my thoughts who says never a "oh no! ,you shouldn't....That is boring...."

Fractals generation using Octave parallelization for the cores

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

కామెంట్‌లు లేవు: