caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* OCaml is broken
@ 2009-12-19  9:30 Erik Rigtorp
  2009-12-19  9:42 ` [Caml-list] " Stéphane Glondu
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Erik Rigtorp @ 2009-12-19  9:30 UTC (permalink / raw)
  To: caml-list

Hi!

I've been using Erlang and C++ to build a soft real-time system. As
the project has evolved we've needed to write more and more of the
code in C++ in order to achieve our latency requirements. But C++ is
not as performant as you might think until you start to write your own
allocators and cache aligning mallocs and datastructures. I've never
liked C++ so I decided to try OCaml and built a simple 100 line
program to build order books for Nasdaq. Turns out OCaml has really
competitive performance while being a really nice language.

However OCaml is broken! It does not provide any support for multicore
architectures, which by now is considered a bug! It doesn't even allow
me to load multiple runtimes into one C program.

Please fix OCaml! The first step would be to support multiple runtimes
running in the same process communicating using message queues.

Erik Rigtop


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] OCaml is broken
  2009-12-19  9:30 OCaml is broken Erik Rigtorp
@ 2009-12-19  9:42 ` Stéphane Glondu
  2009-12-19 10:38 ` Sylvain Le Gall
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Stéphane Glondu @ 2009-12-19  9:42 UTC (permalink / raw)
  To: Erik Rigtorp; +Cc: caml-list

Erik Rigtorp a écrit :
> However OCaml is broken! It does not provide any support for multicore
> architectures, which by now is considered a bug! [...]

You might be interested by OCaml4Multicore:

  http://www.algo-prog.info/ocmc/web/

It's still experimental, but its authors would love to have feedback.


Best regards,

-- 
Stéphane


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: OCaml is broken
  2009-12-19  9:30 OCaml is broken Erik Rigtorp
  2009-12-19  9:42 ` [Caml-list] " Stéphane Glondu
@ 2009-12-19 10:38 ` Sylvain Le Gall
  2009-12-19 18:22 ` [Caml-list] " Thomas Fischbacher
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Sylvain Le Gall @ 2009-12-19 10:38 UTC (permalink / raw)
  To: caml-list

On 19-12-2009, Erik Rigtorp <erik@rigtorp.com> wrote:
>
> Please fix OCaml! The first step would be to support multiple runtimes
> running in the same process communicating using message queues.
>

You should take a look at:
http://jocaml.inria.fr/

Regards,
Sylvain Le Gall


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] OCaml is broken
  2009-12-19  9:30 OCaml is broken Erik Rigtorp
  2009-12-19  9:42 ` [Caml-list] " Stéphane Glondu
  2009-12-19 10:38 ` Sylvain Le Gall
@ 2009-12-19 18:22 ` Thomas Fischbacher
  2009-12-20 16:18 ` Gerd Stolpmann
  2010-01-01 16:25 ` [Caml-list] " Florian Weimer
  4 siblings, 0 replies; 11+ messages in thread
From: Thomas Fischbacher @ 2009-12-19 18:22 UTC (permalink / raw)
  To: Erik Rigtorp; +Cc: caml-list


Erik Rigtorp wrote:

> However OCaml is broken! It does not provide any support for multicore
> architectures, which by now is considered a bug! It doesn't even allow
> me to load multiple runtimes into one C program.

My washing machine is broken. I cannot bake Pizza with it.

-- 
best regards,
Thomas Fischbacher
t.fischbacher@soton.ac.uk


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] OCaml is broken
  2009-12-19  9:30 OCaml is broken Erik Rigtorp
                   ` (2 preceding siblings ...)
  2009-12-19 18:22 ` [Caml-list] " Thomas Fischbacher
@ 2009-12-20 16:18 ` Gerd Stolpmann
  2009-12-21 19:55   ` Erik Rigtorp
  2010-01-01 16:25 ` [Caml-list] " Florian Weimer
  4 siblings, 1 reply; 11+ messages in thread
From: Gerd Stolpmann @ 2009-12-20 16:18 UTC (permalink / raw)
  To: Erik Rigtorp; +Cc: caml-list


Am Samstag, den 19.12.2009, 10:30 +0100 schrieb Erik Rigtorp:
> Hi!
> 
> I've been using Erlang and C++ to build a soft real-time system. As
> the project has evolved we've needed to write more and more of the
> code in C++ in order to achieve our latency requirements. But C++ is
> not as performant as you might think until you start to write your own
> allocators and cache aligning mallocs and datastructures. I've never
> liked C++ so I decided to try OCaml and built a simple 100 line
> program to build order books for Nasdaq. Turns out OCaml has really
> competitive performance while being a really nice language.
> 
> However OCaml is broken! It does not provide any support for multicore
> architectures, which by now is considered a bug! It doesn't even allow
> me to load multiple runtimes into one C program.
> 
> Please fix OCaml! The first step would be to support multiple runtimes
> running in the same process communicating using message queues.

