octave-patch-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-patch-tracker] [patch #8303] vectorized parcellfun and pararrayf


From: John Hunt
Subject: [Octave-patch-tracker] [patch #8303] vectorized parcellfun and pararrayfun
Date: Wed, 05 Feb 2014 20:43:18 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:26.0) Gecko/20100101 Firefox/26.0

Follow-up Comment #4, patch #8303 (project octave):

Here is an usage example, taken from the tests :


function [x, y] = f(u, v, w)
  x = u + v.' + w;
   y = x.';
endfunction

u = [1:10; 2:11];
v = u.';
w = 3;
[x, y] = pararrayfun(2, @f, u, v, w, "Vectorized", true, "ChunksPerProc", 2,
"VerboseLevel", 1, "CatDimensions", [2 1],"IdxDimensions", [2 1 0] );
assert(x, [2:2:20; 4:2:22]+3)
assert(y, [2:2:20; 4:2:22].'+3)


The problem with preshaping is that for multidimensional arrays, I found it
quite difficult to handle while keeping readable code, hence the patch.

With this patch, you can use exactly the same function and the same inputs
with or without pararrayfun.
Just add pararrayfun, IdxDimensions and CatDimensions if needed, and that's
it, it runs on multiple cores ! 
The end user code is very clean.

I'll look for some benchmarks. IIRC, for my big calculations the overhead was
negligible. I have made none for small ones.
But anyway no regression should occur since the "default indexing" uses
basically the same code as before.

Looking into the code, there are some commented portions I could remove, and a
small "fixme" I'll have more time to solve now.

I think that the cleanliness of the user code is worth the slight
complication. Please let me know if I should try better to advocate ? 

The patch in the current state is working fine, but maybe not clean enough for
others to dwell into it. I'm open to polish it before, and try to make a
mercurial changeset if you wish.



    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/patch/?8303>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]