Progress so far


The official coding period started this monday, but I had already do some things before. I’ll now describe what we can currently achieve with my OpenCL implementation.


First, a bit of history. The Clover project seems to have been started in late 2008, and evolved at a slow pace during two years. Then, since November 2010, it seemed to have been abandoned.

This implementation was made by Zack Rusin, who I thank for his great work. Despite its lack of features, his implementation was well organized and full of good ideas.

When I started my work, I took Rusin’s work as a starting point. I looked carefully at it and saw its qualities, for example its structure, its unit tests, and the use of CMake (I like CMake and use it when I develop small KDE-based apps).

So, I decided to take its structure. I then looked at the implementation, but I thought I was better removing it and starting from scratch. The code was a bit aging and hackish, it implemented the bare minimal OpenCL functions to be able to run some demos, and I thought I would be more comfortable with code of my hand, and that what he already implemented should not take too much time to be reimplemented.

Then I downloaded the OpenCL 1.1 spec and read it carefully. I implemented one function at a time, with having read the next paragraphs to be able to take good architecture decisions. Every function is fully covered by unit tests.

Days after days, the implementation has grown, and is now in an interesting state : nearly all the infrastructure work is done, we can create contexts and command queues, and I’ll now implement buffers, commands, programs and kernels. The implementation is relatively small and straightforward to implement.

Current features

So, I’m glad to say that my code is available on Github. It can be built and installed. It contains a small example application, querying information about the platforms and devices of the OpenCL implementation. This application can also be used on a proprietary OpenCL implementation.

With this implementation, we can get the platform list, get information about these platforms, create devices, get information about them, create and destroy context and create and destroy command queues.

If you take an OpenCL application, I have high hope that all its initialization code already runs on my implementation, that’s to say the code creating a context with a specified device, and creating one or more command queues.

The next step is to implement the “useful” functions, the kernels, programs, memory objects, etc. Following my timeline, I have until early June to finish and completely debug the currently implemented functions (if needed) and some more functions needed to support some simple kernels. I think I’m comfortably in advance, so I hope I will begin to work on Clang and the interesting part sooner than anticipated, to be able to implement more stuff during the summer.


3 responses to “Progress so far

  • Bill

    Hello, I am a bit of a newb when it comes to programming, but I can not get Clover to build. Can you post install instructions that are not relying on a certain distro? I got some error about Clover being built for Red Hat? Once again, it is probably my fault, but I am following your progression so I want to try out the device query program. will I need Opencl to be installed or is it all implemented by Clover?

  • steckdenis


    I’ll post more detailed instructions in some days, but for the moment, all you have to do is :

    cd Clover
    mkdir build
    cd build
    cmake .. -DCMAKE_INSTALL_PREFIX=/usr
    sudo make install

    If there are problems, try to copy Clover/include/CL in /usr/include. If it doesn’t fix your problem, post the error message you get.

    Happy testing.

    • Bill

      I got to the make step and I get this error:

      [tertl3@Bocephus build]$ make
      [ 94%] Built target OpenCL
      [100%] Building C object examples/trivial/CMakeFiles/basic.dir/basic.c.o
      /home/tertl3/Clover/examples/trivial/basic.c: In function ‘main’:
      /home/tertl3/Clover/examples/trivial/basic.c:201:5: error: ‘for’ loop iniial declarations are only allowed in C99 mode
      /home/tertl3/Clover/examples/trivial/basic.c:201:5: note: use option -stdc99 or -std=gnu99 to compile your code
      /home/tertl3/Clover/examples/trivial/basic.c: In function ‘platform_info’
      /home/tertl3/Clover/examples/trivial/basic.c:265:5: error: ‘for’ loop iniial declarations are only allowed in C99 mode
      make[2]: *** [examples/trivial/CMakeFiles/basic.dir/basic.c.o] Error 1
      make[1]: *** [examples/trivial/CMakeFiles/basic.dir/all] Error 2
      make: *** [all] Error 2

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: