caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Can this code be accelerated by porting it to SPOC, SAREK or MetaOCaml ?
@ 2017-06-15  6:28 Francois BERENGER
  2017-06-15  7:09 ` Ronan Le Hy
  0 siblings, 1 reply; 4+ messages in thread
From: Francois BERENGER @ 2017-06-15  6:28 UTC (permalink / raw)
  To: caml-list

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


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

end of thread, other threads:[~2017-06-16  9:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-15  6:28 [Caml-list] Can this code be accelerated by porting it to SPOC, SAREK or MetaOCaml ? Francois BERENGER
2017-06-15  7:09 ` Ronan Le Hy
2017-06-15 10:38   ` Ivan Gotovchits
2017-06-16  9:49     ` Francois BERENGER

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