Intel® oneAPI Data Parallel C++
Support for Intel® oneAPI DPC++ Compiler, Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and GDB*
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

Access member functions inside kernel

student4
Beginner
402 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
374 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

 

student4
Beginner
351 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.

VarshaS_Intel
Moderator
312 Views

Hi,


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


Thanks & Regards,

Varsha


Mariya_P_Intel
Moderator
231 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

Mariya_P_Intel
Moderator
173 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


Reply