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 Kommentar

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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 21 Apr. 2017

Kommentiert:

am 21 Apr. 2017

Community Treasure Hunt

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

Start Hunting!

Translated by