필터 지우기
필터 지우기

Distributing Arrays with parfor

조회 수: 2 (최근 30일)
Javier
Javier 2011년 8월 2일
Hi, I would like to know if it's possible to use Distributing Arrays with parfor loops.
Thanks in advance!
Here the code:
for n=1:1:fbdAct
indice=find(bdAnt(:,columnaID)==bdAct(n,columnaID));
if(~isempty(indice))
if((bdAnt(indice,columnaInc)>0) && (bdAct(n,columnaInc)==0))
if(~isempty(acelerados))
indiceAcel=find(acelerados(:,colAcID)==bdAct(n,columnaID));
if(isempty(indiceAcel))
newAcelerado=[bdAct(n,columnaID) tEspera];
acelerados=vertcat(acelerados,newAcelerado);
end
else
acelerados=[bdAct(n,columnaID) tEspera];
end
bDAcelerados=acelerados;
end
end
end
  댓글 수: 1
Jan
Jan 2011년 8월 2일
Please explain any details. Currently the best answer is: "It depends".

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

답변 (1개)

Edric Ellis
Edric Ellis 2011년 8월 2일
Distributed arrays are designed to be used with SPMD blocks, not PARFOR loops. In general, it is a mistake to use a distributed array within the body of a PARFOR loop. What are you trying to do?
  댓글 수: 3
Konrad Malkowski
Konrad Malkowski 2011년 8월 3일
Javier,
Could you post a copy of your sequential code (for loop)? This would help in determining if there is a way to parallelize that loop using parfor.
Javier
Javier 2011년 8월 3일
It is,bdAnt and bdAct are both matrix of nx8, and acelerados is nx2
for n=1:1:fbdAct
indice=find(bdAnt(:,columnaID)==bdAct(n,columnaID));
if(~isempty(indice))
if((bdAnt(indice,columnaInc)>0) && (bdAct(n,columnaInc)==0))
if(~isempty(acelerados))
indiceAcel=find(acelerados(:,colAcID)==bdAct(n,columnaID));
if(isempty(indiceAcel))
newAcelerado=[bdAct(n,columnaID) tEspera];
acelerados=vertcat(acelerados,newAcelerado);
end
else
acelerados=[bdAct(n,columnaID) tEspera];
end
bDAcelerados=acelerados;
end
end
end
thanks

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

카테고리

Help CenterFile Exchange에서 Parallel for-Loops (parfor)에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by