Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: a problem with the parfor loop
Replies: 1   Last Post: Sep 30, 2013 3:20 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
draasoft

Posts: 12
Registered: 3/28/12
a problem with the parfor loop
Posted: Sep 29, 2013 1:46 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hi everyone

I have been looking for making my code faster for a while, since it needs houres for running only one configuration, I need tens of runs. It contains millions of call for some functions.

As a solution, I found that using the parfor stucture might bring some improvement since I have a multi-core processor. The problmem however is that it does always give the same error:

"The variable pop in a parfor cannot be classified"

So, I would be very grateful if I get any insights.

Here is the portion of code containing the issue:

**********
parfor i=1:np

xi=pop(i,:);

j=randi(np);
while j==i
j=randi(np);
end

k=randi(np);
while k==i || k==j
k=randi(np);
end

l=randi(np);
while l==i || l==j || l==k
l=randi(np);
end

xj=pop(j,:);
xk=pop(k,:);
xl=pop(l,:);

vi=mutate(xj,xk,xl,f);
ui=binCross(xi,vi,cr);
ui=simplebounds(ui,Lb,Ub);
fu=cec13_func(ui',func);
if fu<fits(i)
pop(i,:)=ui;
fits(i)=fu;
end

end
**********



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.