Which is the best way to parallelize a loop in octave

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Which is the best way to parallelize a loop in octave

dariodematties
Hello People,

I need to use a third party function in a for loop in Octave.
That is, I cannot apply vectorized or element wise operations with this function.
The problem is the huge slowness of the execution.
I think there are two possible solutions to my problem.
Option one: I could modify the function in order to execute it in a vectorized way (not a viable option).
Option two: I could parallelize the for loop in Octave.
Regarding last option, there are two packages in Octave for parallel computation.
(mpi and parallel)
Taking into account that I am on a Ubuntu 14.04 desktop system in a real dual processor (or four virtual):
Which is the best option you advise to me?
Being in a shared memory system, I am used to use openmp in c++, which works with light threads very well. I have never used mpi, but I understand that this uses processes, which is not a very good option in a shared memory system, is it?
Is there a good way to implement openmp in Octave?

Thanks
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Which is the best way to parallelize a loop in octave

Francesco Potortì
[...]
>Option two: I could parallelize the for loop in Octave.
>Regarding last option, there are two packages in Octave for parallel
>computation.
>(mpi and parallel)
>Taking into account that I am on a Ubuntu 14.04 desktop system in a real
>dual processor (or four virtual):
>Which is the best option you advise to me?

My understanding is that parallel is easier to use and more general.
There is a pararrayfun function that could be appropriate to your needs,
provided that for loops are independent of each other.  If the results
of your loop n depends on the results of loop n-1, you are out of luck
with any parallel method.  Parallel uses multiprocessing on several
cores, which is very efficient if you can dispatch many loops to each
core.

MPI is more appropriate for low-level parallel computing, and I think is
more appropriate for clusters rather than single machines.

--
Francesco Potortì (ricercatore)        Voice:  +39.050.621.3058
ISTI - Area della ricerca CNR          Mobile: +39.348.8283.107
via G. Moruzzi 1, I-56124 Pisa         Skype:  wnlabisti
(entrance 20, 1st floor, room C71)     Web:    http://fly.isti.cnr.it


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Which is the best way to parallelize a loop in octave

dariodematties
Thanks Francesco
Loading...