HandsOnOpenCL/Exercises-Solutions

Exercise 6 C and Cpp solutions are incorrect

Closed this issue · 3 comments

reuk commented

If I run make ; ./mult in Solutions/Exercise06/C or Solutions/Exercise06/Cpp I get the following output:

===== Sequential, matrix mult (dot prod), order 1024 on host CPU ======
 7.67 seconds at 279.9 MFLOPS 

===== OpenCL, matrix mult, C(i,j) per work item, order 1024 ======
 5.01 seconds at 428.9 MFLOPS 

 Errors in multiplication: 168394460495872.000000

This is the output from the C executable, although the Cpp one gives similar results.

Am I correct in thinking that the error should be somewhat smaller?
Is this a known bug?

I'm running OS X 10.9.5, Core i7, Intel HD Graphics 4000, NVIDIA GeForce GT 650M 1024 MB.
I believe the OpenCL kernel runs on the GeForce in these examples.

Hi reuk,

Thanks for the issue. There shouldn't be any errors at all - if it's that big something weird is going on. I'll look into it.

I presume the rest of the matmul codes also have big errors on your GPU (Solutions 6-8)?

reuk commented

Yes, I can confirm that they all have similar error values.
The error values are not constant between the executables (or even multiple runs of the same executable), but they're always of a similar (very great) magnitude.

Thanks for looking into this.

This is a known issue with the embedded GPU in that version of the MacBook.

The updated version of the solution (v1.2) allows you to specify which device as follows

./mult --list
./mult --device 2

This will allow you to run on the dedicated graphics card.