Getting build error details in openCL and Cloo

I’m learning OpenCL using Cloo, and not surprisingly my first kernels contain errors (but I’m improving very quickly).

This piece of code gets a log of the errors from the build process. It is simple but I think it is worth to be shared because currently there are little code samples for Cloo available on the web.

    var source = @"kernel void MyCode () {...........}";
    var platform = ComputePlatform.Platforms[0];
    var devices = new List(platform.Devices.ToArray());
    var properties = new ComputeContextPropertyList(platform);
    var context = new ComputeContext(devices, properties, null, IntPtr.Zero);
    var program = new ComputeProgram(context, source);
    var statuses = new ComputeProgramBuildStatus[devices.Count];
    var buildLog = "";
    var success = true;
    try
    {
        program.Build(null, null, null, IntPtr.Zero);
    }
    catch
    {
        success = false;
        var sb = new StringBuilder();
        for (int i = 0; i < devices.Count; ++i)
        {
            var device = devices[i];
            statuses[i] = program.GetBuildStatus(device);
            sb.Append("Device: ");
            sb.AppendLine(device.Name);
            sb.Append("Build status: ");
            sb.AppendLine(program.GetBuildStatus(device).ToString());
            sb.Append("Build log: ");
            sb.AppendLine(program.GetBuildLog(devices[0]));
        }
        buildLog = sb.ToString();
    }
    if (!success)
    {
        //manage error situation
    }

toXY: Convert graphs in PDF files into numbers with Inkscape

It is rather common that a scientific paper presents most of its results in graphs, reporting in text just a few exact numeric values for some relevant cases.
The missing exact numerical information could prevent other researchers to fully compare their results with those of that paper.
When the paper is in PDF format (99.999% of the cases), and it is relatively recent, the exact numerical information is very likely included in the paper, because graphs are almost always included in vectorial form.

I wrote an Inkscape plugin that converts curves in a graph into a table of numbers. I called it “toXY” (name chosen in a moment of total lack of imagination).

Go to the dedicated page to get it.