clMathLibraries / clBLAS

a software library containing BLAS functions written in OpenCL
Apache License 2.0
839 stars 240 forks source link

Example running on GPUs not CPU #60

Closed KCErb closed 9 years ago

KCErb commented 9 years ago

Hi again all,

I've managed to get the README example for SGEMM working through my Ruby FFI into clBLAS but for some reason it will only run on my GPUs, not the CPU. A collaborator of mine is using identical code and it's running just fine on his CPU, so I don't suspect the code.

The exact issue is that I'm getting an INVALID_EVENT error from openCL. So it seems that for some reason the kernel isn't getting enqueued on my CPU and the event isn't getting created.

Is there any relevant system information I could give that would be helpful?

Me and my collaborator are both using Intel CPUs. I'm on openCL 1.1.

I don't really expect anyone to dig into the Ruby FFI for me (though that would be awesome) but perhaps you can give me a direction to bug hunt?

pavanky commented 9 years ago

@KCErb which OS are you on ?

KCErb commented 9 years ago

Yup that's a good place to start :blush:

I'm on OS X 10.10.1

pavanky commented 9 years ago

@KCErb This is a known issue. The CPU implementation of OpenCL on OSX is a little bit funky. While it does not break the OpenCL spec, their implementation makes it harder to write a general purpose library. For example, the maximum workgroup size supported for some kernels changes to "1" which makes the code inherently serial at that point and breaks the assumptions about the minimum number of threads that can be used.

The CPU implementations work on other operating systems because they are implemented by the hardware manufacturers instead of Apple.

The bottom line is that it is very hard to support CPUs on OSX.

KCErb commented 9 years ago

Oh, OK then. That's the sorta answer I like to hear!

Thanks @pavanky

(In case my tone could be misinterpreted I'm not being sarcastic. I really do like straightforward known answers. Sort of a bummer that OS X makes it hard, but it's not a big deal in the long run.)