OpenCL
From charlesreid1
Contents
Installing on Mac OS X
April 2017
Checking Hardware
Open Apple Menu > About This Mac > System Information
Click "Graphics/Displays" on the left hand menu:
Intel Iris Graphics 6100: Chipset Model: Intel Iris Graphics 6100 Type: GPU Bus: Built-In VRAM (Dynamic, Max): 1536 MB Vendor: Intel (0x8086) Device ID: 0x162b Revision ID: 0x0009
OpenGL and OpenCL Versions
Apple lists the different graphic cards and the corresponding versions of OpenGL and OpenCL that are compatible here: https://support.apple.com/en-us/HT202823
OpenGL - version 4.1
OpenCL - version 1.2
Intel doesn't provide any Apple drivers, because Apple wants you to go through Apple. Go figure.
Link to OpenCL software for Mac: https://developer.apple.com/opencl/
OpenCL Binary
The openclc binary is located in /System/Library/Frameworks/OpenCL.framework/Libraries/openclc
Hello World
Here's a link to an OpenCL Hello World guide using XCode: [1]
Building from the command line: [2]
Link to the code of OpenCL: [3]
If you just compile it without any flags, it won't work:
$ /System/Library/Frameworks/OpenCL.framework/Libraries/openclc hello.c In file included from hello.c:61: In file included from /System/Library/Frameworks/OpenCL.framework/Headers/opencl.h:12: In file included from /System/Library/Frameworks/OpenCL.framework/Headers/cl.h:28: /System/Library/Frameworks/OpenCL.framework/Headers/cl_platform.h:357:18: fatal error: 'xmmintrin.h' file not found #include <xmmintrin.h> ^ 1 error generated.
The compiler command needs to use the -I
flag:
$ cd ~/OpenCL_Hello_World_Example $ find /System/Library/Frameworks -name "xmmintrin.h" /System/Library/Frameworks/OpenCL.framework/Versions/A/lib/clang/2.0/include/xmmintrin.h $ /System/Library/Frameworks/OpenCL.framework/Libraries/openclc -framework OpenCL \ -I/System/Library/Frameworks/OpenCL.framework/Versions/A/lib/clang/2.0/include hello.c $ ./a.out Computed '1024/1024' correct values!