parfor loop vectorized array

Hello,
Long story short, I have a code that takes roughly 12 hours to run on one core, and am looking to make things faster. I have the parallel tool box and looking into parfor loops for my solution. There is a 4-D array, 97x97x2x3, that I am vectorizing to take apart, modify, and put back together. When i take it apart, I have to pay close attention to my indices before modifying. Matlab tells me there is an error when trying to take apart my variable. Does Matlab not like vectorized arrays in a parfor loop? A work around I am currently trying is to create a mask and do a .* on my array. My question – Dose Matlab not like 4-D arrays in a parfor loop, or is it that I’m vectorizing the array?

댓글 수: 4

Oleg Komarov
Oleg Komarov 2012년 8월 8일
편집: Oleg Komarov 2012년 8월 8일
Can you please post the warning that mlint is giving you?
Or even better a sample code that reproduces the problem.
Matthew
Matthew 2012년 8월 8일
편집: Matthew 2012년 8월 8일
Alt(:,:,1,:) = Alt(:,:,1,:)/A;
Alt(:,:,2,[1 3])= Alt(:,:,2,:)[1 3])/(A*B);
Alt(:,:,2,2) = Alt(:,:,2,2)*A;
The error is: Valid indices for Alt are restricted in PARFOR loops.
This
Alt(:,:,2,:)[1 3])/(A*B)
dosen't look like valid syntax. Do you mean;
Alt(:,:,2,[1 3])/(A*B)
Matthew
Matthew 2012년 8월 8일
yes, I made a typo when writing the code down here, i thought I proofed it correctly >.<
Alt(:,:,1,:) = Alt(:,:,1,:)/A;
Alt(:,:,2,[1 3])= Alt(:,:,2,[1 3])/(A*B);
Alt(:,:,2,2) = Alt(:,:,2,2)*A;

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

질문:

2012년 8월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by