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

“compile_program_error” when running a SYCL code on GPU

PC-1
Beginner
1,395 Views

Hello, I'm new to sycl. The following code is modified from an example in sycl specification

The code can run on cpu, but when trying to run GPU (use "gpu_selector_v"), it shows run time error:

 

like Unhandled exception at 0x00007FFC636B051C in XXXXX.exe: Microsoft C++ exception: sycl::_V1::compile_program_error at memory location 0x0000000B7D757A70.

 

I use Visual Studio 2022 with Intel oneapi base toolkit (2023.0). GPU is Intel Arc A770.

BTW, I do can run oneapi dpc++ example: "oneAPI-samples-2023.0.0\DirectProgramming\DPC++\CombinationalLogic\mandelbrot" on GPU.

 

 

Thanks for your help.

 

Best 

___________________

const int N = 1024;
const int L = 256;

sycl::buffer<int> valuesBuf(N);
{
sycl::host_accessor a(valuesBuf,sycl::write_only);
for (int i = 0; i < N; i++) {
a[i] = i;
}
//destruct host_accessor
}

int sumResult = 0;
sycl::buffer<int> sumBuf(&sumResult, 1);

sycl::queue Q(sycl::gpu_selector_v);
Q.submit([&](sycl::handler& cgh) {

auto inputValues = valuesBuf.get_access<sycl::access_mode::read>(cgh);
auto sumReduction = sycl::reduction(sumBuf, cgh, sycl::plus<>());

cgh.parallel_for(sycl::nd_range<1> {N, L}, sumReduction,
[=](sycl::nd_item<1> it, auto& sum) {
sum += inputValues[it.get_global_id()];
});
});

int sum = numeric_limits<int>::max();
{
sycl::host_accessor sumBuf_hacc(sumBuf, sycl::read_only);
sum = sumBuf_hacc[0];
}

___________________________________________________

 

0 Kudos
1 Solution
VarshaS_Intel
Moderator
1,354 Views

Hi, 

 

Thanks for posting in Intel Communities. 

 

Could you please try following the below steps: 

 

1.Try changing your global and local range for example (N=512, L=512 or N=512, L=256). 

If your issue still persists, then please provide the below details:

2. Could you please provide your OS and Hardware details

3. Could you please add the below lines of code in the sample code of mandelbrot and provide us with the output/results of the sample mandelbrot code while running it on GPU(visual studio output)?

cout << "Device max work group size: "    <<d.get_info<info::device::max_work_group_size>() << "\n";
cout << "Device max work item dimensions: " <<d.get_info<info::device::max_work_item_dimensions>() << "\n";

4. And also, could you please let us know the Visual Studio 2022 version you are using? Please check the below link for the Visual Studio compatibility with Intel Compilers

https://www.intel.com/content/www/us/en/developer/articles/reference-implementation/intel-compilers-compatibility-with-microsoft-visual-studio-and-xcode.html 

 

Thanks & Regards,

Varsha

 

View solution in original post

0 Kudos
6 Replies
VarshaS_Intel
Moderator
1,355 Views

Hi, 

 

Thanks for posting in Intel Communities. 

 

Could you please try following the below steps: 

 

1.Try changing your global and local range for example (N=512, L=512 or N=512, L=256). 

If your issue still persists, then please provide the below details:

2. Could you please provide your OS and Hardware details

3. Could you please add the below lines of code in the sample code of mandelbrot and provide us with the output/results of the sample mandelbrot code while running it on GPU(visual studio output)?

cout << "Device max work group size: "    <<d.get_info<info::device::max_work_group_size>() << "\n";
cout << "Device max work item dimensions: " <<d.get_info<info::device::max_work_item_dimensions>() << "\n";

4. And also, could you please let us know the Visual Studio 2022 version you are using? Please check the below link for the Visual Studio compatibility with Intel Compilers

https://www.intel.com/content/www/us/en/developer/articles/reference-implementation/intel-compilers-compatibility-with-microsoft-visual-studio-and-xcode.html 

 

Thanks & Regards,

Varsha

 

0 Kudos
PC-1
Beginner
1,316 Views

Thanks for your reply, Varsha. It looks like not a max work group size issue. I compared a DPC++ project example provided by Visual Studio with my SYCL project. After changing some project properties, the code can run on my GPU. 

Anyway,  I appreciate your help!

 

Best 

PC

0 Kudos
lzy
Beginner
1,032 Views

Hello,

Sorry to bother you, but i have met a same problem with the same error.

Could you please tell me how to fix it?

Thanks a lot for your help.

 

Thanks & Regards

Lzy

0 Kudos
PC-1
Beginner
987 Views

Eventually I found that I made a stupid mistake. My GPU does not support "double" (FP64), so do not try to compile "double" on your GPU. Hope this could offer some help.

0 Kudos
lzy
Beginner
964 Views

Thank you very much for your response. This method has indeed successfully resolved my issue. I sincerely appreciate your assistance. Thank you.

 

Best wishes.

0 Kudos
VarshaS_Intel
Moderator
1,265 Views

Hi,


>>After changing some project properties, the code can run on my GPU.

Glad to know that your issue is resolved. 


>>I appreciate your help!

Thanks for accepting the solution. This thread will no longer be monitored by Intel. If you have any other queries, please start a new thread.


Have a good day!


Thanks & Regards,

Varsha

 


0 Kudos
Reply