- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
In MSVC 2019 I created a new OpenCL CPU runtime template project and tried to build it (no changes were made to the code)
Below is the error I get:
Severity Code Description Project File Line Suppression State
Error CL Failed to get platform id...: 0 (CL_SUCCESS) CPUOpenCLProjectforWindows1 C:\Users\epatt\source\repos\CPUOpenCLProjectforWindows1\Template.cl 1
Severity Code Description Project File Line Suppression State
Error MSB3721 The command ""C:\Program Files (x86)\IntelSWTools\system_studio_2020\OpenCL\sdk\bin\x86\ioc32.exe" -cmd=build -input="C:\Users\epatt\source\repos\CPUOpenCLProjectforWindows1\Template.cl" -output="Debug\Template.out" -VS -device=CPU -targetos=current -bo=" "" exited with code 14. CPUOpenCLProjectforWindows1 C:\Program Files (x86)\IntelSWTools\system_studio_2020\OpenCL\sdk\BuildCustomizations\IntelOpenCL.targets 49
I attached my clinfo output
My laptop (Dell Inspiron 5567 Gen 7) has the Intel® Core™ i5-7200U Processor with integrated Intel® HD Graphics 620. There are no other graphics cards.
The Device Manager says the graphics driver is 30.0.101.1660 3/18/2022. It was installed using the Intel Support assistant
The SDK I installed is intel_sdk_for_opencl_applications_2020.3.494
I attached the MSVC Help About info
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Sure, I will let you know when the BKM is published. And now you can refer to the SYCL 2020 spec https://registry.khronos.org/SYCL/specs/sycl-2020/pdf/sycl-2020.pdf, and please go to Appendix C: OpenCL backend specification. And also attaching a simple code for your reference, please compile the code with the command "dpcpp test.cpp -lOpenCL".
Thanks
コピーされたリンク
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
My apologies for creating duplicates. Please delete the following duplicate posts
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Here is another data point. I compiled the program from
https://web.engr.oregonstate.edu/~mjb/cs575e/OpenclFiles/printinfo.cpp
on my machine and got the attached output (first couple lines are below)
*****************************************
Number of Platforms = 1
Platform #0:
Name = 'Intel(R) OpenCL HD Graphics'
Vendor = 'Intel(R) Corporation'
Version = 'OpenCL 3.0 '
Profile = 'FULL_PROFILE'
Number of Devices = 1
Device #0:
Type = 0x0004 = CL_DEVICE_TYPE_GPU
************************************
The oregonstate.edu code that outputs the "Number of Platforms" is below. So even though the ioc32.exe says it "failed to get platform id", the oregon state program was able to get it on my system. So why can't the ioc32.exe program get the id?
cl_uint numPlatforms;
status = clGetPlatformIDs(0, NULL, &numPlatforms);
if (status != CL_SUCCESS)
fprintf(stderr, "clGetPlatformIDs failed (1)\n");
fprintf(stderr, "Number of Platforms = %d\n", numPlatforms);
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
The clinfo output shows only one platform which is GPU device. Paying close attention to ioc32.exe invocation, it specifies the -device=CPU which means it is targeting CPU device and the machine doesn't have a CPU runtime installed since the clinfo doesn't show a CPU platform. Please check the properties to check if the target device for the template project is set to CPU device.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
@Anoop_M_Intel Thank-you for the reply.
I checked my PC's apps and did not see the CPU Runtime installed. Consequently, I downloaded and installed 2022.0.3 version and now Windows says I have it installed
Now clinfo says I have two devices (output attached)
Platform Name Intel(R) OpenCL HD Graphics
Platform Vendor Intel(R) Corporation
Platform Version OpenCL 3.0
And also
Platform Name Intel(R) OpenCL
Number of devices 1
Device Name Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
Device Vendor Intel(R) Corporation
Unfortunately, I still get an error, but at least it has changed:
Severity Code Description Project File Line Suppression State
Error CL Failed to initialize driver version from platform...: 0 (CL_SUCCESS) CPUOpenCLProjectforWindows1 C:\Users\epatt\source\repos\CPUOpenCLProjectforWindows1\Template.cl 1
Build started...
1>------ Build started: Project: CPUOpenCLProjectforWindows1, Configuration: Debug Win32 ------
1>Preprocessing: Template.cl
1>Using build options: -I "C:\Users\epatt\source\repos\CPUOpenCLProjectforWindows1"
1>C:\Users\epatt\source\repos\CPUOpenCLProjectforWindows1\Template.cl : error CL: Failed to initialize driver version from platform...: 0 (CL_SUCCESS)
1>Build failed!
1>
1>C:\Program Files (x86)\IntelSWTools\system_studio_2020\OpenCL\sdk\BuildCustomizations\IntelOpenCL.targets(49,5): error MSB3721: The command ""C:\Program Files (x86)\IntelSWTools\system_studio_2020\OpenCL\sdk\bin\x86\ioc32.exe" -cmd=build -input="C:\Users\epatt\source\repos\CPUOpenCLProjectforWindows1\Template.cl" -output="Debug\Template.out" -VS -device=CPU -targetos=current -bo=" "" exited with code -1073740791.
1>Done building project "CPUOpenCLProjectforWindows1.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
This person also had the same issue
https://community.intel.com/t5/OpenCL-for-CPU/Failed-to-initialize-driver-version-from-platform-0-CL-SUCCESS/td-p/1274768?profile.language=en
Could it be that the 2020.3 SDK I installed won't work with the 2022.0.3 CPU runtime? I know the runtime is OpenCL 3.0, and my guess is that the SDK is OpenCL 2.x because it's 2020 vintage.
Regarding the template's target device, in MSVC project properties, is this what is should be set to? Intel(R) CPU (-device=CPU)
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Another data point: I changed the target to GPU and got this output - exited with code -1073740791
1>Device version: OpenCL 3.0 NEO
1>Device vendor: Intel(R) Corporation
1>Device profile: FULL_PROFILE
1>
1>Add info:
1> Maximum work-group size: 256
1> Compiler work-group size: (0, 0, 0)
1> Local memory size: 0
1> Preferred multiple of work-group size: 32
1> Minimum amount of private memory: 0
1> Amount of spill memory used by the kernel: 0
1>
1>Build succeeded!
1>
1>C:\Program Files (x86)\IntelSWTools\system_studio_2020\OpenCL\sdk\BuildCustomizations\IntelOpenCL.targets(49,5): error MSB3721: The command ""C:\Program Files (x86)\IntelSWTools\system_studio_2020\OpenCL\sdk\bin\x86\ioc32.exe" -cmd=build -input="C:\Users\epatt\source\repos\CPUOpenCLProjectforWindows1\Template.cl" -output="Debug\Template.out" -VS -device=GPU -targetos=current -bo=" "" exited with code -1073740791.
1>Done building project "CPUOpenCLProjectforWindows1.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hi,
Could you use OpenCL CPU Runtime, instead of OpenCL SDK? Maybe there are some compatibility issues between OpenCL CPU Runtime and OpenCL SDK. Could you uninstall OpenCL SDK and try again?
Thanks
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Thanks for the reply
I am not sure what you mean by "Could you use OpenCL CPU Runtime". I'd love to try it, but what I'm looking for is an OpenCL template so that I don't have to deal with MSVC configuration issues. The SDK has a template. Is the CPU Runtime supposed to have a template? I thought the CPU Runtime was just a driver that emulated GPUs.
I tried re-installing the SDK and get the same error. The "add/remove" programs don't actually say "SDK", but I assumed it was this app below since it's 2020 vintage is the same as the SDK I installed
Next, I thought I'd see if there are any OpenCL templates remaining after I uninstalled the SDK - which I hope see a CPU Runtime template. Alas, there are no MSVC 2019 templates.
Could you point me to instructions on how to setup an OpenCL project using the CPU Runtime? Better yet, perhaps a github example?
These are the templates available when I had the OpenCL SDK. But after uninstalling the SDK, there are no OpenCL templates. Does the CPU Runtime come with MSVC project examples hidden somewhere in c:\Program Files (x86)?
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hi,
OpenCL SDK is EOL, the version 2020 U3 is the last planned release of the OpenCL SDK. For more information, you can refer to this release notes https://www.intel.com/content/dam/develop/external/us/en/documents/opencl-sdk-2020-u3-release-notes.pdf, please go to the section "New in this Release".
And you can use runtime packages to build your OpenCL applications.
- To download the GPU runtimes:
Windows --- On the Graphics Driver Downloads (https://www.intel.com/content/www/us/en/support/products/80939/graphics.html) page, select the driver.
Linux --- On the General Purpose GPU Installation Guides (https://dgpu-docs.intel.com/installation-guides/index.html) page, follow the installation instructions for your operating system.
- To download the CPU runtimes:
Follow the instructions in the article https://www.intel.com/content/www/us/en/developer/articles/technical/intel-cpu-runtime-for-opencl-applications-with-sycl-support.html
Using OpenCL RT, there is no OpenCL templates in Visual Studio. Please try the following steps to check if you can build your OpenCL code,
- Create a CPP project, and write your code, for example,
#include <iostream>
#include <CL/cl.h>
int main()
{
cl_uint platformIdCount = 0;
clGetPlatformIDs(0, NULL, &platformIdCount);
std::cout << (int)platformIdCount << std::endl;
return (int)platformIdCount;
}
2. Open the project properties,
- Add the Opencl header files directories, for example "C:\Program Files (x86)\Intel\oneAPI\compiler\latest\windows\include\sycl"
- Add the OpenCL library directories, for example "C:\Program Files (x86)\Intel\oneAPI\compiler\latest\windows\lib\x86"
- Go to Linker --> Input, add "intelocl32.lib" to "Additional Dependencies".
Thanks
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hi, note that you only need an OpenCL implementation (AKA "runtime") installed to run an OpenCL application. To build an OpenCL application, you need OpenCL headers and an OpenCL library to link to. Here are a few GitHub repos that demonstrate how to build OpenCL applications, usually with the open-source OpenCL headers and OpenCL ICD loader library:
- The Khronos OpenCL SDK: https://github.com/KhronosGroup/OpenCL-SDK
- My SimpleOpenCLSamples: https://github.com/bashbaug/SimpleOpenCLSamples
- Richard Geldreich's simple_opencl repo: https://github.com/richgel999/simple_opencl
There are others too, but these are fairly common. If you find another that you like more, please let us know!
You'll still need one or more OpenCL implementations installed to run an OpenCL application after building, but from the output above it looks like you are able to enumerate the CPU and GPU OpenCL devices so this is setup correctly.
edit: fixed misspelled name
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
@Ben_A_Intel Thank-you so much for the links. I started with Richard's simple_opencl and got it running. It's amazing that it can generate the .sln using cmake.
Then I tried the SimpleOpenCLSamples. This is a great sequence of opencl examples to learn how to run Opencl. I find the CMakeLists.txt easier to use than the .sln (it's hard to figure out where VS has particular parameters stored). One thing I'm still trying to figure out is how the examples with a .cl kernel get compiled by ioc64. You'd think you could search the CMakeLists.txt to see how it's done, but no luck.
I've yet to try the Khronos OpenCL SDK. I'm a bit leery of installing opencl SDKs after my experience with the intel_sdk_for_opencl_applications SDK, but I'll definitely give it a try.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
I attended the OneAPI workshop and noticed OpenCL is a downstream (for lack of a better word) of the SYCL (DPC++) compiler chain as shown in the snippet workshop slide snippet below.
Does this mean that if I install the OneAPI (I'm assuming this is an SDK too), will I be able to compile my opencl kernels? The reason I'm so dead set on opencl is that the company I work for has a large library built in OpenCL and I've made a personal quest (on my own time) to see if this library can be used on Intel chips.
Based on the size of the company's opencl lib, it would be a significant effort to migrate it from OpenCL to DPC++. They've also got a lot of gtests written to validate the opencl functionality.
So if it's possible to install OpenAPI and then compile existing OpenCL kernels, I can try that first, and then start teaching myself about migrating code from OpenCL to DPC++. If this process goes well, I could recommend a migration path to the company I work for.
Until I hear back, I'll continue with the Khronos OpenCL SDK mentioned above (hopefully it's installation doesn't muck up the OneAPI toolchain.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hi,
Sorry for the delay reply.
If you install the oneAPI, you can compile your opencl kernels, since the OpenCL CPU Runtime is shipped with oneAPI Base Toolkit now. You can download the oneAPI Base Toolkit from https://www.intel.com/content/www/us/en/developer/tools/oneapi/base-toolkit-download.html. And on Windows, you can only install OpenCL CPU RT, you can download the installer from https://www.intel.com/content/www/us/en/developer/articles/technical/intel-cpu-runtime-for-opencl-applications-with-sycl-support.html.
For the GPU runtime:
On Windows, please select the latest version of Intel graphics on the Graphics Driver Downloads page https://www.intel.com/content/www/us/en/support/products/80939/graphics.html
On Linux, please follow the installation instructions on this page https://dgpu-docs.intel.com/installation-guides/index.html for your operating system.
Thanks
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
@cw_intel Thanks, I have installed OneAPI and am working through the examples. If there are any that use DPC to call opencl, feel free to let me know.
Thanks again
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Sure, I will let you know when the BKM is published. And now you can refer to the SYCL 2020 spec https://registry.khronos.org/SYCL/specs/sycl-2020/pdf/sycl-2020.pdf, and please go to Appendix C: OpenCL backend specification. And also attaching a simple code for your reference, please compile the code with the command "dpcpp test.cpp -lOpenCL".
Thanks
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hi,
The BKM for the interoperability is ready, please refer to https://www.intel.com/content/www/us/en/developer/articles/technical/sycl-interoperability-study-opencl-kernel-in-dpc.html
Thanks
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Hi,
If you require additional assistance from Intel, please start a new thread as this thread will no longer be monitored by Intel.
Thanks.
