how can i convert my serial code (matlab code) to parallel on gpu

i have my serial code writing by matlab and i want to convert it to run on GPU
please any one can help me it very important for me

level = graythresh(img_cut_h);
Ibw =(im2bw(img_cut_h,level));
Ibw = bwareaopen(Ibw, 50);

Fl=bwlabel(Ibw);
Statsbf=regionprops(Fl,‘all’);
Flmax=find([Statsbf.Area]==max([Statsbf.Area]));
angle=Statsbf(Flmax).Orientation;
F2=imrotate(Fl,-angle);

L=logical(F2);
Statsbf=regionprops(L,‘all’);
maxi=find([Statsbf.Area]==max([Statsbf.Area]));
BB=Statsbf(maxi).BoundingBox;
% F2=imcrop(F2,[BB(1,1) BB(1,2) BB(1,3) BB(1,4)]);

L4=not(F2);
G2 = gpuArray(L4);
[r, c]=size(G2);
G2(1,:)=0;
G2(2,:)=0;
G2(3,:)=0;
G2(r,:)=0;7;
G2(r-1,:)=0;
G2(r-2,:)=0;
G2(:,1)=0;
G2(:,2)=0;
G2(:,c)=0;
G2(:,c-1)=0;
L4 = gather(G2);

L4b=bwlabel(L4);
Stats3=regionprops(L4b,‘all’);
sarea3=[Stats3.Area];
G=find(sarea3<70);

parfor cv=1:length(G)
L4 = zeros(97, 337); % Pre-allocate a row of “out”
G1=find(L4b==G(cv));
L4(:,G1)=0;
end
[r, c]=size(L4);
CC=bwconncomp(L4);
L=bwlabel(L4);
ind2=max(L(:,c-2));
P=regionprops(CC,‘all’);

i=1;
if (max(P(i,1).PixelList(:,1))-min(P(i,1).PixelList(:,1)))<(c/13)
L4(CC.PixelIdxList{1,i})=0;
end

for i=1:CC.NumObjects

if (max(P(i,1).PixelList(:,1))-min(P(i,1).PixelList(:,1)))>(2*c/3)
L4(CC.PixelIdxList{1,i})=0;
end

if (max(P(i,1).PixelList(:,2))-min(P(i,1).PixelList(:,2)))<(r/3)
L4(CC.PixelIdxList{1,i})=0;
end

if (max(P(i,1).PixelList(:,1))-min(P(i,1).PixelList(:,1)))<(c/8)
L4(L==ind2)=0;
end

end

L4=imclose(L4,strel(‘disk’,1));
L4=imopen(L4,strel(‘disk’,1));
figure(4);
imshow(L4);
L4b=logical(L4);
Stats3b=regionprops(L4b,‘all’);

N=length(Stats3b);

while N>8
L4=imdilate(L4,strel(‘disk’,1));
L4b=logical(L4);
Stats3b=regionprops(L4b,‘all’);
N=length(Stats3b);
end

L4b=bwlabel(L4);
Stats3b=regionprops(L4b,‘all’);
ImgChar=zeros(100,100,N);

cont=0;
cont1=0;

for i=1:N

[r1, c1]=size(Stats3b(i,1).Image);

if c1>round(c/6)
cont1=cont;
Stats3b(i,1).Image(:,round(c1/2))=0;
L5=Stats3b(i,1).Image;
CC=bwconncomp(L5);
CC1=regionprops(CC,‘all’);

for j=1:CC.NumObjects
[r2, c2]=size(CC1(j,1).Image);

if c2>round(c/7)
CC1(j,1).Image(:,round(c2/2))=0;
L6=CC1(j,1).Image;

LL=bwconncomp(L6);
CC2=regionprops(LL,‘all’);

for k=1:LL.NumObjects
CC2(k).Image=imresize(CC2(k).Image, [100 100]);
figure;imshow((CC2(k).Image))
ImgChar(:,:,i+cont1)=not(CC2(k).Image);
cont1=cont1+1;
end
cont=cont+1;

else

CC1(j).Image=imresize(CC1(j).Image, [100 100]);
figure;imshow((CC1(j).Image))
ImgChar(:,:,i+cont1)=not(CC1(j).Image);
cont1=cont1+1;
end

end
cont=cont+1;

else
Stats3b(i).Image=imresize(Stats3b(i).Image, [100 100]);
figure;imshow((Stats3b(i).Image));

if cont~=0
ImgChar(:,:,i+cont)=not(Stats3b(i).Image);
else
ImgChar(:,:,i)=not(Stats3b(i).Image);
end
end

[x, y, Objects]=size(ImgChar);

for p=1:Objects

if min(min(not(ImgChar(:,p))))==1;
l=p;
while l~=(Objects-1)
ImgChar(:,l)=ImgChar(:,l+1);
l=l+1;
end
ImgChar(:,:,l)=ImgChar(:,:,l+1);
Objects=Objects-1;
end
end
end

I am confused by the question. MATLAB has offered GPU acceleration since (at least) 2012, and in your code I spot ‘gpuArray’ which hints at GPU usage. Have you consulted MATLAB-specific resources as to how to take advantage of GPU acceleration? A reasonable starting point may be [url]http://www.mathworks.com/discovery/matlab-gpu.html[/url]