From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id B5DA37FB0A for ; Fri, 28 Nov 2014 23:20:57 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of jun.lambda@gmail.com) identity=pra; client-ip=209.85.213.172; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jun.lambda@gmail.com"; x-sender="jun.lambda@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of jun.lambda@gmail.com designates 209.85.213.172 as permitted sender) identity=mailfrom; client-ip=209.85.213.172; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jun.lambda@gmail.com"; x-sender="jun.lambda@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-ig0-f172.google.com) identity=helo; client-ip=209.85.213.172; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jun.lambda@gmail.com"; x-sender="postmaster@mail-ig0-f172.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AusBAN30eFTRVdWsm2dsb2JhbABbg1dYBMcKhk4CgQMHFgEBAQEBEQEBAQEBBgsLCRQuhAIBAQEDARIRHQEbHQEDDAYFCw0CAiYCAiEBAREBBQEcBhMiiAgBAwkJDbAHPTGLM4FsgwqKGgoZJw1ahSgBAQEBBgEBAQEBAQEVAQUOgSCNFYIFMweCdYFTBZVShHSCAYEujUeCTIIGGCiFOD4wAQGCRQEBAQ X-IPAS-Result: AusBAN30eFTRVdWsm2dsb2JhbABbg1dYBMcKhk4CgQMHFgEBAQEBEQEBAQEBBgsLCRQuhAIBAQEDARIRHQEbHQEDDAYFCw0CAiYCAiEBAREBBQEcBhMiiAgBAwkJDbAHPTGLM4FsgwqKGgoZJw1ahSgBAQEBBgEBAQEBAQEVAQUOgSCNFYIFMweCdYFTBZVShHSCAYEujUeCTIIGGCiFOD4wAQGCRQEBAQ X-IronPort-AV: E=Sophos;i="5.07,479,1413237600"; d="scan'208";a="110148872" Received: from mail-ig0-f172.google.com ([209.85.213.172]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 28 Nov 2014 23:20:45 +0100 Received: by mail-ig0-f172.google.com with SMTP id hl2so10438246igb.5 for ; Fri, 28 Nov 2014 14:20:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=YyqCxQ7pgHFUVY67yDq5zJOlGU+iyjhI/JQ85SSvc5s=; b=qwaWCsdvG8dZ2roqcXsS5fX02jWjvwQvwT4tXs1joXEsPlzRTk4WdPHLwnjdlgXvrL VmpXmys71+s9CVgpZaF1V6WeIrOGNVYKgRT5doFMazD+dLEwQ/Ah57jAkYTbx0EgEGWW hyWEZ4OMHcllYM04DueWyLofiZNlIddSUn1PUxZJTNO+ioH7L8/VMaGYT2gs0O1vmA6L zZ5S5WoxJUnSaXuArFriC/6KZg72T/aW0KzVEihfu5JdYvt7bwy4lGna+wqUNJInSpSa Tz3+Hl77C7/ZhQ1qYqdae4QBS6ZJbo1aGAADEOOfCVrDKMXKPE354Zqx6Q4hD9V4tszj 2eKA== X-Received: by 10.43.89.68 with SMTP id bd4mr10120026icc.63.1417213244277; Fri, 28 Nov 2014 14:20:44 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.128.93 with HTTP; Fri, 28 Nov 2014 14:20:14 -0800 (PST) In-Reply-To: References: <20141128133958.GA6607@tbrk.org> From: Jun Inoue Date: Fri, 28 Nov 2014 23:20:14 +0100 Message-ID: To: Gabriel Scherer Cc: Timothy Bourke , OCaml list , Marc Pouzet Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] Sundials/ML 2.5.0 On Fri, Nov 28, 2014 at 10:05 PM, Jun Inoue wrote: > Thank you for sharing this interesting information, Gabriel! We > benchmarked the code exclusively with 4.01.0 and didn't know about the > performance boost in printf. > > I just measured the performance with > examples/kinsol/serial/kinFerTron_dns.ml, which was one of the > examples that had the most pronounced effect. As you suggest, the > numbers are a lot closer with 4.02.1. The median wall-clock times of > 10 runs were: > > printf, OCaml 4.02.1: 1.76[s] > print_*, OCaml 4.02.1: 1.62[s] > printf, OCaml 4.01.0: 2.04[s] > print_*, OCaml 4.01.0: 1.70[s] > > The overhead of using printf is about 8% in 4.02.1, as opposed to > about 20% in 4.01.0. So in 4.02 the effect is noticeably smaller, > though not unmeasurable. We should note this in the doc in a future > release. Correction: the numbers are the medians of the ratios between OCaml and C (wall-clock time). The C version takes right about 1[s], so the conclusion is morally the same, though. > > FYI, the experiment can be reproduced as follows (in bash syntax), > using the attached patch (referred to as > /tmp/kinFerTron_dns_printf.diff below): > > # Start at the root of the source tree. > opam switch 4.02.1; eval `opam config env` > ./configure && make clean all > cd examples/kinsol/serial > # Measure without modification. > make PERF_DATA_POINTS=3D10 kinFerTron_dns.opt.perf > ../../utils/crunchperf -m kinFerTron_dns.opt.perf > > no-printf-4.02.1-kinFerTron_dns.opt.perf > # Apply patch and measure again. > patch -p4 < /tmp/kinFerTron_dns_printf.diff > make PERF_DATA_POINTS=3D10 kinFerTron_dns.opt.perf > ../../utils/crunchperf -m kinFerTron_dns.opt.perf > > printf-4.02.1-kinFerTron_dns.opt.perf > # Undo changes. > patch -p4 -R < /tmp/kinFerTron_dns_printf.diff > > cd ../../.. > # Back at the root of the source tree. > opam switch 4.01.0; eval `opam config env` > # (Basically the same thing as above) > ./configure && make clean all > cd examples/kinsol/serial > make PERF_DATA_POINTS=3D10 kinFerTron_dns.opt.perf > ../../utils/crunchperf -m kinFerTron_dns.opt.perf > > no-printf-4.01.0-kinFerTron_dns.opt.perf > patch -p4 < /tmp/kinFerTron_dns_printf.diff > make PERF_DATA_POINTS=3D10 kinFerTron_dns.opt.perf > ../../utils/crunchperf -m kinFerTron_dns.opt.perf > > printf-4.01.0-kinFerTron_dns.opt.perf > > # Summarize results > for i in *kinFerTron_dns.opt.perf; do printf "\n[$i]\n"; > ../../utils/crunchperf -s $i; done > > On Fri, Nov 28, 2014 at 6:44 PM, Gabriel Scherer > wrote: >> Thanks for the significant effort put in documenting the bindings >> (and, of course, the cool software and research); your "information >> and documentation" page is impressive. >> >> The page has a very interesting performance comparison of numeric code >> partly or fully written in OCaml (using bigarrays of floats) -- and >> the not-so-surprising results is that the run times of the OCaml >> programs are between 100% and 200% of the run time of the reference C >> implementation. >> >> ( http://inria-parkas.github.io/sundialsml/perf.opt.png ) >> >> I'm curious about this specific part of the explanation: >> >>> For instance, some OCaml versions spend a significant fraction of their= time >>> in printf, and we were able to lower their ratios by instead using prin= t_string and print_int. >> >> The new 4.02 implementation of formats, due to Beno=C3=AEt Vaugon, should >> be significantly faster (in my experience they match the performance of = the >> less-readable print_* sequence in most situations). Did you try those >> OCaml versions with 4.02? >> >> On Fri, Nov 28, 2014 at 2:39 PM, Timothy Bourke wrote: >>> We are pleased to announce Sundials/ML, an OCaml interface to the >>> Sundials suite of numerical solvers (CVODE, CVODES, IDA, IDAS, KINSOL). >>> >>> Information and documentation: http://inria-parkas.github.io/sundialsml/ >>> Source code (BSD): https://github.com/inria-parkas/sundials= ml >>> >>> opam install sundialsml # (requires Sundials 2.5.0) >>> >>> We gratefully acknowledge the original authors of Sundials, and the >>> support of the ITEA 3 project 11004 MODRIO (Model driven physical >>> systems operation), Inria, and the Departement d'Informatique de l'ENS. >>> >>> Timothy Bourke, Jun Inoue, and Marc Pouzet. >>> > > > > -- > Jun Inoue --=20 Jun Inoue