Forums

Getting Octave to Multi-core/Parallel Process

Started by Randy Yates August 30, 2009
I'm noticing that Octave doesn't utilize my new multicore
CPU. Has anyone been successful in doing so? I'd appreciate
any hints or tricks.

@GNU Octave, version 3.0.5
Linux localhost.localdomain 2.6.29.6-217.2.16.fc11.x86_64 #1 SMP Mon Aug 24 17:17:40 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
-- 
Randy Yates                      % "How's life on earth? 
Digital Signal Labs              %  ... What is it worth?" 
mailto://yates@ieee.org          % 'Mission (A World Record)', 
http://www.digitalsignallabs.com % *A New World Record*, ELO
Randy Yates wrote:

> I'm noticing that Octave doesn't utilize my new multicore > CPU.
Having a singel program execute on multple cores, requires that program be specifically designed and coded to run on multiple cores. For things programmed in imperative languages like C and C++ (eg Octave) there is no "sufficiently smart compiler" that can turn code written to run on a single processor into a multicore executable. However, Octave does have this (i haven't tried it): http://octave.sourceforge.net/multicore/index.html which I suspect is a bunch of additions to the Octave library to allow Octave users to write code that exploits multiple cores. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
Erik de Castro Lopo <erikd@mega-nerd.com> writes:

> Randy Yates wrote: > >> I'm noticing that Octave doesn't utilize my new multicore >> CPU. > > Having a singel program execute on multple cores, requires that > program be specifically designed and coded to run on multiple > cores.
That's quite a generalization, and I would say slightly in error. For example, if the program itself (Octave) was not parallelized but the libraries it depends on (LAPACK) were, one would still potentially see parallelized performance.
> For things programmed in imperative languages like C and C++ > (eg Octave) there is no "sufficiently smart compiler" that can > turn code written to run on a single processor into a multicore > executable.
Yes, but again as I intimated above, if I'm performing a (1M x 4) * (4 x 4) multiplication, it would be possible to parallelize that in the library (I would think).
> However, Octave does have this (i haven't tried it): > > http://octave.sourceforge.net/multicore/index.html > > which I suspect is a bunch of additions to the Octave library > to allow Octave users to write code that exploits multiple > cores.
I hadn't seen that. Thanks Erik! -- Randy Yates % "Midnight, on the water... Digital Signal Labs % I saw... the ocean's daughter." mailto://yates@ieee.org % 'Can't Get It Out Of My Head' http://www.digitalsignallabs.com % *El Dorado*, Electric Light Orchestra
Randy Yates wrote:

> > Having a singel program execute on multple cores, requires that > > program be specifically designed and coded to run on multiple > > cores. > > That's quite a generalization, and I would say slightly in error. > For example, if the program itself (Octave) was not parallelized > but the libraries it depends on (LAPACK) were, one would still > potentially see parallelized performance.
The idea of "hiding the parallelism in the library" is a great idea in theory, but often does not work in practice. LAPACK is one area where it may work, but much code that uses LAPACK is little more than a bit of setup code which then calls into LAPACK which simplifies the problem considerably.
> > For things programmed in imperative languages like C and C++ > > (eg Octave) there is no "sufficiently smart compiler" that can > > turn code written to run on a single processor into a multicore > > executable. > > Yes, but again as I intimated above, if I'm performing a (1M x 4) * (4 x 4) > multiplication, it would be possible to parallelize that in the library > (I would think).
I think my comment was a reflection of the stuff I've been coding over the last couple of years. In particular I've been coding much less numerical code and much more general programming where parallelism is hard. Even some mostly numerical code is hard to parallelize. There is an effort to make Csound run on multiple cores, but from what I heard, the changes needed to make this possible are rather invasive.
> > However, Octave does have this (i haven't tried it): > > > > http://octave.sourceforge.net/multicore/index.html > > > > which I suspect is a bunch of additions to the Octave library > > to allow Octave users to write code that exploits multiple > > cores. > > I hadn't seen that.
First hit on Google :-). Cheers, Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
On Sep 1, 9:23&#2013266080;pm, Erik de Castro Lopo <er...@mega-nerd.com> wrote:
> Randy Yates wrote: > > I'm noticing that Octave doesn't utilize my new multicore > > CPU. > > Having a singel program execute on multple cores, requires that > program be specifically designed and coded to run on multiple > cores. > > For things programmed in imperative languages like C and C++ > (eg Octave) there is no "sufficiently smart compiler" that can > turn code written to run on a single processor into a multicore > executable.
I believe this is false as the Microsoft Visual C++ compiler supports the OpenMP spec at the Professional Edition level (I using it with the 2005 edition). -Mike Goodrich
M. S. Goodrich wrote:

> On Sep 1, 9:23&nbsp;pm, Erik de Castro Lopo <er...@mega-nerd.com> wrote: > > > > For things programmed in imperative languages like C and C++ > > (eg Octave) there is no "sufficiently smart compiler" that can > > turn code written to run on a single processor into a multicore > > executable. > > > I believe this is false as the Microsoft Visual C++ compiler supports > the OpenMP spec at the Professional Edition level (I using it with the > 2005 edition).
I think you should read what I wrote. With OpenMP, you the programmer is using the OpenMP API to tell the compiler how to parallelize the problem. The compiler is not doing it for you. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/