{"id":74,"date":"2013-04-17T09:21:52","date_gmt":"2013-04-17T09:21:52","guid":{"rendered":"http:\/\/xilexio.org\/?p=74"},"modified":"2013-09-02T11:29:01","modified_gmt":"2013-09-02T11:29:01","slug":"opencl-with-nvidia-gpu-on-windows-7-with-mingw32-quick-dirty-way","status":"publish","type":"post","link":"https:\/\/xilexio.eu.org\/?p=74","title":{"rendered":"OpenCL with NVidia GPU on Windows 7 with mingw32 (quick &#038; dirty way)"},"content":{"rendered":"<p>I had to make OpenCL computations with following configuration:<\/p>\n<ul>\n<li>Windows 7 64bit<\/li>\n<li>mingw32<\/li>\n<li>NVidia GPU<\/li>\n<\/ul>\n<p>The problem is that NVidia provides in their samples only Visual Studio (2008 and 2010) version of OpenCL libraries in their samples. So, the problem was getting a static .a or dynamic .dll 32bit library for mingw32 along with appropriate headers. Many ways I tried failed (most notable one was trying to use reimp tool as described <a href=\"http:\/\/oscarbg.blogspot.com\/2009\/12\/opencl-with-mingw.html\" title=\"OpenCL with MingW\">here<\/a>), so I solved the problem in a less clean manner. I simply copied all header files from NVidia&#8217;s samples and copied the dll file from one of NVidia&#8217;s folders on my PC. This made my code compile without problems and link with some warnings (presumably caused by the difference of function naming between VS and g++ compilers) similar to those: <\/p>\n<pre class=\"snippet-code\">Warning: resolving _clGetPlatformIDs@12 by linking to _clGetPlatformIDs\r\nWarning: resolving _clGetPlatformInfo@20 by linking to _clGetPlatformInfo<pre>\r\n\r\nIt worked nevertheless thanks to automatic call correction. To supress those warnings, I used the suggested --enable-stdcall-fixup linker option (meaning -Xlinker --enable-stdcall-fixup for g++). I compiled everything with the following call:\r\n<pre>g++ -o app -O3 -Ilib -Llib -Xlinker --enable-stdcall-fixup -lOpenCL app.cpp<\/pre>\n<p>where lib was the folder containing CL folder with headers and OpenCL.dll file.<\/p>\n<p>Please note that I haven't really tested what kind of impact would this change have on OpenCL performance. I assume there should be no changes. Also, I only used few OpenCL 1.1 features in my project, so in some situations you might want to somehow check compatibility of header files and the dll file you used.<\/p>\n<p>Here is a zip file containing the OpenCL.dll file with headers I used: <a href='http:\/\/xilexio.org\/wp-content\/uploads\/2013\/04\/lib.zip'>OpenCL dll library with headers<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I had to make OpenCL computations with following configuration: Windows 7 64bit mingw32 NVidia GPU The problem is that NVidia provides in their samples only Visual Studio (2008 and 2010) version of OpenCL libraries in their samples. So, the problem was getting a static .a or dynamic .dll 32bit library for mingw32 along with appropriate [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[14,13,12,15],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/xilexio.eu.org\/index.php?rest_route=\/wp\/v2\/posts\/74"}],"collection":[{"href":"https:\/\/xilexio.eu.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xilexio.eu.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xilexio.eu.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xilexio.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=74"}],"version-history":[{"count":0,"href":"https:\/\/xilexio.eu.org\/index.php?rest_route=\/wp\/v2\/posts\/74\/revisions"}],"wp:attachment":[{"href":"https:\/\/xilexio.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=74"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xilexio.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=74"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xilexio.eu.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=74"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}