Faster processing with parfor loop

I am running a matlab code using parfor and using 2/4 local workers. I would like to speed up the code . Can you please suggest how to use the code efficiently in cluster. An example code is:
parfor k= 3:(NZ-3)
for j=1:NY
for i=1:NX
value_dvy_dx = (27*vy(i,j,k)-27*vy(i-1,j,k)-vy(i+1,j,k)+vy(i-2,j,k)) /DELTAX/24;
memory_dvy_dx(i,j,k) = b_x(i) * memory_dvy_dx(i,j,k) + a_x(i) * value_dvy_dx;
end
end
end

1 Comment

If vy is an array instead of a function, as it looks to be, then your
for i=1:NX
would lead to indices as low as -1, which is a problem.

Sign in to comment.

Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Asked:

on 21 Apr 2017

Commented:

on 21 Apr 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!