Error CL_DEVICE_NOT_AVAILABLE when calling clCreateContext (Intel Core2Duo, Intel OCL SDK 3.0 beta)
Intel OpenCL CPU needs at least SSE 4.1. The Core 2 Duo only goes up to SSSE3.
http://software.intel.com/en-us/articles/opencl-sdk-frequently-asked-questions#14
Edit: some version of the Core 2 Duo support SSE 4.1
Here is the list of supported processors for the Intel OpenCL drivers
http://software.intel.com/en-us/articles/opencl-release-notes#2
Some versions of Core 2 are not supported. " All other versions of Intel® Core™ 2 processors are not supported"
You can use, for example, CPU-Z to find out what version of SSE you CPU supports.
Install the AMD OpenCL CPU driver. It only needs SSE2. On windows I installed the Radeon GPU drivers even though I did not have a AMD GPU. It still installed the AMD OpenCL CPU drivers and it did not conflict with the Nvidia drivers. I don't know on Linux. But now I can use Intel CPU, AMD CPU, and Nvidia GPU OpenCL drivers.
CL_DEVICE_NOT_AVAILABLE using Intel Core 2 Duo E8500 CPU
"CL_DEVICE_NOT_AVAILABLE" has nothing to do with the SDK. It's due to the OpenCL device driver which is part of the video card device driver.
It's common to confuse the SDK and the OpenCL device driver. You develop the host code with the SDK but the kernel is compiled and run through the device driver. I often develop with the Intel SDK but I run my kernels on the CPU using the Intel video driver or the AMD Radeon drivers and on the GPU using the Nvidia video drivers (GTX590). I have all three video drivers installed in Windows. You don't have to have an AMD video card to instal the Radeon drivers.
So in your case you can use the AMD drivers to run your kernel on the CPU. They are much less restrictive than Intel's.
On windows I get faster results running my Kernel on my Sandy Bridge CPU using the Intel OpenCL drivers than AMD. However, on Linux the AMD driver runs my kernel faster on my Intel CPU than the Intel driver does.
Device says it is available, but can't create context in OpenCL
So a possible explanation could be that it's due to the Intel SDK as explained in that post. To quote the main idea:
Intel OpenCL CPU needs at least SSE 4.1. The Core 2 Duo only goes up
to SSSE3.
The solution given was:
Install the AMD OpenCL CPU driver. It only needs SSE2.
Install OpenCL on Ubuntu 14.04 and Nvidia
Since you want to use your nVidia GPU, you will need to install the nVida OpenCL runtime, which is part of the GPU driver. You should not need the Intel OpenCL SDK. A simple
sudo apt-get install nvidia-opencl-dev
should install everything you need. Alternatively, download nVidia CUDA 7.5 from https://developer.nvidia.com/cuda-downloads. This also includes OpenCL.
How to install libOpenCL.so on ubuntu
Looks like all I had to do is
sudo apt update
sudo apt install ocl-icd-opencl-dev
Thanks to Nick Weindberg
https://askubuntu.com/questions/796770/how-to-install-libopencl-so-on-ubuntu
Pause flag not present in cpuinfo?
The intel instruction set reference says:
This instruction was introduced in the Pentium 4 processors,
but is backward compatible with all IA-32 processors.
In earlier IA-32 processors, the PAUSE instruction operates
like a NOP instruction. The Pentium 4 and Intel Xeon processors
implement the PAUSE instruction as a delay.
So your core 2 duo does have it, but even on processors that don't it will still work like a NOP
.
#error SSE2 instruction set not enabled when including emmintrin.h
You need to call
set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "-msse -msse2 -msse3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse -msse2 -msse3")
The CMAKE_C_FLAGS
are applied to C files, and from your post's C++ tag, I guess you're compiling C++ files, hence the need to change CMAKE_CXX_FLAGS
instead.
As for the positioning of the quotation marks; in your original version, you were setting CMAKE_C_FLAGS
to contain 2 separate entries, the first being the starting value of CMAKE_C_FLAGS
and the second being the string "-msse -msse2 -msse3"
.
CMake holds lists like this as semi-colon separated entries. In the case of CMAKE_<lang>_FLAGS
, invariably they are a single value comprised of a string containing all the required flags.
Related Topics
Compling C++ Code Using Command Line
Find and Replace a Word with Another in All File Names of a Directory
Can't Find Unexpected Operator (Bash Error)
After Segfault: Is There a Way, to Check If Pointer Is Still Valid
How to Print Multiple Strings on New Line in the Assembly Language
How to Create Shell Variable with Dashes
How to Run a Cron Job at Every 5 Hour Interval
Bash Syntax Error: Unaccepted Token Elif
Compile Git for 32-Bit Linux on Shared Hosting
How to Disable Hardware Prefetcher in Core I7
Find Command Find Directories That Were Created After a Certain Date Under Linux/Cygwin
How to Change the Permissions in Openshift Container Platform
Why Do I Get /Etc/Cups Conflicts Between Attempted Installs in Yocto