As you mention order books and soft-realtime, I guess your main concern
are minimized latencies. Well, you need then a style of parallelism that
focuses on a certain processing path for a single data item, and where
the latency is minimized by using several cores. I think ocaml is
unsuited for this type of task, but please don't call ocaml "broken"
because of this. Other types of parallelism can be well supported,
especially when you can accept multi-processing, and when you focus on
larger processing paths and partitioned data sets.

Gerd
-- 
------------------------------------------------------------
Gerd Stolpmann, Bad Nauheimer Str.3, 64289 Darmstadt,Germany 
gerd@gerd-stolpmann.de          http://www.gerd-stolpmann.de
Phone: +49-6151-153855                  Fax: +49-6151-997714
------------------------------------------------------------


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] OCaml is broken
  2009-12-20 16:18 ` Gerd Stolpmann
@ 2009-12-21 19:55   ` Erik Rigtorp
  2009-12-21 21:21     ` Sylvain Le Gall
  0 siblings, 1 reply; 11+ messages in thread
From: Erik Rigtorp @ 2009-12-21 19:55 UTC (permalink / raw)
  To: Gerd Stolpmann; +Cc: caml-list

On Sun, Dec 20, 2009 at 17:18, Gerd Stolpmann <gerd@gerd-stolpmann.de> wrote:
> As you mention order books and soft-realtime, I guess your main concern
> are minimized latencies. Well, you need then a style of parallelism that
> focuses on a certain processing path for a single data item, and where
> the latency is minimized by using several cores. I think ocaml is
> unsuited for this type of task, but please don't call ocaml "broken"

It is actually perfectly suitable for this, as long as you can run
multiple runtimes and share data via low latency message passing. This
is kind of how Erlang does it, with a separate heap for each
lightweight thread (called process in Erlang).

> because of this. Other types of parallelism can be well supported,
> especially when you can accept multi-processing, and when you focus on
> larger processing paths and partitioned data sets.

I agree, but fork() and pipe() has problems.

1. Latency is high ~10µs when tuned on Solaris, substantially higher
>100µs on Linux.
2. Runtimes don't share memory so data has to be copied. This is fine
for small datasets or streaming data, like passing order book updates
around.

Even if I want to process a dataset and partition it and sends the
work to multiple processes there is no framework in OCaml for me to
use.

Erik


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: OCaml is broken
  2009-12-21 19:55   ` Erik Rigtorp
@ 2009-12-21 21:21     ` Sylvain Le Gall
  2009-12-29 12:00       ` [Caml-list] " Richard Jones
  0 siblings, 1 reply; 11+ messages in thread
From: Sylvain Le Gall @ 2009-12-21 21:21 UTC (permalink / raw)
  To: caml-list

On 21-12-2009, Erik Rigtorp <erik@rigtorp.com> wrote:
> On Sun, Dec 20, 2009 at 17:18, Gerd Stolpmann <gerd@gerd-stolpmann.de> wrote:
>
> Even if I want to process a dataset and partition it and sends the
> work to multiple processes there is no framework in OCaml for me to
> use.
>

There are many frameworks at hand, just search for it:
- ocamlp3l
- jocaml
- RPC with ocamlnet
- cothreads
- Ancient
- OCamlMPI

They maybe not look like exactly what you want, but they are close
enough to do what you want.

FYI, I have created a commercial application for sorting/processing big
files using OCaml. It runs using multi-processes as fast as other
commercial programs that do the same thing. In particular, it runs
faster than another well-known program written in C, using threads on
Windows and on Linux. 

Regards,
Sylvain Le Gall


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] Re: OCaml is broken
  2009-12-21 21:21     ` Sylvain Le Gall
@ 2009-12-29 12:00       ` Richard Jones
  0 siblings, 0 replies; 11+ messages in thread
From: Richard Jones @ 2009-12-29 12:00 UTC (permalink / raw)
  To: Sylvain Le Gall; +Cc: caml-list

