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

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

Anitha
Beginner
1,082 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
1,059 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


0 Kudos
Anitha
Beginner
1,051 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

0 Kudos
VarshaS_Intel
Moderator
1,023 Views

Hi,


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


Thanks & Regards,

Varsha


0 Kudos
VarshaS_Intel
Moderator
980 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


0 Kudos
Anitha
Beginner
969 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

0 Kudos
VarshaS_Intel
Moderator
938 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


0 Kudos
VarshaS_Intel
Moderator
916 Views

Hi,


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


Thanks & Regards,

Varsha


0 Kudos
VarshaS_Intel
Moderator
904 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


0 Kudos
Anitha
Beginner
893 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

0 Kudos
Reply