[Top][All Lists]

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

Re: vectorwise parallelization with pararrayfun

From: Juan Pablo Carbajal
Subject: Re: vectorwise parallelization with pararrayfun
Date: Mon, 10 Jul 2017 10:27:10 +0200

> My question is: How can I use pararrayfun to parallelize function2 in a way
> that just function2 is concurrent but not function1?
> That is to say: I want concurrency only among different rows of inputs
> array, but I want no concurrency at all inside of function1.
Unless I fail to understand your question, the steps are the usual ones:
1. Make a cell out of the (m,n) array (call it X):
    input = mat2cell (X, ones(m,1), n);
2. Pass this cell to parcellfun:
    output = parcellfun (nproc, @function1, input, 'UniformOutput', false);
3. Reshape Y as you desired, e.g.
    Y = cell2mat (output);

I think you should also try to vectorize function1 a lot more (if you
have memory to spare), or put it down to C++.


reply via email to

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