{"id":128,"date":"2010-07-31T13:14:22","date_gmt":"2010-07-31T13:14:22","guid":{"rendered":"http:\/\/sugarandcyanide.com\/blog\/?p=128"},"modified":"2010-07-31T13:14:22","modified_gmt":"2010-07-31T13:14:22","slug":"first-steps-in-opencl","status":"publish","type":"post","link":"http:\/\/sugarandcyanide.com\/blog\/2010\/07\/31\/first-steps-in-opencl\/","title":{"rendered":"first steps in openCL"},"content":{"rendered":"<p>I&#8217;m going to post something about my trip to Italy in a bit, after I get my pics uploaded properly to Flickr.  But I wanted to put this up so I don&#8217;t forget about it later.<\/p>\n<p>A conversation at work got me interested enough in GPGPU calculations to start doing a bit of research into the topic.  Seems that at a base level both the ATI and NVidia APIs behave similarly, and that OpenCL is a nice, understandable alternative if you don&#8217;t want to be locked in to a single vendor. (Not that I use ATI cards.)  I tried getting CUDA working on my Mac, but between weirdness caused by the drivers and the fact that it doesn&#8217;t support 64-bit on OSX, I&#8217;ve decided to go with <a href=\"http:\/\/www.khronos.org\/registry\/cl\/\">OpenCL<\/a> instead for my tests.  Functionally everything will be the same, and after a nice tutorial on <a href=\"http:\/\/developer.amd.com\/GPU\/ATISTREAMSDK\/pages\/TutorialOpenCL.aspx\">ATI&#8217;s site detailing some introductory points<\/a> I have code that compiles and does what I want it to do, which is more than I can say for CUDA.<\/p>\n<p>Anyway, here&#8217;s my first test.  I wanted something simple for getting device information off my laptop.<\/p>\n<p><div class=\"cpp\" style=\"font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;\"><span style=\"color: #339900;\">#include &lt;iostream&gt;<\/span><br \/>\n<span style=\"color: #0000ff;\">using<\/span> <span style=\"color: #0000ff;\">namespace<\/span> std<span style=\"color: #008080;\">;<\/span><\/p>\n<p><span style=\"color: #339900;\">#include &lt;stdio.h&gt;<\/span><br \/>\n<span style=\"color: #339900;\">#include &lt;stdlib.h&gt;<\/span><\/p>\n<p><span style=\"color: #339900;\">#include &lt;OpenGL\/gl.h&gt;<\/span><br \/>\n<span style=\"color: #339900;\">#include &lt;OpenGL\/CGLDevice.h&gt;<\/span><br \/>\n<span style=\"color: #339900;\">#include &lt;OpenCL\/cl.h&gt;<\/span><br \/>\n<span style=\"color: #339900;\">#include &lt;OpenCL\/cl_gl.h&gt;<\/span><br \/>\n<span style=\"color: #339900;\">#include &lt;OpenCL\/cl_gl_ext.h&gt;<\/span><br \/>\n<span style=\"color: #339900;\">#include &lt;OpenCL\/cl_ext.h&gt;<\/span><br \/>\n&nbsp;<br \/>\n<span style=\"color: #339900;\">#define MSG_SIZE 4096<\/span><br \/>\n<span style=\"color: #339900;\">#define MAX_DEVICE_IDS 16<\/span><\/p>\n<p><span style=\"color: #339900;\">#define RT_STRING &nbsp; &nbsp; &nbsp; 0<\/span><br \/>\n<span style=\"color: #339900;\">#define RT_UINT &nbsp; &nbsp; &nbsp; &nbsp; 1<\/span><br \/>\n<span style=\"color: #339900;\">#define RT_BOOL &nbsp; &nbsp; &nbsp; &nbsp; 2<\/span><br \/>\n<span style=\"color: #339900;\">#define RT_PLATFORMID &nbsp; 3<\/span><br \/>\n<span style=\"color: #339900;\">#define RT_SIZET&nbsp; &nbsp; &nbsp; &nbsp; 5<\/span><br \/>\n<span style=\"color: #339900;\">#define RT_SIZET_ARR&nbsp; &nbsp; 6<\/span><\/p>\n<p>\n<span style=\"color: #0000ff;\">void<\/span> printDeviceInfo<span style=\"color: #008000;\">&#40;<\/span>cl_device_id deviceID<span style=\"color: #008000;\">&#41;<\/span> <span style=\"color: #008000;\">&#123;<\/span><br \/>\n&nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; cl_device_info param_list<span style=\"color: #008000;\">&#91;<\/span><span style=\"color: #008000;\">&#93;<\/span> <span style=\"color: #000080;\">=<\/span> <span style=\"color: #008000;\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; CL_DEVICE_NAME, CL_DEVICE_VENDOR, CL_DRIVER_VERSION, CL_DEVICE_VERSION,<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; CL_DEVICE_PROFILE, <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; CL_DEVICE_PLATFORM, CL_DEVICE_VENDOR_ID,<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; CL_DEVICE_MAX_COMPUTE_UNITS, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; CL_DEVICE_MAX_WORK_ITEM_SIZES, CL_DEVICE_MAX_WORK_GROUP_SIZE,<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff;\">NULL<\/span><br \/>\n&nbsp; &nbsp; <span style=\"color: #008000;\">&#125;<\/span><span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; <span style=\"color: #0000ff;\">int<\/span> param_return_types<span style=\"color: #008000;\">&#91;<\/span><span style=\"color: #008000;\">&#93;<\/span> <span style=\"color: #000080;\">=<\/span> <span style=\"color: #008000;\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; RT_STRING, RT_STRING, RT_STRING, RT_STRING,<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; RT_STRING, RT_PLATFORMID, RT_UINT,<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; RT_UINT, RT_UINT, RT_SIZET_ARR, RT_SIZET,<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff;\">NULL<\/span><br \/>\n&nbsp; &nbsp; <span style=\"color: #008000;\">&#125;<\/span><span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; <span style=\"color: #0000ff;\">char<\/span> <span style=\"color: #000040;\">*<\/span>param_strings<span style=\"color: #008000;\">&#91;<\/span><span style=\"color: #008000;\">&#93;<\/span> <span style=\"color: #000080;\">=<\/span> <span style=\"color: #008000;\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #FF0000;\">&quot;Device Name&quot;<\/span>, <span style=\"color: #FF0000;\">&quot;Vendor&quot;<\/span>, <span style=\"color: #FF0000;\">&quot;Driver Version&quot;<\/span>, <span style=\"color: #FF0000;\">&quot;Device Version&quot;<\/span>,<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #FF0000;\">&quot;Device Profile&quot;<\/span>, <span style=\"color: #FF0000;\">&quot;Device Platform&quot;<\/span>, <span style=\"color: #FF0000;\">&quot;Device Vendor ID&quot;<\/span>,<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #FF0000;\">&quot;Max Compute Units&quot;<\/span>, <span style=\"color: #FF0000;\">&quot;Max Work Item Dimensions&quot;<\/span>,<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #FF0000;\">&quot;Max Work Item Sizes&quot;<\/span>, <span style=\"color: #FF0000;\">&quot;Max Work Group Size&quot;<\/span>,<br \/>\n&nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff;\">NULL<\/span><br \/>\n&nbsp; &nbsp; <span style=\"color: #008000;\">&#125;<\/span><span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; <span style=\"color: #0000ff;\">int<\/span> i <span style=\"color: #000080;\">=<\/span> <span style=\"color: #0000dd;\">0<\/span><span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; <span style=\"color: #0000ff;\">int<\/span> maxWorkItemDimensions <span style=\"color: #000080;\">=<\/span> <span style=\"color: #0000dd;\">3<\/span><span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; <span style=\"color: #0000ff;\">while<\/span><span style=\"color: #008000;\">&#40;<\/span>param_strings<span style=\"color: #008000;\">&#91;<\/span>i<span style=\"color: #008000;\">&#93;<\/span> <span style=\"color: #000040;\">!<\/span><span style=\"color: #000080;\">=<\/span> <span style=\"color: #0000ff;\">NULL<\/span><span style=\"color: #008000;\">&#41;<\/span> <span style=\"color: #008000;\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff;\">char<\/span>&nbsp; &nbsp; msg<span style=\"color: #008000;\">&#91;<\/span>MSG_SIZE<span style=\"color: #008000;\">&#93;<\/span><span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff;\">size_t<\/span>&nbsp; param_sizeT<span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff;\">size_t<\/span>&nbsp; param_sizeT_array<span style=\"color: #008000;\">&#91;<\/span>MSG_SIZE<span style=\"color: #008000;\">&#93;<\/span><span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; cl_uint param_uint<span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; cl_bool param_bool<span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff;\">size_t<\/span>&nbsp; param_value_ret<span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; cl_platform_id param_platformID<span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; cl_int error<span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff;\">switch<\/span> <span style=\"color: #008000;\">&#40;<\/span>param_return_types<span style=\"color: #008000;\">&#91;<\/span>i<span style=\"color: #008000;\">&#93;<\/span><span style=\"color: #008000;\">&#41;<\/span> <span style=\"color: #008000;\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff;\">case<\/span> RT_STRING<span style=\"color: #008080;\">:<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; error <span style=\"color: #000080;\">=<\/span> clGetDeviceInfo<span style=\"color: #008000;\">&#40;<\/span>deviceID, <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; param_list<span style=\"color: #008000;\">&#91;<\/span>i<span style=\"color: #008000;\">&#93;<\/span>, <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MSG_SIZE,<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; msg,<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #000040;\">&amp;<\/span>param_value_ret<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #008000;\">&#41;<\/span><span style=\"color: #008080;\">;<\/span><\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000dd;\">cout<\/span> <span style=\"color: #000080;\">&lt;&lt;<\/span> param_strings<span style=\"color: #008000;\">&#91;<\/span>i<span style=\"color: #008000;\">&#93;<\/span> <span style=\"color: #000080;\">&lt;&lt;<\/span> <span style=\"color: #FF0000;\">&quot;: &quot;<\/span> <span style=\"color: #000080;\">&lt;&lt;<\/span> msg <span style=\"color: #000080;\">&lt;&lt;<\/span> <span style=\"color: #FF0000;\">&quot;<span style=\"color: #000099; font-weight: bold;\">\\n<\/span>&quot;<\/span><span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff;\">break<\/span><span style=\"color: #008080;\">;<\/span><\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff;\">case<\/span> RT_UINT<span style=\"color: #008080;\">:<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; error <span style=\"color: #000080;\">=<\/span> clGetDeviceInfo<span style=\"color: #008000;\">&#40;<\/span>deviceID, <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; param_list<span style=\"color: #008000;\">&#91;<\/span>i<span style=\"color: #008000;\">&#93;<\/span>, <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000dd;\">sizeof<\/span><span style=\"color: #008000;\">&#40;<\/span>cl_uint<span style=\"color: #008000;\">&#41;<\/span>,<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #000040;\">&amp;<\/span>param_uint,<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff;\">NULL<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #008000;\">&#41;<\/span><span style=\"color: #008080;\">;<\/span><\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000dd;\">cout<\/span> <span style=\"color: #000080;\">&lt;&lt;<\/span> param_strings<span style=\"color: #008000;\">&#91;<\/span>i<span style=\"color: #008000;\">&#93;<\/span> <span style=\"color: #000080;\">&lt;&lt;<\/span> <span style=\"color: #FF0000;\">&quot;: &quot;<\/span> <span style=\"color: #000080;\">&lt;&lt;<\/span> param_uint <span style=\"color: #000080;\">&lt;&lt;<\/span> <span style=\"color: #FF0000;\">&quot;<span style=\"color: #000099; font-weight: bold;\">\\n<\/span>&quot;<\/span><span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff;\">break<\/span><span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff;\">case<\/span> RT_BOOL<span style=\"color: #008080;\">:<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; error <span style=\"color: #000080;\">=<\/span> clGetDeviceInfo<span style=\"color: #008000;\">&#40;<\/span>deviceID, <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; param_list<span style=\"color: #008000;\">&#91;<\/span>i<span style=\"color: #008000;\">&#93;<\/span>, <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000dd;\">sizeof<\/span><span style=\"color: #008000;\">&#40;<\/span>cl_bool<span style=\"color: #008000;\">&#41;<\/span>,<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #000040;\">&amp;<\/span>param_bool,<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff;\">NULL<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #008000;\">&#41;<\/span><span style=\"color: #008080;\">;<\/span><\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000dd;\">cout<\/span> <span style=\"color: #000080;\">&lt;&lt;<\/span> param_strings<span style=\"color: #008000;\">&#91;<\/span>i<span style=\"color: #008000;\">&#93;<\/span> <span style=\"color: #000080;\">&lt;&lt;<\/span> <span style=\"color: #FF0000;\">&quot;: &quot;<\/span> <span style=\"color: #000080;\">&lt;&lt;<\/span> <span style=\"color: #008000;\">&#40;<\/span>param_bool <span style=\"color: #008080;\">?<\/span> <span style=\"color: #FF0000;\">&quot;True&quot;<\/span> <span style=\"color: #008080;\">:<\/span> <span style=\"color: #FF0000;\">&quot;False&quot;<\/span><span style=\"color: #008000;\">&#41;<\/span> <span style=\"color: #000080;\">&lt;&lt;<\/span> <span style=\"color: #FF0000;\">&quot;<span style=\"color: #000099; font-weight: bold;\">\\n<\/span>&quot;<\/span><span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff;\">break<\/span><span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff;\">case<\/span> RT_PLATFORMID<span style=\"color: #008080;\">:<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; error <span style=\"color: #000080;\">=<\/span> clGetDeviceInfo<span style=\"color: #008000;\">&#40;<\/span>deviceID, <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; param_list<span style=\"color: #008000;\">&#91;<\/span>i<span style=\"color: #008000;\">&#93;<\/span>, <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000dd;\">sizeof<\/span><span style=\"color: #008000;\">&#40;<\/span>cl_platform_id<span style=\"color: #008000;\">&#41;<\/span>,<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; param_platformID,<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff;\">NULL<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #008000;\">&#41;<\/span><span style=\"color: #008080;\">;<\/span><\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000dd;\">cout<\/span> <span style=\"color: #000080;\">&lt;&lt;<\/span> param_strings<span style=\"color: #008000;\">&#91;<\/span>i<span style=\"color: #008000;\">&#93;<\/span> <span style=\"color: #000080;\">&lt;&lt;<\/span> <span style=\"color: #FF0000;\">&quot;: &quot;<\/span> <span style=\"color: #000080;\">&lt;&lt;<\/span> param_platformID <span style=\"color: #000080;\">&lt;&lt;<\/span> <span style=\"color: #FF0000;\">&quot;<span style=\"color: #000099; font-weight: bold;\">\\n<\/span>&quot;<\/span><span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff;\">break<\/span><span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff;\">case<\/span> RT_SIZET<span style=\"color: #008080;\">:<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; error <span style=\"color: #000080;\">=<\/span> clGetDeviceInfo<span style=\"color: #008000;\">&#40;<\/span>deviceID, <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; param_list<span style=\"color: #008000;\">&#91;<\/span>i<span style=\"color: #008000;\">&#93;<\/span>, <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000dd;\">sizeof<\/span><span style=\"color: #008000;\">&#40;<\/span><span style=\"color: #0000ff;\">size_t<\/span><span style=\"color: #008000;\">&#41;<\/span>,<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #000040;\">&amp;<\/span>param_sizeT,<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff;\">NULL<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #008000;\">&#41;<\/span><span style=\"color: #008080;\">;<\/span><\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000dd;\">cout<\/span> <span style=\"color: #000080;\">&lt;&lt;<\/span> param_strings<span style=\"color: #008000;\">&#91;<\/span>i<span style=\"color: #008000;\">&#93;<\/span> <span style=\"color: #000080;\">&lt;&lt;<\/span> <span style=\"color: #FF0000;\">&quot;: &quot;<\/span> <span style=\"color: #000080;\">&lt;&lt;<\/span> param_sizeT <span style=\"color: #000080;\">&lt;&lt;<\/span> <span style=\"color: #FF0000;\">&quot;<span style=\"color: #000099; font-weight: bold;\">\\n<\/span>&quot;<\/span><span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff;\">break<\/span><span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff;\">case<\/span> RT_SIZET_ARR<span style=\"color: #008080;\">:<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; error <span style=\"color: #000080;\">=<\/span> clGetDeviceInfo<span style=\"color: #008000;\">&#40;<\/span>deviceID, <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; param_list<span style=\"color: #008000;\">&#91;<\/span>i<span style=\"color: #008000;\">&#93;<\/span>, <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000dd;\">sizeof<\/span><span style=\"color: #008000;\">&#40;<\/span><span style=\"color: #0000ff;\">size_t<\/span><span style=\"color: #008000;\">&#41;<\/span> <span style=\"color: #000040;\">*<\/span> maxWorkItemDimensions,<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; param_sizeT_array,<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #000040;\">&amp;<\/span>param_value_ret<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #008000;\">&#41;<\/span><span style=\"color: #008080;\">;<\/span><\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000dd;\">cout<\/span> <span style=\"color: #000080;\">&lt;&lt;<\/span> param_strings<span style=\"color: #008000;\">&#91;<\/span>i<span style=\"color: #008000;\">&#93;<\/span> <span style=\"color: #000080;\">&lt;&lt;<\/span> <span style=\"color: #FF0000;\">&quot;: &quot;<\/span> <span style=\"color: #000080;\">&lt;&lt;<\/span> param_sizeT_array<span style=\"color: #008000;\">&#91;<\/span><span style=\"color: #0000dd;\">0<\/span><span style=\"color: #008000;\">&#93;<\/span> <span style=\"color: #000080;\">&lt;&lt;<\/span> <span style=\"color: #FF0000;\">&quot;, &quot;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #000080;\">&lt;&lt;<\/span> param_sizeT_array<span style=\"color: #008000;\">&#91;<\/span><span style=\"color: #0000dd;\">1<\/span><span style=\"color: #008000;\">&#93;<\/span> <span style=\"color: #000080;\">&lt;&lt;<\/span> <span style=\"color: #FF0000;\">&quot;, &quot;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #000080;\">&lt;&lt;<\/span> param_sizeT_array<span style=\"color: #008000;\">&#91;<\/span><span style=\"color: #0000dd;\">2<\/span><span style=\"color: #008000;\">&#93;<\/span> <span style=\"color: #000080;\">&lt;&lt;<\/span> <span style=\"color: #FF0000;\">&quot;<span style=\"color: #000099; font-weight: bold;\">\\n<\/span>&quot;<\/span><span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff;\">break<\/span><span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff;\">default<\/span><span style=\"color: #008080;\">:<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff;\">break<\/span><span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #008000;\">&#125;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; i<span style=\"color: #000040;\">++<\/span><span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; <span style=\"color: #008000;\">&#125;<\/span><br \/>\n<span style=\"color: #008000;\">&#125;<\/span><\/p>\n<p>\n<span style=\"color: #0000ff;\">int<\/span> main<span style=\"color: #008000;\">&#40;<\/span><span style=\"color: #0000ff;\">int<\/span> argc, <span style=\"color: #0000ff;\">char<\/span> <span style=\"color: #000040;\">**<\/span>argv<span style=\"color: #008000;\">&#41;<\/span> <span style=\"color: #008000;\">&#123;<\/span><br \/>\n&nbsp; &nbsp; cl_device_id deviceID<span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; cl_uint numDevices<span style=\"color: #008080;\">;<\/span><\/p>\n<p>&nbsp; &nbsp; cl_uint err <span style=\"color: #000080;\">=<\/span> clGetDeviceIDs<span style=\"color: #008000;\">&#40;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff;\">NULL<\/span>, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CL_DEVICE_TYPE_CPU, &nbsp; &nbsp;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MAX_DEVICE_IDS, &nbsp; &nbsp; &nbsp; &nbsp;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #000040;\">&amp;<\/span>deviceID,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #000040;\">&amp;<\/span>numDevices<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #008000;\">&#41;<\/span><span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; <span style=\"color: #0000dd;\">cout<\/span> <span style=\"color: #000080;\">&lt;&lt;<\/span> <span style=\"color: #FF0000;\">&quot;Number of CPU devices: &quot;<\/span> <span style=\"color: #000080;\">&lt;&lt;<\/span> numDevices <span style=\"color: #000080;\">&lt;&lt;<\/span> <span style=\"color: #FF0000;\">&quot;<span style=\"color: #000099; font-weight: bold;\">\\n<\/span>&quot;<\/span><span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; <span style=\"color: #0000ff;\">for<\/span> <span style=\"color: #008000;\">&#40;<\/span><span style=\"color: #0000ff;\">int<\/span> i <span style=\"color: #000080;\">=<\/span> <span style=\"color: #0000dd;\">0<\/span><span style=\"color: #008080;\">;<\/span> i <span style=\"color: #000080;\">&lt;<\/span> numDevices<span style=\"color: #008080;\">;<\/span> i<span style=\"color: #000040;\">++<\/span><span style=\"color: #008000;\">&#41;<\/span> <span style=\"color: #008000;\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; printDeviceInfo<span style=\"color: #008000;\">&#40;<\/span>deviceID<span style=\"color: #008000;\">&#41;<\/span><span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; <span style=\"color: #008000;\">&#125;<\/span><\/p>\n<p>&nbsp; &nbsp; <span style=\"color: #0000dd;\">cout<\/span> <span style=\"color: #000080;\">&lt;&lt;<\/span> <span style=\"color: #FF0000;\">&quot;<span style=\"color: #000099; font-weight: bold;\">\\n<\/span><span style=\"color: #000099; font-weight: bold;\">\\n<\/span>&quot;<\/span><span style=\"color: #008080;\">;<\/span><\/p>\n<p>&nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; <\/p>\n<p>&nbsp; &nbsp; err <span style=\"color: #000080;\">=<\/span> clGetDeviceIDs<span style=\"color: #008000;\">&#40;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #0000ff;\">NULL<\/span>,<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CL_DEVICE_TYPE_GPU,<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MAX_DEVICE_IDS,<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #000040;\">&amp;<\/span>deviceID,<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #000040;\">&amp;<\/span>numDevices<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #008000;\">&#41;<\/span><span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; <span style=\"color: #0000dd;\">cout<\/span> <span style=\"color: #000080;\">&lt;&lt;<\/span> <span style=\"color: #FF0000;\">&quot;Number of GPU devices: &quot;<\/span> <span style=\"color: #000080;\">&lt;&lt;<\/span> numDevices <span style=\"color: #000080;\">&lt;&lt;<\/span> <span style=\"color: #FF0000;\">&quot;<span style=\"color: #000099; font-weight: bold;\">\\n<\/span>&quot;<\/span><span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; <span style=\"color: #0000ff;\">for<\/span> <span style=\"color: #008000;\">&#40;<\/span><span style=\"color: #0000ff;\">int<\/span> i <span style=\"color: #000080;\">=<\/span> <span style=\"color: #0000dd;\">0<\/span><span style=\"color: #008080;\">;<\/span> i <span style=\"color: #000080;\">&lt;<\/span> numDevices<span style=\"color: #008080;\">;<\/span> i<span style=\"color: #000040;\">++<\/span><span style=\"color: #008000;\">&#41;<\/span> <span style=\"color: #008000;\">&#123;<\/span><br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; printDeviceInfo<span style=\"color: #008000;\">&#40;<\/span>deviceID<span style=\"color: #008000;\">&#41;<\/span><span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; <span style=\"color: #008000;\">&#125;<\/span><br \/>\n&nbsp; &nbsp; <br \/>\n&nbsp; &nbsp; <span style=\"color: #0000dd;\">cout<\/span> <span style=\"color: #000080;\">&lt;&lt;<\/span> <span style=\"color: #FF0000;\">&quot;<span style=\"color: #000099; font-weight: bold;\">\\n<\/span><span style=\"color: #000099; font-weight: bold;\">\\n<\/span>&quot;<\/span><span style=\"color: #008080;\">;<\/span><br \/>\n&nbsp; &nbsp; <br \/>\n<span style=\"color: #008000;\">&#125;<\/span><br \/>\n&nbsp;<\/div>\n<\/p>\n<p>(Hope that copy-and-pasted correctly.)  To compile it on your Mac:<\/p>\n<p><div class=\"cpp\" style=\"font-family:monospace;color: #006; border: 1px solid #d0d0d0; background-color: #f0f0f0;\">g++ test2.cpp -o test2 -framework OpenCL<\/div>\n<\/p>\n<p>Here are the results on my laptop, a 2010 Core i7 MacBook Pro 15&#8243;:<\/p>\n<pre>Number of CPU devices: 1\nDevice Name: Intel(R) Core(TM) i7 CPU       M 620  @ 2.67GHz\nVendor: Intel\nDriver Version: 1.0\nDevice Version: OpenCL 1.0\nDevice Profile: FULL_PROFILE\nDevice Platform: 0\nDevice Vendor ID: 16909312\nMax Compute Units: 4\nMax Work Item Dimensions: 3\nMax Work Item Sizes: 1, 1, 1\nMax Work Group Size: 1<br \/><br \/>\nNumber of GPU devices: 1\nDevice Name: GeForce GT 330M\nVendor: NVIDIA\nDriver Version: CLH 1.0\nDevice Version: OpenCL 1.0\nDevice Profile: FULL_PROFILE\nDevice Platform: 0\nDevice Vendor ID: 16918016\nMax Compute Units: 6\nMax Work Item Dimensions: 3\nMax Work Item Sizes: 512, 512, 64\nMax Work Group Size: 512\n<\/pre>\n<p>Next step: getting the GPU to do some calculations.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m going to post something about my trip to Italy in a bit, after I get my pics uploaded properly to Flickr. But I wanted to put this up so I don&#8217;t forget about it later. A conversation at work got me interested enough in GPGPU calculations to start doing a bit of research into [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[30,36],"class_list":["post-128","post","type-post","status-publish","format-standard","hentry","category-programming","tag-gpgpu","tag-opencl"],"_links":{"self":[{"href":"http:\/\/sugarandcyanide.com\/blog\/wp-json\/wp\/v2\/posts\/128","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/sugarandcyanide.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/sugarandcyanide.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/sugarandcyanide.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/sugarandcyanide.com\/blog\/wp-json\/wp\/v2\/comments?post=128"}],"version-history":[{"count":0,"href":"http:\/\/sugarandcyanide.com\/blog\/wp-json\/wp\/v2\/posts\/128\/revisions"}],"wp:attachment":[{"href":"http:\/\/sugarandcyanide.com\/blog\/wp-json\/wp\/v2\/media?parent=128"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/sugarandcyanide.com\/blog\/wp-json\/wp\/v2\/categories?post=128"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/sugarandcyanide.com\/blog\/wp-json\/wp\/v2\/tags?post=128"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}