octave-maintainers
[Top][All Lists]
Advanced

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

Re: Octave optimizations (use liboil?)


From: Jaroslav Hajek
Subject: Re: Octave optimizations (use liboil?)
Date: Tue, 16 Feb 2010 08:08:51 +0100

On Tue, Feb 16, 2010 at 5:25 AM, John Swensen <address@hidden> wrote:
> I was recently looking at liboil to do some fast casting and copying and 
> began to wonder whether Octave could benefit from something like this.  I 
> know that many of the computations of Octave are optimized if compiled 
> against optimized BLAS/LAPACK implementations (e.g. Atlas), but what other 
> parts of Octave are already optimized and what parts are not.

You have all the sources to find out. Or you can ask about particular
pieces, but don't expect me dump an exhaustive list at you.

> I assume that when I round floating point values and then use them as indices 
> into an image, there is a cast going on somewhere there.

Yes. In fact, it's not just a cast, also check for positive integers.
It all happens in a single loop. See idx-vector.cc,
idx_vector::idx_vector_rep::idx_vector_rep (const Array<T>&).

> Also, anytime I do an explicit typecast it might benefit.

Really? If the cast is done through a simple C++ for loop, I wonder
what is it that is internally done in liboil and that the compiler
can't do. Of course that depends on the compiler, but they're steadily
improving.

> The nice thing about liboil is that it is optimized for a set of CPUs that 
> represent the majority of users.
>
> Is there a benefit to incorporating something like this into Octave?

Maybe, maybe not. It's really difficult to say. I think lots of the
optimizations used in liboil (loop unrolling, vectorization) can also
be handled by compilers themselves.
One area where I would really like to see an optimized external
library handling things is the saturated integer arithmetics. This is
currently coded in C++ and although it uses bit tricks for speed
(based on HAVE_FAST_INT_OPS), I think we could still get more speed by
utilizing some specialized SSE instructions. Matlab's integer
arithmetics is faster in many cases, so I suppose they do.
Unfortunately, by a quick glance this doesn't seem to be handled by liboil.

-- 
RNDr. Jaroslav Hajek, PhD
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



reply via email to

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