Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
How to write a CUDA kernel in ocaml?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Eray Ozkural <examachine@g...>
Subject: Re: [Caml-list] How to write a CUDA kernel in ocaml?
On Tue, Dec 15, 2009 at 6:07 PM, Basile STARYNKEVITCH
<> wrote:
> Eray Ozkural wrote:
>> Hello there,
>> I've looked at the CUDA bindings for ocaml, but it seems the kernels
>> were in C, am I right? How can I write the kernel in ocaml? I have an
>> ocaml program that is badly in need of parallelization and it fits the
>> NVIDIA architecture. If ocaml changes are required please explain to
>> me a little, I have sufficient knowledge of compilers, I've worked on
>> a commercial C-to-FPGA compiler project for 2 years. Of course it
>> would be best if I can just handle it with a makefile :)
> You cannot do that today easily.
> The French OpenGPU project -funded by French public money
> (in which I will be a
> partner)- will start in january 2010 to deal with such issues (probably with
> OpenCL, not CUDA). There won't be usable results soon (and I have no idea if
> at end of the project, there will be a simple solution to your problem).
> You could try to help the OpenGPU partners involved. Ask Emmanuel Chailloux
> (in CC).
> If you need today to call a CUDA kernel from Ocaml, you have to use C!

It's great to hear such an effort, I will be following the
developments. Of course OpenCL will be just as good. Pretty similar,
anyway. I've seen some restrictions in OpenCL's C99 extension for
compiling kernels, which is *not good* and might ultimately impair the
implementation of a functional language.  I don't see how one could
think of putting any restrictions. We didn't have to invent any
restrictions when compiling to hardware!

At any rate, the obvious question from a compiler standpoint is,
cannot we compile ocaml to C, is there a way to translate to C first
and then to whatever works for kernel? I know little about the ocaml
compiler so please forgive my naive questions.


Eray Ozkural, PhD candidate.  Comp. Sci. Dept., Bilkent University, Ankara