# Is adapting a NTT done in a GPU to OpenFHE difficult?

**URL:** <https://openfhe.discourse.group/t/is-adapting-a-ntt-done-in-a-gpu-to-openfhe-difficult/1114>\
**Category:** Library Questions\
**Created:** [March 9, 2024, 1:43pm UTC](https://openfhe.discourse.group/t/is-adapting-a-ntt-done-in-a-gpu-to-openfhe-difficult/1114 "2024-03-09T13:43:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jomivaan](https://avatars.discourse-cdn.com/v4/letter/j/53a042/32.png) [@jomivaan](https://openfhe.discourse.group/u/jomivaan)\
**Post date:** [March 9, 2024, 1:43pm UTC](https://openfhe.discourse.group/t/is-adapting-a-ntt-done-in-a-gpu-to-openfhe-difficult/1114/1 "2024-03-09T13:43:39Z")

</div>

Hello, I am currently developing a GPU-based NTT. How difficult would it be to “replace” the existing NumberTheoreticTransformNat::ForwardTransformToBitReverseInPlace by my own implementation ?

---

<div class="post-metadata">

**Author:** ![Caesar](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/caesar/32/63_2.png) [@Caesar](https://openfhe.discourse.group/u/Caesar)\
**Post date:** [March 12, 2024, 2:03pm UTC](https://openfhe.discourse.group/t/is-adapting-a-ntt-done-in-a-gpu-to-openfhe-difficult/1114/2 "2024-03-12T14:03:04Z")

</div>

You will need to integrate your GPU kernels and the associated kernel launch functions into OpenFHE.

Specifically, you will need to provide your custom definitions of `NativeInteger`, `NativeVector` and `Transforms`. You will also need to write the logic related to memory management, whether you will be using unified memory or explicit memory allocation/deallocation.

Also, depending on your implementation of NTT, you need to ensure that precomputed constants are stored in the GPU memory.

Consider studying the Intel HEXL (see below) integration into OpenFHE.

The following projects might be helpful to learn how to do the integration:

[Intel HEXL](https://github.com/intel/hexl)

[OpenFHE-HEXL](https://github.com/openfheorg/openfhe-hexl)

[OpenFHE-configurator](https://github.com/openfheorg/openfhe-configurator)
