Intel® oneAPI Base Toolkit
Support for the core tools and libraries within the base toolkit that are used to build and deploy high-performance data-centric applications.
419 Discussions

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

UmarAkhtar
Beginner
751 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
734 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/1184545

Let us know if it helps.

Regards,

Vidya.

 

0 Kudos
VidyalathaB_Intel
Moderator
693 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.


0 Kudos
VidyalathaB_Intel
Moderator
668 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.


0 Kudos
Reply