Intel® oneAPI DPC++/C++ Compiler
Talk to fellow users of Intel® oneAPI DPC++/C++ Compiler and companion tools like Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and Intel® Distribution for GDB*

Access member functions inside kernel

student4
Beginner
1,229 Views

Hi,

I have attached my codes(my_trial_dpcpp.cpp)
When I run this program, it shows an error: implicit capture of this is not allowed in kernel functions.
Is there a way I can access member function in kernel code.
I appreciate your help.
Thank you.

 

0 Kudos
5 Replies
VarshaS_Intel
Moderator
1,201 Views

Hi,

 

Thanks for reaching out to us.

 

We have made some changes to your source code in order to run without any errors. Please find the attached source code and the below screenshot to compile and run the code.

test.png

Please let us know if you face any issues while running the code.

 

Thanks & Regards,

Varsha

 

0 Kudos
student4
Beginner
1,178 Views

Hi,

 

Thanks a lot for the response.

I have the following issues:

  1. When I uncomment findNext function, I see an error in at 'extern': invalid storage class for a class member
  2. I am trying to use findNext function inside findBest. Is there a way to do so? 

I appreciate your help.

 

Thank you.

0 Kudos
VarshaS_Intel
Moderator
1,139 Views

Hi,


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


Thanks & Regards,

Varsha


0 Kudos
Mariya_P_Intel
Moderator
1,058 Views

Hi  @student4,

If you would like to call findNext() function from kernel and findNext() does not use non-static members of class Sample (vectors B and shat), then just add static keyword to fix the compilation:

static complex<float> findNext(sycl::accessor <complex<float>>BAccess)
{
	complex<float> c = BAccess[0];
	return c;
}

Thanks,

Mariya

0 Kudos
Mariya_P_Intel
Moderator
1,000 Views

Hi @student4,

There was no feedback from you on this thread for a week.

I assume that the above recommendation helped and stop monitoring this thread.


Thanks,

Mariya


0 Kudos
Reply