AMD sparse matrix case study

AMD Diagonal Sparse Matrix Vector Multiplication Case Study


This is a case study comprising advanced aspects of OpenCL to create a sparse matrix multiplication algorithm. Very interesting tutorial by AMD. The drawbacks are that not all GPUs support OpenCL textures and it will take some time until that becomes standard and some optimizations are clearly AMD hardware specific.

Check AMD’s OpenCL case study.

CMSoft OpenCL news

CMSoft OpenCL news


This time I have brought you developers a lot of new content:

Advanced aspects of the C99 language tutorial;
Case study: matrix multiplication;
OpenCLTemplate 1.08.


I have completed the advanced aspects of C99 language tutorial, featuring execution warp control, __local variables and barrier() synchronization. The picture below is a snapshot of the memory model, explained in the tutorial.


The source code featuring advanced aspects is the OpenCL matrix multiplication case study. An explanation of how to take advantage of local memory is presented. This a sample picture used to explain how we can use __local:



Lastly, OpenCLTemplate 1.08 is available for download.




– Added the return word to CodeChecker flow control identification;
– Added a new implementation of Kernel.Execute that takes an int scalar as global_work_size (work_dim is set to 1);
– Added some __attribute__ qualifiers to CodeChecker.



OpenCL C99 Intermediate

Intermediate aspects of OpenCL C99


The new section of CMSoft OpenCL tutorial discusses intermediate aspects of the C99 language, like optional extensions and code optimization using native hardware functions.

The screenshot below shows the expected optimization. Check the OpenCL C99 Intermediate tutorial.


Last week has been a rather busy one. I’m working to post more tutorials this week.

Lab3D models tutorial

Creating Lab3D Models


Learn how to create curves and surfaces from mathematical equations using Lab3D. Great for math students, teachers and enthusiasts.

Take a look at the video tutorial demonstrating how to create a Lab3D Model:


For you developers around, I am working to create tutorials about synchronization and OpenGL/OpenCL interoperation. I want to polish the tutorials to make them as easy as possible to understand.

Also, AMD has released their Stream SDK 2.1 which incorporates interesting features like the Interop and byte addressable. Get the Stream SDK 2.1.

If you have NVidia hardware, download the CUDA 3 drivers.

Lab3D 1.017

Lab3D 1.017


Do you want to view models and simulations in 3D, like 3D cinema? Well, if your hardware supports it, Lab3D allows you to view models in immersive 3D! Get to know how to do it.


I am fine-tuning Lab3D in order to reach a stable version and this is coming closer and closer.




New feature: Added a button to take screen shots of the 3D visualization;
– Simulation now properly moves the objects to their start position (previously they would only go to their positions after animation started);
– Further improved texture management;
– Time now properly goes to zero when user clicks Stop button;
– Removed some heavy human OBJ 3D models to make the download lighter.


Below is a picture (taken with the new screenshot feature) of a soft-edge square generated with math equations, included in the Lab3D static models folder. Download Lab3D and check the Online Documentation.


OpenCL C99 Basics

Basic aspects of the OpenCL C99 language 


The tutorial about basic aspects of the OpenCL C99 language is now available. It presents the main differences concerning regular C99 and OpenCL C99 and shows source code to calculate the sum of components of a vector efficiently using OpenCL.

Two versions of Host code have been implemented and are available for download: OpenCLTemplate and Cloo.

Check the screen shots of the algorithm explanation and the sample program and visit the OpenCL C99 basics tutorial.



I am currently developing documentation and contents for the Lab3D software. Don’t miss it if you are interested in mathematical 3D modelling and simulation.

I would like to explicitly tell that I usually don’t have much time to spare during the week and that’s the reason I usually post on weekends. But be sure that all contents are really under development.


Lab3D 1.016

Lab3D 1.016

Download Lab3D


– Fixed a problem with Lab3D not loading properly non-power of 2 textures on systems that don’t have a graphics card compatible with newer versions of OpenGL.

Note: I am trying to make Lab3D capable of using the most out of systems that have good graphics cards but also compatible with systems that have no graphics cards (old computers and netbooks). Now Lab3D will resize the image to powers of 2 if necessary and run seamlessly on computers without a GPU (remember, it is necessary to install AMD OpenCL drivers to run OpenCL in the processor).

Lab3D Release Candidade

Lab3D Release Candidate

I am very proud to announce that Lab3D release candidate is out. There are many improvements that I included in Lab3D.

One of them is the possibility to create trajectory for existing 3D models in a Lab3D Simulation file, which is loaded just like any 3D model. Check below the sample Solar System simulation, which is included within Lab3D download. You may also want to check Lab3D gallery.




Lab3D 1.015 Changelog


New feature

– It is now possible to create Lab3D Simulations;
– Include 3D models in Lab3D simulations and create equations for trajectories and rotations.


– Added Delete Model button;
– Added new Points render style;
– It is now possible to switch between render styles during animation;
– (Create Lab3D) Save and accept model now are separate;
– (Create Lab3D) Added field to insert 3D model name;
– Some cosmetic changes.


– Fixed a small glitch with wireframe drawings;

If you happen to find bugs or have suggestions/comments, I’d kindly ask you to post in the Forum.

Lab3D basics

Lab3D basics 


The first Lab3D tutorial topic is now available. It covers Lab3D basic commands.

Go to the Lab3D basics tutorial.

You can also watch the Lab3D basics video tutorial:


I almost done with the Lab3D simulation feature for the Release Candidate, which should be available in the next few days.

For you developers around, I’m sketching the OpenCL C99 basic commands tutorial. Additionally, I’ve been experimenting with OpenCL/OpenGL interop and you should expect a tutorial about CLGL interop soon.