octave-maintainers
[Top][All Lists]
Advanced

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

Re: Using OpenMP in Octave


From: Søren Hauberg
Subject: Re: Using OpenMP in Octave
Date: Mon, 29 Mar 2010 09:29:04 -0700

man, 29 03 2010 kl. 11:50 +0200, skrev Jaroslav Hajek:
> Unfortunately, it confirms what I anticipated: the elementary
> operations scale poorly. Memory bandwidth is probably the real limit
> here. The mappers involve more work per cycle and hence scale much
> better.

Bummer :-(  Not all that surprising, but still...

> I know Matlab does
> it, but I think it's just fancy stuff, to convince customers that new
> versions add significant value.

The sad part is that it actually seems to work. I've heard several
people praising the parallel stuff Matlab does even if they haven't
actually benchmarked it.

> One area where multithreading really helps is the complicated mappers,
> as shown by the second part of the benchmark.
> Still, I think we should carefully consider how to best provide parallelism.
> For instance, I would be happy with explicit parallelism, something
> like pararrayfun from the OctaveForge package, so that I could write:
> 
> pararrayfun (3, @erf, x, "ChunksPerProc", 100); # parallelize on 3
> threads, splitting the array to 300 chunks.
> 
> Note that if I was about to parallelize a larger section of code that
> uses erf, I could do
> 
> erf = @(x) pararrayfun (3, @erf, x, "ChunksPerProc", 100); # use
> parallel erf for the rest of the code

This approach could work. One potential annoyance is that you would have
to do this in every function that uses 'erf' as the function handle is a
local variable. In some situations this type of fine-grained control is
great, but often you just want to be able to say, "parallellise stuff
for me". This is why OpenMP is so successful even though many experience
sub-optimal performance.

> If we really insisted that the builtin functions must support
> parallelism, I say it must fulfill at least the following:
> 
> 1. an easy way of temporarily disabling it must exist (for high-level
> parallel constructs like parcellfun, it should be done automatically)
> 2. the tuning constants should be customizable.

I agree with this. It should be said that OpenMP allows you to control
some stuff (like number of used cores) at run-time.

Soren



reply via email to

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