Intel® oneAPI Data Parallel C++
Support for Intel® oneAPI DPC++ Compiler, Intel® oneAPI DPC++ Library, Intel ICX Compiler , Intel® DPC++ Compatibility Tool, and GDB*
583 Discussions

Evaluating DPC++ using simple Fourier correlation demo code

Frans1
Beginner
998 Views

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

https://www.intel.com/content/www/us/en/developer/videos/implement-the-fourier-correlation-algorithm.html

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;
}

0 Kudos
1 Solution
NoorjahanSk_Intel
Moderator
925 Views

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

NoorjahanSk_Intel_0-1640262706135.png

 

 

Thanks & Regards,

Noorjahan.

 

View solution in original post

0 Kudos
5 Replies
NoorjahanSk_Intel
Moderator
966 Views

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:

NoorjahanSk_Intel_0-1640172706492.png

 

 

For Visual Studio:

 

Under Configuration Properties->Debugging->Environment

Set SYCL_PI_TRACE=2

 

You can find the screenshot below regarding the settings:

 

NoorjahanSk_Intel_1-1640172726631.png

 

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.

 

0 Kudos
Frans1
Beginner
955 Views

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)".

Frans1_0-1640174149545.png

Same holds when running it using the MVS Debug Console

Frans1_2-1640174758301.png

However, when using the standard Windows10 "Command Prompt", the exception is thrown.

Frans1_1-1640174253845.png

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

0 Kudos
NoorjahanSk_Intel
Moderator
926 Views

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

NoorjahanSk_Intel_0-1640262706135.png

 

 

Thanks & Regards,

Noorjahan.

 

0 Kudos
Frans1
Beginner
915 Views

Thank you, Noorjahan, is indeed what I looked for ... plenty of information to digest ... oneAPI is "huge".

 

0 Kudos
NoorjahanSk_Intel
Moderator
885 Views

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.


0 Kudos
Reply