On Mon, Dec 21, 2009 at 09:21:09PM +0000, Sylvain Le Gall wrote:
> On 21-12-2009, Erik Rigtorp <erik@rigtorp.com> wrote:
> > On Sun, Dec 20, 2009 at 17:18, Gerd Stolpmann <gerd@gerd-stolpmann.de> wrote:
> >
> > Even if I want to process a dataset and partition it and sends the
> > work to multiple processes there is no framework in OCaml for me to
> > use.
> >
> 
> There are many frameworks at hand, just search for it:
> - ocamlp3l
> - jocaml
> - RPC with ocamlnet
> - cothreads
> - Ancient
> - OCamlMPI

Since the OP is interested in latencies, he may also want to look at
the tools lower down the stack for pinning processes and interrupts to
physical CPUs (eg. Tuna http://userweb.kernel.org/~acme/tuna/), and
also at RT kernels.

Red Hat is funding a large amount of research in this area under the
general brand name of MRG (Messaging, Real time and Grid computing):

http://www.redhat.com/mrg/

and we're doing this in partnership with some very large banks.

None of that is really specific to OCaml.  In fact the banks tend to
use Java(!)

Rich.

-- 
Richard Jones
Red Hat


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] OCaml is broken
  2009-12-19  9:30 OCaml is broken Erik Rigtorp
                   ` (3 preceding siblings ...)
  2009-12-20 16:18 ` Gerd Stolpmann
@ 2010-01-01 16:25 ` Florian Weimer
  4 siblings, 0 replies; 11+ messages in thread
From: Florian Weimer @ 2010-01-01 16:25 UTC (permalink / raw)
  To: Erik Rigtorp; +Cc: caml-list

* Erik Rigtorp:

> However OCaml is broken! It does not provide any support for multicore
> architectures, which by now is considered a bug!

The run-time library is sufficiently small so that you can run
multiple processes in parallel.  They will even share the code and
constant data.

> It doesn't even allow me to load multiple runtimes into one C
> program.

That should perhaps be fixed, yes.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: OCaml is broken
  2009-12-20 19:38     ` Jon Harrop
@ 2009-12-21 12:26       ` Mihamina Rakotomandimby
  0 siblings, 0 replies; 11+ messages in thread
From: Mihamina Rakotomandimby @ 2009-12-21 12:26 UTC (permalink / raw)
  To: caml-list

> Jon Harrop <jon@ffconsultancy.com> :
> > Two cores is standard by 
> > now, I'm used to 8, next year 32 and so on. OCaml will only become
> > more and more irrelevant. I hate to see that happening.  
> 
> Me too. The OCaml language will continue to kick ass for some time to
> come but INRIA's implementation is no longer competitively performant
> for many tasks. However, open source offerings are all quite dire,
> particularly stand-alone ones.

That seems dark...

-- 
       Architecte Informatique chez Blueline/Gulfsat:
    Administration Systeme, Recherche & Developpement
                +261 34 29 155 34 / +261 33 11 207 36


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: OCaml is broken
@ 2009-12-19 19:38 Jeff Shaw
  2009-12-20  4:43 ` [Caml-list] " Jon Harrop
  0 siblings, 1 reply; 11+ messages in thread
From: Jeff Shaw @ 2009-12-19 19:38 UTC (permalink / raw)
  To: caml-list

My understanding is that since jocaml uses the regular ocaml runtime, it 
is also not multicore enabled.

Haskell is a functional language that has good performance that can use 
multiple processors, but the learning curve is steeper and higher.

OCaml is a close relative of Standard ML, so there might be some 
implementation of SML that you like. MLTon might allow multicore use, 
but I'm not sure how mature it is. SML/NJ has a library or language 
extension called Concurrent ML, but I think SML/NJ might not use 
multiple processors.

Note that if you're not using a lot of threads, you can use Unix.fork to 
do true multithreaded programming ocaml.


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2010-01-01 16:25 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-19  9:30 OCaml is broken Erik Rigtorp
2009-12-19  9:42 ` [Caml-list] " Stéphane Glondu
2009-12-19 10:38 ` Sylvain Le Gall
2009-12-19 18:22 ` [Caml-list] " Thomas Fischbacher
2009-12-20 16:18 ` Gerd Stolpmann
2009-12-21 19:55   ` Erik Rigtorp
2009-12-21 21:21     ` Sylvain Le Gall
2009-12-29 12:00       ` [Caml-list] " Richard Jones
2010-01-01 16:25 ` [Caml-list] " Florian Weimer
2009-12-19 19:38 Jeff Shaw
2009-12-20  4:43 ` [Caml-list] " Jon Harrop
2009-12-20 12:21   ` [***SPAM*** Score/Req: 10.1/8.0] " Erik Rigtorp
2009-12-20 19:38     ` Jon Harrop
2009-12-21 12:26       ` Mihamina Rakotomandimby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).