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 个评论

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.

请先登录,再进行评论。

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by