Programming GPUs with OCaml in 2023


What is the state of targeting GPUs w/ OCaml code in 2023?

Are the opam packages spoc and sarek still the state of the art?
Which one should we use?

Are they still maintained?

I have not run any test yet, but they can both be installed under ocaml-4.07.0.

Were those just research prototypes or they have been used somewhere in production?

Thanks a lot,

PS: je n’aime pas essuyer les platres :wink:


I think it is safe to say it was a research experiment.
SPOC is probably quite stable, but Sarek is fairly incomplete, not very well tested (and the result of multiple incremental experiments). Sadly, I don’t have time to work on it and would not recommend using it if you are not ready to heavily patch it when necessary…

Beside, I think the “native” OpenCL/SyCL/Vulkan/Cuda tools have matured a lot these last years (and Ocaml too) and it would probably make more sense to target the newer versions instead of the old ones SPOC is based on.


Futhark is an interesting ML-like language for GPU programming. There are bindings for OCaml:

1 Like