|
From: | Daniel Arteaga |
Subject: | Re: parcellfun (or cellfun) overhead |
Date: | Tue, 01 Feb 2011 12:49:27 +0100 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; ca-ES; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 |
Al 01/02/11 12:22, En/na c. ha escrit:
On 1 Feb 2011, at 11:57, Daniel Arteaga wrote:Al 01/02/11 11:54, En/na c. ha escrit:On 1 Feb 2011, at 11:43, Daniel Arteaga wrote:Hi, I paralellize a piece of code in the following way: anonyFunc = @(x) func(x, paramStruct); splB = parcellfun(nThreads, anonyFunc, dataCell); where "paramStruct" is a very large structure array (70000 elements), and "dataCell" contains each one of the imput data. The function "func" takes takes around 50 ms, (measured with tic-toc), but when calling it with parcellfun it takes much longer, around 500 ms. Same happens when replacing parcellfun with cellfun. I suspect that this is due to the large size of paramStruct, because this does not happen when replacing "func" by a dummy function. Any ideas of how could improve the situation? Many thanks in advance, Daniel ArteagaWhat version of Octave are you using? on what OS?Sorry, I forgot to mention that. I'm using Octave 3.2.3 under Ubuntu Linux 10.04. D.OK, I suspected you were on windows where fork is more expensive than on POSIX systems, but this is not the case. According to this thread: http://octave.1599824.n4.nabble.com/anonymous-functions-optimization-wanted-for-3-4-0-td2534161.html#none some optimizations for anonymous functions have been applied in the 3.3.x branch that are relevant for the use you make of them, so you might want to try the same code with the most recent snapshot of the 3.3.x branch or with mercurial sources.
It looks like this optimization could make a difference in my code. However, the code I'm developing has to go into production machines, so I'd rather not use developement sources.
Probably I'll wait until Octave 3.4.0 is released. Thank you very much. Daniel
[Prev in Thread] | Current Thread | [Next in Thread] |