* HLVM?
@ 2009-09-26 16:33 David McClain
2009-09-26 17:26 ` [Caml-list] HLVM? Jon Harrop
2009-09-26 20:23 ` HLVM? Sylvain Le Gall
0 siblings, 2 replies; 4+ messages in thread
From: David McClain @ 2009-09-26 16:33 UTC (permalink / raw)
To: caml-list
Hello Jon,
I searched around for information on HLVM, and what, in particular,
makes it so well suited for scientific computing. I also have a long-
standing interest in scientific computing and OCaml, dating back to
1999 when I created my NML system.
However, wherever I found a reference to the HLVM architecture, all I
really found was a short blurb telling me to subscribe to your OCaml
Journal.
Can you provide some gratis information about what makes HLVM so well
suited to scientific computing? Something that might prompt one to
actually subscribe to your journal?
Cheers,
Dr. David McClain
dbm@refined-audiometrics.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] HLVM?
2009-09-26 16:33 HLVM? David McClain
@ 2009-09-26 17:26 ` Jon Harrop
2009-09-26 20:23 ` HLVM? Sylvain Le Gall
1 sibling, 0 replies; 4+ messages in thread
From: Jon Harrop @ 2009-09-26 17:26 UTC (permalink / raw)
To: caml-list
On Saturday 26 September 2009 17:33:41 David McClain wrote:
> Hello Jon,
>
> I searched around for information on HLVM, and what, in particular,
> makes it so well suited for scientific computing. I also have a long-
> standing interest in scientific computing and OCaml, dating back to
> 1999 when I created my NML system.
>
> However, wherever I found a reference to the HLVM architecture, all I
> really found was a short blurb telling me to subscribe to your OCaml
> Journal.
The motivation behind the HLVM project is described here:
http://www.ffconsultancy.com/ocaml/hlvm/
> Can you provide some gratis information about what makes HLVM so well
> suited to scientific computing?
HLVM is specifically designed with scientific computing in mind and, in
particular, aims to provide a performance profile better suited to scientific
computing. Some sacrifices have been made (e.g. polymorphic recursion) but
the preliminary results are encouraging. For example, HLVM already thrashes
OCaml on most numerical benchmarks:
http://flyingfrogblog.blogspot.com/2009/03/performance-ocaml-vs-hlvm-beta-04.html
HLVM also provides native code performance directly from the REPL
out-of-the-box and offers some useful features that OCaml lacks such as
generic printing. Other numerical types (byte, sbyte, int8, uint8, int16,
uint16, int32, uint32, int64, uint64, float32, complex32, complex64) are also
easy to add and will be vastly more efficient than OCaml's.
However, HLVM is currently missing some core features. Most notably,
polymorphism and a parallel GC. I intend to implement polymorphism by adding
a monomorphization stage before JIT compilation and implement a parallel GC
along the lines of the oc4mc project's.
In essence, improvements in code generation and run-time data representation
will make HLVM several times faster than OCaml for technical computing and
improvements in parallelism will make it several times faster again. So I
expect to get at least an order of magnitude performance improvement over
OCaml in the end.
> Something that might prompt one to actually subscribe to your journal?
The OCaml Journal articles about HLVM describe the decisions that underpin
HLVM's current design and the details of how those were implemented in OCaml
using LLVM. In particular, the current OCaml Journal articles do *not*
describe how HLVM can be used for scientific computing because it is still an
experimental project and is likely to undergo major revisions (when I get to
work on it again!). In other words, the articles are aimed at language
implementors and not end users.
--
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: HLVM?
2009-09-26 16:33 HLVM? David McClain
2009-09-26 17:26 ` [Caml-list] HLVM? Jon Harrop
@ 2009-09-26 20:23 ` Sylvain Le Gall
2009-09-26 21:59 ` [Caml-list] HLVM? Jon Harrop
1 sibling, 1 reply; 4+ messages in thread
From: Sylvain Le Gall @ 2009-09-26 20:23 UTC (permalink / raw)
To: caml-list
Hello,
On 26-09-2009, David McClain <dbm@refined-audiometrics.com> wrote:
>
> Can you provide some gratis information about what makes HLVM so well
> suited to scientific computing? Something that might prompt one to
> actually subscribe to your journal?
>
If I am not wrong, you can access source code of HLVM from here:
http://hlvm.forge.ocamlcore.org
There is some source code that compiles and allows to run something (I
have not tested myself).
However, it won't give you any information about scientific computing
and HLVM...
Regards,
Sylvain Le Gall
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Caml-list] Re: HLVM?
2009-09-26 20:23 ` HLVM? Sylvain Le Gall
@ 2009-09-26 21:59 ` Jon Harrop
0 siblings, 0 replies; 4+ messages in thread
From: Jon Harrop @ 2009-09-26 21:59 UTC (permalink / raw)
To: caml-list
On Saturday 26 September 2009 21:23:32 Sylvain Le Gall wrote:
> On 26-09-2009, David McClain <dbm@refined-audiometrics.com> wrote:
> > Can you provide some gratis information about what makes HLVM so well
> > suited to scientific computing? Something that might prompt one to
> > actually subscribe to your journal?
>
> If I am not wrong, you can access source code of HLVM from here:
> http://hlvm.forge.ocamlcore.org
That is correct.
> There is some source code that compiles and allows to run something (I
> have not tested myself).
I just checked in a second version of the compiler. If you compile it in
hlvm/examples/compiler2 and run ./repl then you get a REPL:
$ svn checkout svn://svn.forge.ocamlcore.org/svnroot/hlvm
...
$ cd hlvm
$ ./compile.sh
$ cd examples/compiler2
$ ./compile.sh
57 states, 473 transitions, table size 2234 bytes
$ ./repl
# 1+2*3+4;;
- : `Int = 11
Live: 0
Took 0.076751s
# create(10, 3);;
- : `Array(`Int) = [|3; 3; 3; 3; 3; 3; 3; 3; 3; 3|]
Live: 1
Took 0.029611s
It can run OCaml programs like the following FFT implementation (from
bench.ml):
let rec zadd(((r1, i1), (r2, i2)) : (float * float) * (float * float)) : float
* float =
r1 +. r2, i1 +. i2;;
let rec zmul(((r1, i1), (r2, i2)) : (float * float) * (float * float)) : float
* float =
r1 *. r2 -. i1 *. i2, r1 *. i2 +. i1 *. r2;;
let rec aux1((i, n, a, a1, a2) : int * int * (float * float) array * (float *
float) array * (float * float) array) : unit =
if i < n/2 then
begin
a1.(i) <- a.(2*i);
a2.(i) <- a.(2*i+1);
aux1(i+1, n, a, a1, a2)
end;;
let rec aux2((k, n, a, a1, a2) : int * int * (float * float) array * (float *
float) array * (float * float) array) : unit =
if k < n/2 then
begin
let t = 4. *. pi *. float_of_int k /. float_of_int n in
a.(k) <- zadd(a1.(k), zmul(a2.(k), (cos t, -.sin t)));
aux2(k+1, n, a, a1, a2)
end;;
let rec aux3((k, n, a, a1, a2) : int * int * (float * float) array * (float *
float) array * (float * float) array) : unit =
if k < n then
begin
let t = 4. *. pi *. float_of_int k /. float_of_int n in
a.(k) <- zadd(a1.(k-n/2), zmul(a2.(k-n/2), (cos t, -.sin t)));
aux3(k+1, n, a, a1, a2)
end;;
let rec fft(a: (float * float) array) : (float * float) array =
if length a = 1 then create(1, a.(0)) else
begin
let n = length a in
let a1 = create(n/2, (0., 0.)) in
let a2 = create(n/2, (0., 0.)) in
aux1(0, n, a, a1, a2);
let a1 = fft a1 in
let a2 = fft a2 in
aux2(0, n, a, a1, a2);
aux3(n/2, n, a, a1, a2);
a
end;;
let rec test(n: int) : (float * float) array =
let a = create(n, (0., 0.)) in
a.(1) <- 1.0, 0.0;
fft a;;
test 8;;
let rec ignore(a: (float * float) array) : unit = ();;
ignore(fft(create(1048576, (0.0, 0.0))));;
--
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-09-26 21:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-26 16:33 HLVM? David McClain
2009-09-26 17:26 ` [Caml-list] HLVM? Jon Harrop
2009-09-26 20:23 ` HLVM? Sylvain Le Gall
2009-09-26 21:59 ` [Caml-list] HLVM? Jon Harrop
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox