caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] flambda optimization settings
@ 2016-05-12 16:13 Nils Becker
  2016-05-12 18:25 ` Gabriel Scherer
  0 siblings, 1 reply; 6+ messages in thread
From: Nils Becker @ 2016-05-12 16:13 UTC (permalink / raw)
  To: caml-list

hi,

i'm happy to report one more data point on flambda speedup.

(best of 3, wall clock time, 4 cores running with parmap)
-Oclassic 18.5s
-O2 	  17.0s
-O3	  14.2s

so, a nice 20% speedup with no work.

this brings me to my question: given that O2 vs O3 does seem to matter,
is it actually important at what optimization level linked libraries are
compiled on a +flambda switch?
who controls that, the package author or the user?

n.


ps, full disclosure:

this is based on code that does stochastic simulation (basically
euler-maruyama forward integration), uses Gsl for heavy random number
generation but also does some floating point arithmetic in the inner
loop, and uses exceptions as part of control flow.



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

* Re: [Caml-list] flambda optimization settings
  2016-05-12 16:13 [Caml-list] flambda optimization settings Nils Becker
@ 2016-05-12 18:25 ` Gabriel Scherer
  2016-05-12 19:55   ` Nils Becker
  0 siblings, 1 reply; 6+ messages in thread
From: Gabriel Scherer @ 2016-05-12 18:25 UTC (permalink / raw)
  To: Nils Becker; +Cc: caml users

My understanding is that -Oclassic does not compile with the
pre-flambda compiler, but rather it tunes flambda heuristics to behave
more or less like the other compiler. The goal was to reach a point in
the optimization-vs-compile-time spectrum that is comparable to the
other compiler, but I'm not sure it was actually reached yet.

Thus, it would be interesting and important to also compare with the
code produced by a 4.03 switch compiled without flambda.

(Also, it would be interesting to have reports on compile time.)

On Thu, May 12, 2016 at 12:13 PM, Nils Becker
<nils.becker@bioquant.uni-heidelberg.de> wrote:
> hi,
>
> i'm happy to report one more data point on flambda speedup.
>
> (best of 3, wall clock time, 4 cores running with parmap)
> -Oclassic 18.5s
> -O2       17.0s
> -O3       14.2s
>
> so, a nice 20% speedup with no work.
>
> this brings me to my question: given that O2 vs O3 does seem to matter,
> is it actually important at what optimization level linked libraries are
> compiled on a +flambda switch?
> who controls that, the package author or the user?
>
> n.
>
>
> ps, full disclosure:
>
> this is based on code that does stochastic simulation (basically
> euler-maruyama forward integration), uses Gsl for heavy random number
> generation but also does some floating point arithmetic in the inner
> loop, and uses exceptions as part of control flow.
>
>
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs

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

* Re: [Caml-list] flambda optimization settings
  2016-05-12 18:25 ` Gabriel Scherer
@ 2016-05-12 19:55   ` Nils Becker
  2016-05-13  8:27     ` Mark Shinwell
  0 siblings, 1 reply; 6+ messages in thread
From: Nils Becker @ 2016-05-12 19:55 UTC (permalink / raw)
  To: Gabriel Scherer; +Cc: caml users

