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

How to call class function inside a parallel_for having queue as a parameter

Anitha
Beginner
576 Views

Hi,

 

I tried this

q.parallel_for(nd_range<1>((16), (16)), [=](nd_item<1> item)

{    auto index = item.get_global_id(0);

      classA.func(a[index], q);

});

void classA::func(float *a, queue & my_queue)

{

}

 

But got this error

Kernel parameter has non_trivially copy constructible class/struct type 'sycl::queue'

Labels (1)
0 Kudos
9 Replies
VarshaS_Intel
Moderator
553 Views

Hi,


Thanks for posting in Intel Communities.


Could you please provide us with the OS details and the version of dpcpp you are using?


Could you please provide us with a complete sample reproducer code to investigate more at our end?


Thanks & Regards,

Varsha


Anitha
Beginner
545 Views

Hi,

 

OS details:

OS - Redhat enterprise Linux 8.0

Processor - Intel Xeon(R) 16 - COMPUTE UNITS

OS type - 64-bit

 

ToolKit versions:

Basekit version - 2021.2.0-2883

Hpckit version - 2021.2.0-2997

Dpcpp compiler version - 2021.2.0-610

 

Code has been attached.

 

Thanks & Regards,

Anitha

VarshaS_Intel
Moderator
517 Views

Hi,


We are working on your issue. We will get back to you soon.


Thanks & Regards,

Varsha


VarshaS_Intel
Moderator
474 Views

Hi,


Could you please let us know the use case of passing the queue as a parameter and calling it inside a kernel?


In your code(fft.cpp) you are submitting a queue inside the function definition which is being called inside a kernel. So, indirectly it became a recursive call. Recursion is not supported by the SYCL.


And also, if you want to use FFT with SYCL kernels please find the path where you can find the samples for it in C:\Program Files (x86)\Intel\oneAPI\mkl\latest\examples\examples_dpcpp.zip\dpcpp\dft\source


Thanks & Regards,

Varsha


Anitha
Beginner
463 Views

Hi,

 

Here we are trying to do fft 16 times for different set of input's using for loop.

 

To get better execution time we thought of making it parallel we used parallel_for and passed queue as a parameter which is required by a fft.

 

Thanks and Regards,

Anitha

VarshaS_Intel
Moderator
432 Views

Hi,


>>passed queue as a parameter which is required by a fft.

Could you please try the samples if you want to use FFT with SYCL kernels please find the path where you can find the samples for it in C:\Program Files (x86)\Intel\oneAPI\mkl\latest\examples\examples_dpcpp.zip\dpcpp\dft\source


Could you please let us know what commands are you using at the time of compilation of your code? And also, could you please provide the complete error log?


Thanks & Regards,

Varsha


VarshaS_Intel
Moderator
410 Views

Hi,


Could you please provide us with the steps/command you have followed ?


Thanks & Regards,

Varsha


VarshaS_Intel
Moderator
398 Views

Hi,


We have not heard back from you. This thread will no longer be monitored by Intel. If you need further assistance, please post a new question.


Thanks & Regards,

Varsha


Anitha
Beginner
387 Views

Hi,

 

We are using eclipse to build the program.

Command : dpcpp

All options : -g -Wall -O0 -l /parallelFor

 

And using terminal to run.

./parallelFor

 

But while building itself we are getting error.

 

Thanks & Regards,

Anitha

Reply