Version française
Home     About     Download     Resources     Contact us    
Browse thread
ocaml, simd, & fftwgel RE: [Caml-list] Caml productivity.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Gurr, David (MED, self) <David.Gurr@m...>
Subject: ocaml, simd, & fftwgel RE: [Caml-list] Caml productivity.



> From: Travis Bemann:
> On Mon, Jul 29, 2002 at 10:13:24AM +0200, Nicolas Cannasse wrote:
> > > I agree that the C interface is pretty nice. However,
> > > how do would you use SIMD math instructions on the
> > > x86? Would you always call C-routines just to make use
> > > of SIMD or multimedia-instructions? What is the
> > > overhead for calling a function that is executing a
> > > few assembly instructions? Is it even possible to
> > > create a solid division line between "low-level" and
> > > "high-level" code?
> >
> > Yes it is.
> > Actually if you need to perform alot of SIMD instructions each frame
> > (involving zounds of C calls), you can try to group them in 
> one-C-call that
> > will do the job in one time. That's matter of architecture 
> and choices...
> > not always obvious :)
> 
> Note that most C or C++ compilers won't do this either, with the
> exception of some specialized vector parallelizing compilers (such as
> those used to compile code on vector supercomputers).  If you really
> need SIMD instructions, you'd probably need to hand-code it in
> assembly, no matter what language you're using.

IMHO:

High performance numerical code esp using SIMD or multiprocessor is
beyond the reach of hand written assembly or hand written C.  Very
heavy template based C++ almost works but odds are you will run into
C++ compiler bugs.  The best thing known at the present are special
purpose optimizing compilers.  The best known of these is fftgen, the
compiler that underlies FFTW and it is written in ocaml.  Others like
it are Atlas and Spiral.  Of special note is a versions of FFTW that
generates SIMD code for AMD Athlons:
http://www.complang.tuwien.ac.at/skral/fftwgel.html
Perhaps Dr Kral could explain more about fftwgel and the merits of
writting 
high performance code using ocaml.

About memory allocation, real time code should not be doing memory
allocation in the real time section.  For many things that you need
to do in realtime, the ocaml code does not allocate so allocation
is not issue.  If you need allocation control, write a C allocator.
You lose some of the safety of ocaml but it is better than writting
the whole thing in C.  And there is the possiblity of GC-free functional
programming as done in MLKit4.  This is SML not ocaml.  I would imagine
that the technique could be used in ocaml.

-D 
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners