# Adding custom function to backend kernels

**URL:** <https://pyfr.discourse.group/t/adding-custom-function-to-backend-kernels/1010>\
**Category:** Development\
**Created:** [1 January 2024 14:43 UTC](https://pyfr.discourse.group/t/adding-custom-function-to-backend-kernels/1010 "2024-01-01T14:43:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Frankx9](https://avatars.discourse-cdn.com/v4/letter/f/3e96dc/32.png) [@Frankx9](https://pyfr.discourse.group/u/Frankx9)\
**Post date:** [1 January 2024 14:43 UTC](https://pyfr.discourse.group/t/adding-custom-function-to-backend-kernels/1010/1 "2024-01-01T14:43:54Z")

</div>

Hi,

I would like to know how can I add a function on the backend. I tried with different syntax involving ` __global__  __host__  __device__ ` but none of them worked.  
I was tried to implement a function within a BC mako kernel.

Where can I put such a function if this is something which is possible to accomplish?

Thanks a lot,

Best regards

---

<div class="post-metadata">

**Author:** ![WillT](https://avatars.discourse-cdn.com/v4/letter/w/bc79bd/32.png) [@WillT](https://pyfr.discourse.group/u/WillT)\
**Post date:** [2 January 2024 10:40 UTC](https://pyfr.discourse.group/t/adding-custom-function-to-backend-kernels/1010/2 "2024-01-02T10:40:14Z")

</div>

When you say you want to add a function on the backend, do you mean that you want to add a function that is called within a kernel?

Have you tried just using a mako macro? This is straightforward to implement in pyfr and it is worth understanding the performance of that option before trying something more complicated.
