Prev: simmechanics link and vista
Next: How to extract different rows and columns from different images and then mixing them to form new matrix
From: maxwell10 on 18 Apr 2010 05:29 Hi I want to run script with very long for loop. I use desktop OS XP with AMD Phenom X3 and also I have server with OS Unix 'red hat' anf 8 cores How can I run it on all cores in order to reduce computing time? This is the script: row=size(p,1); % the size is 32,000 rows! for k=1:row m=p(k,:); x=0:(length(m)-1); f=fittype('a+b*exp(c*x)','independent','x'); [cfun,gof,output]=fit(x',m',f,'startpoint',[1 2-1]); C(k)=cfun.c; end
From: John D'Errico on 18 Apr 2010 10:16 maxwell10 <maxwellphy(a)hotmail.com> wrote in message <1934902637.32085.1271597407057.JavaMail.root(a)gallium.mathforum.org>... > Hi > I want to run script with very long for loop. > I use desktop OS XP with AMD Phenom X3 and also I have server with OS Unix 'red hat' anf 8 cores > How can I run it on all cores in order to reduce computing time? > > This is the script: > row=size(p,1); % the size is 32,000 rows! > for k=1:row > m=p(k,:); > x=0:(length(m)-1); > f=fittype('a+b*exp(c*x)','independent','x'); > [cfun,gof,output]=fit(x',m',f,'startpoint',[1 2-1]); > C(k)=cfun.c; > end The solution to all computing problems is not to simply throw more cores, faster computers, more memory at the problem. This is the lazy way out. Why bother thinking? Just spend the money for a bigger, faster computer. Instead, one can choose to employ BETTER algorithms. First of all, use a partitioned least squares scheme here to reduce this to a 1-dimensional optimization problem. I do this in my fminspleas code. Next, use a batching scheme to convert these single parameter problems into larger, batched problems. Sigh. This may take some sophistication to write. I suppose it is time to post such a solution on the FEX. John
From: maxwell10 on 19 Apr 2010 00:25
What is:"partitioned least squares scheme"? How to execute it? Also, how to use a batching scheme? |