[-- Attachment #1: Type: text/plain, Size: 653 bytes --]


> Thus, it would be interesting and important to also compare with the
> code produced by a 4.03 switch compiled without flambda.

coming right up

(different parameters, different machine, best of 5 -- it varies quite a
lot)

time (ocamlbuild -clean; ocamlbuild facs_run.native)
4.03.0	  1.36s
4.03.0+flambda
Oclassic  1.68s
O2	  2.1s
O3	  2.80s


the actual run: time ./facs_run.native

4.03.0	  23.3s
4.03.0+flambda
Oclassic  24.2s
O2	  22.7s
O3	  20.1s


so it seems compilation on flambda classic is still a bit slower than
non-flambda; as is the run time. the gains of O3 over non-flambda are
still significant, as is the difference O2 vs O3.

n

[-- Attachment #2: 0xF0A5C638.asc --]
[-- Type: application/pgp-keys, Size: 2678 bytes --]

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

* Re: [Caml-list] flambda optimization settings
  2016-05-12 19:55   ` Nils Becker
@ 2016-05-13  8:27     ` Mark Shinwell
  2016-05-13  8:34       ` Nils Becker
  0 siblings, 1 reply; 6+ messages in thread
From: Mark Shinwell @ 2016-05-13  8:27 UTC (permalink / raw)
  To: Nils Becker; +Cc: Gabriel Scherer, caml users

Thanks for these numbers, which I think are about in line with expectations.

At present the optimisation flags such as -O3 only need to be
specified when compilation (rather than linking) is occurring.  So if
your link command only lists previously-compiled files, there is no
need to specify such options.

Mark

On 12 May 2016 at 20:55, Nils Becker
<nils.becker@bioquant.uni-heidelberg.de> wrote:
>
>> Thus, it would be interesting and important to also compare with the
>> code produced by a 4.03 switch compiled without flambda.
>
> coming right up
>
> (different parameters, different machine, best of 5 -- it varies quite a
> lot)
>
> time (ocamlbuild -clean; ocamlbuild facs_run.native)
> 4.03.0    1.36s
> 4.03.0+flambda
> Oclassic  1.68s
> O2        2.1s
> O3        2.80s
>
>
> the actual run: time ./facs_run.native
>
> 4.03.0    23.3s
> 4.03.0+flambda
> Oclassic  24.2s
> O2        22.7s
> O3        20.1s
>
>
> so it seems compilation on flambda classic is still a bit slower than
> non-flambda; as is the run time. the gains of O3 over non-flambda are
> still significant, as is the difference O2 vs O3.
>
> n
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs

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

* Re: [Caml-list] flambda optimization settings
  2016-05-13  8:27     ` Mark Shinwell
@ 2016-05-13  8:34       ` Nils Becker
  2016-05-13  8:51         ` Mark Shinwell
  0 siblings, 1 reply; 6+ messages in thread
From: Nils Becker @ 2016-05-13  8:34 UTC (permalink / raw)
  To: Mark Shinwell; +Cc: Gabriel Scherer, caml users

[-- Attachment #1: Type: text/plain, Size: 423 bytes --]

thanks mark,

> At present the optimisation flags such as -O3 only need to be
> specified when compilation (rather than linking) is occurring.  So if
> your link command only lists previously-compiled files, there is no
> need to specify such options.

my question was more: let's say i want the best possible performance.
can i make sure that the precompiled library i am linking with is using
-O3 ? does that make sense?

[-- Attachment #2: 0xF0A5C638.asc --]
[-- Type: application/pgp-keys, Size: 2635 bytes --]

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

* Re: [Caml-list] flambda optimization settings
  2016-05-13  8:34       ` Nils Becker
@ 2016-05-13  8:51         ` Mark Shinwell
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Shinwell @ 2016-05-13  8:51 UTC (permalink / raw)
  To: Nils Becker; +Cc: Gabriel Scherer, caml users

When you say "precompiled binary", do you mean the other .cmx files?
As in, someone gives you a precompiled .cmx file, and you want to
ensure it was compiled with -O3?  If so, I don't believe there's any
way of doing that at the moment.  (At Jane Street we use a separate
module linked into all executables that records certain settings like
that so they can be printed using -version.)

Mark

On 13 May 2016 at 09:34, Nils Becker
<nils.becker@bioquant.uni-heidelberg.de> wrote:
> thanks mark,
>
>> At present the optimisation flags such as -O3 only need to be
>> specified when compilation (rather than linking) is occurring.  So if
>> your link command only lists previously-compiled files, there is no
>> need to specify such options.
>
> my question was more: let's say i want the best possible performance.
> can i make sure that the precompiled library i am linking with is using
> -O3 ? does that make sense?

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

end of thread, other threads:[~2016-05-13  8:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-12 16:13 [Caml-list] flambda optimization settings Nils Becker
2016-05-12 18:25 ` Gabriel Scherer
2016-05-12 19:55   ` Nils Becker
2016-05-13  8:27     ` Mark Shinwell
2016-05-13  8:34       ` Nils Becker
2016-05-13  8:51         ` Mark Shinwell

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).