From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 3148F80175 for ; Thu, 15 Jun 2017 08:29:04 +0200 (CEST) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=berenger@bioreg.kyushu-u.ac.jp; spf=None smtp.mailfrom=berenger@bioreg.kyushu-u.ac.jp; spf=None smtp.helo=postmaster@h4.hosting4.cc.kyushu-u.ac.jp Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of berenger@bioreg.kyushu-u.ac.jp) identity=pra; client-ip=133.5.13.5; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="berenger@bioreg.kyushu-u.ac.jp"; x-sender="berenger@bioreg.kyushu-u.ac.jp"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of berenger@bioreg.kyushu-u.ac.jp) identity=mailfrom; client-ip=133.5.13.5; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="berenger@bioreg.kyushu-u.ac.jp"; x-sender="berenger@bioreg.kyushu-u.ac.jp"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@h4.hosting4.cc.kyushu-u.ac.jp) identity=helo; client-ip=133.5.13.5; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="berenger@bioreg.kyushu-u.ac.jp"; x-sender="postmaster@h4.hosting4.cc.kyushu-u.ac.jp"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3Aq0aJkRGCzKtdjtmZPCmWNp1GYnF86YWxBRYc798d?= =?us-ascii?q?s5kLTJ78r8WwAkXT6L1XgUPTWs2DsrQf2rWQ6/iocFdDyK7JiGoFfp1IWk1Nou?= =?us-ascii?q?QttCtkPvS4D1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ed6DfOFYoQSuS21AdUfytjB?= =?us-ascii?q?oEVxzVUQZ6Sv0pYNQHq5Ge5rLAOacGf3gspEDCEDtUw8VLq52xW5TTdPaiPqDO?= =?us-ascii?q?oH7TYhBdf+AA=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0C0AAD/J0JZlwUNBYVdGwEBAQMBAQEJA?= =?us-ascii?q?QEBFgEBBAEBCgEBhBOFAIsLkGOBFZclAYk8FQEBAQEBAQEBAQEBEgEBAQEBCBY?= =?us-ascii?q?GV4IzIoJtBBEzQwImAiFLCAEBiiebOZAMgWw6h3Eag3WBC4c3KwuCOIVqgkaCY?= =?us-ascii?q?QWHQgeJdYVQhzsegUGJCIhtixiGc5R/NYEsgQlJhD0BAQgBAQEBUoIBijkBAQE?= X-IPAS-Result: =?us-ascii?q?A0C0AAD/J0JZlwUNBYVdGwEBAQMBAQEJAQEBFgEBBAEBCgE?= =?us-ascii?q?BhBOFAIsLkGOBFZclAYk8FQEBAQEBAQEBAQEBEgEBAQEBCBYGV4IzIoJtBBEzQ?= =?us-ascii?q?wImAiFLCAEBiiebOZAMgWw6h3Eag3WBC4c3KwuCOIVqgkaCYQWHQgeJdYVQhzs?= =?us-ascii?q?egUGJCIhtixiGc5R/NYEsgQlJhD0BAQgBAQEBUoIBijkBAQE?= X-IronPort-AV: E=Sophos;i="5.39,342,1493676000"; d="scan'208";a="228370152" Received: from hosting4.cc.kyushu-u.ac.jp (HELO h4.hosting4.cc.kyushu-u.ac.jp) ([133.5.13.5]) by mail3-smtp-sop.national.inria.fr with ESMTP; 15 Jun 2017 08:29:02 +0200 Received: from [192.168.2.36] (unknown [133.5.218.148]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: berenger@bioreg.kyushu-u.ac.jp) by h4.hosting4.cc.kyushu-u.ac.jp (hde-lc-postfix) with ESMTPSA id 6CD5F2AB8AC; Thu, 15 Jun 2017 15:28:57 +0900 (JST) (envelope-from berenger@bioreg.kyushu-u.ac.jp) From: Francois BERENGER To: caml-list@inria.fr Message-ID: <412f58b7-8a8b-2356-2626-e1bd010be683@bioreg.kyushu-u.ac.jp> Date: Thu, 15 Jun 2017 15:28:57 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: [Caml-list] Can this code be accelerated by porting it to SPOC, SAREK or MetaOCaml ? Dear OCaml hackers, I am wondering if some high performance OCaml experts out there can know in advance if some code can go faster by executing it on a GPU. I'd like to get some feeling before I invest into some new technology. I'd like to stay in OCaml, not drop down to C. So I mention SPOC, SAREK and MetaOCaml which look like the right technologies. I have some clear bottleneck in my program. Here is how the code looks like: --- let f (points: (Vector3.t * float) list) = let acc = ref [] in let ac p1 x (p2, y) = acc := (Vector3.dist p1 p2, x *. y) :: !acc in let rec loop = function | [] -> () | (p1, x) :: xs -> L.iter (ac p1 x) xs; loop xs in loop points; !acc --- So, in terms of size: each point is 3 floats (a 3D coordinate) plus 1 float (some value). I usually have several thousands of points, but less than 10_000. The f function will be called thousands of times for one run of the program (let's say 300k calls is a big but reasonable use case). I don't care about the order of points in the input list. I also don't care about the order of the results in acc. I very probably don't care about using single point precision (32 bit floats) for everything, instead of double precision. Thanks a lot for any feedback. Best regards, Francois. PS: vector3 is available in opam, if that helps