Intel® oneAPI Base Toolkit
Support for core tools and libraries to build and deploy high-performance data-centric applications
273 Discussions

Calling a function of an open-source project in the kernel

UmarAkhtar
Beginner
310 Views
Hello, I have currently integrated oneAPI into an open-source physics program called Geant4 and it is my goal to accelerate the event loop of this program.

My question is if there is a way to call a function within the kernel with its parameters and if this is not possible, what options would be available to successfully do this?

I have toyed around with the idea of stripping the function down to its barebones and running that through the kernel though I do not know of that approach would work.

Any advice would be greatly appreciated.
0 Kudos
3 Replies
VidyalathaB_Intel
Moderator
293 Views

Hi,

Thanks for reaching out to us.

Yes, you can call a function within the kernel. SYCL supports multiple ways to express a kernel.

You can create a function within the source code and can access that inside the kernel or create a function in different file and include that file in your main program and then call the function inside a kernel with proper arguments.

There is also another way where you can call a function from within the kernel is by using “Interoperability with API-Defined Source Languages or kernel objects” which means , the contents of the kernel are described as source code or using an intermediate representation that is not defined by SYCL, but the kernel objects are still created using SYCL API calls.

Please follow the below link in which you can get a clear idea on different ways of calling a function inside kernel and some samples are also provided on how to call a function from within the kernel.

https://community.intel.com/t5/Intel-oneAPI-Data-Parallel-C/Calling-a-function-in-kernel-scope/m-p/1...

Let us know if it helps.

Regards,

Vidya.

 

VidyalathaB_Intel
Moderator
252 Views

Hi,

Reminder:

Could you please confirm whether your issue is resolved? If yes let us know if we can close this thread from our end.

Regards,

Vidya.


VidyalathaB_Intel
Moderator
227 Views

Hi,

As we have not heard back from you, we assume that your issue has been resolved. We will no longer respond to this thread. If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only.

Regards,

Vidya.


Reply