WebCL Widget for WordPress

webcl-widget-adminSee the widget at the right showing if your browser+computer supports WebCL?

It is available under the GPL 2.0 license and based on code from WebCL@NokiaResearch (thanks guys for your great Firefox-plugin!)

Download from WordPress.org and unzip in /wp-content/plugins/. Or (better), search for a new plugin: “WebCL”. Feedback can be given in the comments.

I’d like to get your feedback what features you would like to see in the next version.

In case you want to make it for other CMS-platforms, here’s the main code of version 1.0:

<div id="webclwidget_detected"></div>
<div id="webclwidget_devices"></div>

<script type="text/javascript">// <![CDATA[
function webclwidget_detectCL() {
  // First check if the WebCL extension is installed at all
  if (window.WebCL == undefined) {
    return "Your system does not support WebCL.";
  }
  try {
    var platforms = WebCL.getPlatformIDs();
    var devices = [];
    for (var i in platforms) {
      var plat = platforms[i];
      devices[i] = plat.getDeviceIDs(WebCL.CL_DEVICE_TYPE_ALL);
    }
    return "Your system supports WebCL!";
  } catch (e) {
    return "WebCL is installed, but not working correctly.";
  }
}
function webclwidget_setDetectCL(elem) {
  obj = document.getElementById(elem);
  obj.innerHTML = webclwidget_detectCL();
}
function webclwidget_get_devices() {
  s = "These are your devices: <ul>";
  try {
    var platforms = WebCL.getPlatformIDs ();
    for (var i in platforms) {
      var plat = platforms[i];
      var devices = plat.getDeviceIDs (WebCL.CL_DEVICE_TYPE_ALL);
      for (var j in devices) {
        var dev = devices[j];
        s += "<li>" + dev.getDeviceInfo(WebCL.CL_DEVICE_NAME) + "</li>";
      }
    }
  } catch (e) {
    return "";
  }
  return s + "";
}
function webclwidget_setDevices(elem) {
  obj = document.getElementById(elem);
  obj.innerHTML = webclwidget_get_devices();
}
webclwidget_setDetectCL("webclwidget_detected");
webclwidget_setDevices("webclwidget_devices");
// ]]></script>

If you want to use it, you probably get cleaner code from the zip-file. Let me know if you created a plugin for another CMS.

Why put this on your site?

So you can help promote WebCL and OpenCL. If WebGL and WebCL become mainstream, then the web will look different – you can help speed it up a little. Remember that a lot of littles makes a lot.

Also if you are having a bitcoins-site, a tech-site or want to use WebCL. With the widget you easily help your visitors show if they have WebCL installed.

Feedback is very welcome – put them in the comments or send me an email.