Re: Octave multi threading.

vrozos <[email protected]>
Newsgroups gmane.comp.gnu.octave.general
Message-ID <[email protected]>
Ilaya Bharathi wrote
>    3. Apart from the above questions, I want to know what is a parallel
>    computing or parallel execution package for Octave. Are they similar to
>    Open Blas ? and what platform do they support ?

Quoted from: 
https://octave.1599824.n4.nabble.com/Octave-multi-threading-tp4697593p4698204.html

Below an example of parallel Octave package
(https://octave.sourceforge.io/parallel/index.html). The isOctave if-branch
employs parcellfun to enable parallel computing. The else-branch is the
equivalent without parallel computing.

function displacements= wrap_getdisplacements_mp( frames, framerange, ...
                                                  video, T, isOctave )
  frames_rolled={ frames{2:end}, frames{1} };
  if isOctave
    displacements= parcellfun ( nproc, @getdisplacements_mp, ...
                           frames(framerange), ...
                           frames_rolled(framerange), ...
                           repmat ({video}, 1, length (framerange)), ...
                           repmat ( {T}, 1, length (framerange)), ...
                           "UniformOutput", 0);
  else
    displacements=cell(1, length(frames));
    for j= 1:length(frames)
      displacements{j}= getdisplacements_mp ( frames{j}, ...
                            frames_rolled{j}, video, T );
    end
  end
    
  displacements=vertcat( displacements {:} )';                           
end




--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.