Parallelization in Octave using parcellfun/pararrayfun

My computer has many processors and I would like to run some octave scripts so that all the processors are being used.
One can use octave function called “pararrayfun” for this purpose. This function is part of “general” package on octave-forge.

On my ubuntu 11.10, I used “sudo apt-get install octave-general” to install this package and ran the following script

1; # this is kept to Prevent Octave from thinking that this is a function file:

close all;
clear all;

function y=test(a,b)



tic ();
tt_par= pararrayfun(num_process,@test,(a_test_inputs),(b_test_inputs));
parallel_elapsed_time = toc ()

tic ();
tt_ser= test((a_test_inputs),(b_test_inputs));
serial_elapsed_time = toc ()

legend('Parallel result','Serial result');

 disp(sprintf('Elapsed time during serial computation is %e',serial_elapsed_time))
 disp(sprintf('Elapsed time during parallel computation is %e',parallel_elapsed_time))

2 thoughts on “Parallelization in Octave using parcellfun/pararrayfun

  1. I did not know you could define a function in a script file. Cool. Do you think this would work on a windows system? I might give it a try.

  2. Pingback: John Henry

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>