Stream HPC

OpenCL under Wine

The Wine 1.3 branch has support for OpenCL 1.0 since 1.3.9. Since Microsoft likes to get a little part of the Linux-dominated HPC-market, support for GPGPU is pretty good under the $799.00 costing Visual Studio – the free Express-version is not supported well. But why not take the produced software back via Wine? Problem is that OpenCL is not in the current Wine binaries for some reason, but that is fixable until we wait for inclusion…

Lazy or not much time? You can try my binaries (Ubuntu 32, NVIDIA), but I cannot guarantee they work for you and it is on your own responsibility: download (reported not working by some). See second part of step 3, what to do with it.

All the steps

I assume you have the OpenCL-SDK installed, but let me know if I need to add more details or clear up some steps.

1 – get the sources

The sources are available here. Be sure you download at least version 1.3.9. Alternatively you download the latest from git. You can get it by going to a directory and execute:

git clone git://source.winehq.org/git/wine.git

A directory “wine” will be created. That was easy, so lets go to bake some binaries.

2 – configure

For NVIDIA 32 do:
**

export CPPFLAGS="-I/usr/local/cuda/include/" export LDFLAGS="-L/usr/local/cuda/lib"

For AMD 32 do (fix path for your installation-directory):
**

export CPPFLAGS="-I/opt/ati-stream-sdk-v2.0-lnx32/include" export LDFLAGS="-L/opt/ati-stream-sdk-v2.0-lnx32/lib/x86"

For NVIDIA 64 do:
**

export CPPFLAGS="-I/usr/local/cuda/include/" export LDFLAGS="-L/usr/local/cuda/lib64"

For AMD 64 do (fix path for your installation-directory):
**

export CPPFLAGS="-I/opt/ati-stream-sdk-v2.0-lnx64/include" export LDFLAGS="-L/opt/ati-stream-sdk-v2.0-lnx64/lib/x86_64"

Then it’s time to configure the project. If you have never built from source, you will get some dependency-errors. Just install the missing packages as suggested by by the script. Execute:

./configure --with-opencl

3 – compile and install

If all went ok, then go to dlls/opencl.  A make for the whole source would take quite some coffee, so let’s take a shortcut and go to dlls/opencl where configure has given us a Makefile. There we enter:

make

and wait a while. If all went ok, then we can do a “sudo make install”, but the files are installed to the wrong directory. Check if it says the following:

/usr/bin/install -c   opencl.dll.so /usr/local/lib/wine/opencl.dll.so /usr/bin/install -c  -m 644  opencl.dll.fake /usr/local/lib/wine/fakedlls/opencl.dll

In that case just type in (on 32 bit):

sudo /usr/bin/install -c   opencl.dll.so /usr/lib/wine/opencl.dll.so sudo /usr/bin/install -c  -m 644  opencl.dll.fake /usr/lib/wine/fakedlls/opencl.dll

Or on 64 bit:

sudo /usr/bin/install -c   opencl.dll.so /usr/lib32/wine/opencl.dll.so sudo /usr/bin/install -c  -m 644  opencl.dll.fake /usr/lib32/wine/fakedlls/opencl.dll

Enjoy!

Never an “err:module:import_dll Library OpenCL.dll (which is needed by L”SomeSpaceyOpenCLProgram.exe”) not found” error anymore! Know wine is still not 100% Windows-compatible, so you might get other errors. Anyhow, have fun with it and post working and not-working software in the comments.