- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey there,
I'm evaluating DPC++ within the context of a new project mainly requiring fast (inverse) complex FFTs using 10+ Mio points and complex-valued matrix operations as provided by oneMKL (and possibly/implicitly running oneTBB under the hood).
Within that context
looked very appealing.
I'm able to build the example code (USM version) found under
https://github.com/oneapi-src/oneAPI-samples/tree/master/Libraries/oneMKL/fourier_correlation
using Visual Studio 2017 and 2019 after successfully installing the Intel oneAPI Base Toolkit v. 2022.
The example as is works (for certain N values such as 4096 while not for 8192 (?!)) on my Dell Precision 7540 using sycl::queue Q(sycl::default_selector{}); which by default chooses my poor Intel UHD Graphics 630 instead of my powerful i9-9880H CPU, but aborts the moment I try to select the CPU using sycl::cpu_selector{}.
As such I took a step back to try some very basic code where SYCL is able to properly detect the CPU but throws an exception "Native API failed. Native API returns: CL_OUT_OF_HOST_MEMORY" when trying to use it as part of a SYCL queue constructor.
For one or another reason the system does not allow me to attach the .cpp file or a corresponding .txt file as "not matching its file extension" (?!) - so you find my code at the bottom of this text.
Probably (hopefully) I'm overlooking something pretty essential. I noticed that sometimes OpenCL is still specified during linking.
Any help to deblock my evaluation of DCP++ would be highly appreciated.
Thanks (and already best wishes),
Frans
------------------
#include <CL/sycl.hpp>
#include <iostream>
int main()
{
// Works as expected and shows " Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz"
// Verifying the driver version because of C:\Program Files (x86)\Intel\oneAPI\compiler\2022.0.0\windows\bin\sycl.conf
// which claims to require Intel CPU with driver version >= 2019.*.11.*
for (auto device : sycl::device::get_devices(sycl::info::device_type::cpu))
{
std::cout << " " << device.get_info<sycl::info::device::name>() << std::endl;
std::cout << " " << device.get_info<sycl::info::device::driver_version>() << std::endl;
}
// Create queue to use the CPU device explicitly -- throws a "Native API failed. Native API returns: CL_OUT_OF_HOST_MEMORY" (?!)
// Using "default_selector" works but uses the poorly performing GPU "Intel(R) UHD Graphics 630"
try
{
sycl::queue Q(sycl::cpu_selector{});
std::cout << "Selected device: " <<
Q.get_device().get_info<sycl::info::device::name>() << std::endl;
std::cout << " -> Device vendor: " <<
Q.get_device().get_info<sycl::info::device::vendor>() << std::endl;
}
catch (sycl::exception& e)
{
std::cout << "SYCL exception: " << e.what() << std::endl;
}
return 0;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
>>doing some configuration (defining some environmental variables?) which is essential for Intel oneAPI- based code to work properly.
Intel provides a "setvars.bat " script that defines the required environment variables to work properly with Intel oneAPI.
You can find the script file in below path:
C:\Program Files (x86)\Intel\oneAPI\setvars.bat
Could you please try sourcing the setvars.bat script before you run the source code and do let us know if you still face any issues?
Please find the below steps to source the script:
cd C:\Program Files (x86)\Intel\oneAPI
setvars.bat
Please find the below screenshot for more details
Thanks & Regards,
Noorjahan.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for reaching out to us.
Could you please provide us the complete log which is generated by the below commands in either one of the ways mentioned below
For Intel Command prompt:
>set SYCL_PI_TRACE=2
>Source.exe
You can find the screenshot below:
For Visual Studio:
Under Configuration Properties->Debugging->Environment
Set SYCL_PI_TRACE=2
You can find the screenshot below regarding the settings:
Could you please confirm whether you are running any other application that utilizes a CPU?
Because the error you are facing "Native API failed. Native API returns: CL_OUT_OF_HOST_MEMORY" occurs if there is a failure to allocate resources required by the OpenCL implementation on the host.
Please find the below statement that can give the available memory depending on the amount of computer system memory and the operating system (32 or 64 bit)
std::cout << "Max Global memory size: " << Q.get_device().get_info<cl::sycl::info::device::global_mem_size>() << "\n";
Please provide us with the result by adding the above statement in your code snippet.
Thanks & Regards,
Noorjahan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey Noorjahan,
thanks for getting back to me.
In the meantime I found out that the program properly works when invoked from "Intel oneAPI command prompt for Intel 64 for Visual Studio 2017 (or 2019)".
Same holds when running it using the MVS Debug Console
However, when using the standard Windows10 "Command Prompt", the exception is thrown.
So apparently the "Intel oneAPI command prompt for Intel 64 for Visual Studio 2017 (or 2019)" is doing some configuration (defining some environmental variables?) which is essential for Intel oneAPI- based code to work properly. Where can I find more information about the difference between using the standard command prompt and the "Intel oneAPI command prompt"?
Thanks and regards,
Frans
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
>>doing some configuration (defining some environmental variables?) which is essential for Intel oneAPI- based code to work properly.
Intel provides a "setvars.bat " script that defines the required environment variables to work properly with Intel oneAPI.
You can find the script file in below path:
C:\Program Files (x86)\Intel\oneAPI\setvars.bat
Could you please try sourcing the setvars.bat script before you run the source code and do let us know if you still face any issues?
Please find the below steps to source the script:
cd C:\Program Files (x86)\Intel\oneAPI
setvars.bat
Please find the below screenshot for more details
Thanks & Regards,
Noorjahan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, Noorjahan, is indeed what I looked for ... plenty of information to digest ... oneAPI is "huge".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for accepting our solution.
If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.
Thanks & Regards,
Noorjahan.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page