# Enzyme.jl plus parallelstencil.jl?

**URL:** <https://discourse.julialang.org/t/enzyme-jl-plus-parallelstencil-jl/84310>\
**Category:** GPU\
**Created:** [July 16, 2022, 11:56am UTC](https://discourse.julialang.org/t/enzyme-jl-plus-parallelstencil-jl/84310 "2022-07-16T11:56:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jakub\_Mitura](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jakub_mitura/32/19496_2.png) [@Jakub\_Mitura](https://discourse.julialang.org/u/Jakub_Mitura)\
**Post date:** [July 16, 2022, 11:56am UTC](https://discourse.julialang.org/t/enzyme-jl-plus-parallelstencil-jl/84310/1 "2022-07-16T11:56:11Z")

</div>

Anybody tried parallelstencil.jl cuda kernels differentiation with enzyme.jl ?  
Since python 1.7 enzyme supports Cuda.jl kernels so in pronciple I suppose it should be possible ?

---

<div class="post-metadata">

**Author:** ![luraess](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/luraess/32/16189_2.png) [@luraess](https://discourse.julialang.org/u/luraess)\
**Post date:** [July 16, 2022, 8:26pm UTC](https://discourse.julialang.org/t/enzyme-jl-plus-parallelstencil-jl/84310/2 "2022-07-16T20:26:00Z")

</div>

We are on it. Performing AD on CUDA.jl kernels works (with some limitations wrt math functions, which needs to be further investigated). Next step will be to test with ParallelStencil kernels but there shouldn’t be, a priori, issues.

---

<div class="post-metadata">

**Author:** ![Jakub\_Mitura](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jakub_mitura/32/19496_2.png) [@Jakub\_Mitura](https://discourse.julialang.org/u/Jakub_Mitura)\
**Post date:** [July 17, 2022, 6:08am UTC](https://discourse.julialang.org/t/enzyme-jl-plus-parallelstencil-jl/84310/3 "2022-07-17T06:08:48Z")

</div>

Fantastic thank you @luraess ! Can’t wait to start using it, tests that you mentioned will be in the enzyme.jl or parallelstencil.jl github repository?

---

<div class="post-metadata">

**Author:** ![luraess](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/luraess/32/16189_2.png) [@luraess](https://discourse.julialang.org/u/luraess)\
**Post date:** [July 17, 2022, 8:47pm UTC](https://discourse.julialang.org/t/enzyme-jl-plus-parallelstencil-jl/84310/4 "2022-07-17T20:47:35Z")

</div>

We may add an example to ParallelStencil once everything works as expected. In the meanwhile, we may use a third-party demo repo. I’ll try to keep you posted, or post a follow-up in this Discourse thread.

---

<div class="post-metadata">

**Author:** ![Jakub\_Mitura](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jakub_mitura/32/19496_2.png) [@Jakub\_Mitura](https://discourse.julialang.org/u/Jakub_Mitura)\
**Post date:** [July 18, 2022, 4:31am UTC](https://discourse.julialang.org/t/enzyme-jl-plus-parallelstencil-jl/84310/5 "2022-07-18T04:31:18Z")

</div>

Thanks !!

---

<div class="post-metadata">

**Author:** ![luraess](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/luraess/32/16189_2.png) [@luraess](https://discourse.julialang.org/u/luraess)\
**Post date:** [August 22, 2022, 6:09am UTC](https://discourse.julialang.org/t/enzyme-jl-plus-parallelstencil-jl/84310/6 "2022-08-22T06:09:25Z")

</div>

To follow-up @Jakub_Mitura, we did not yet experiment using Enzyme.jl with ParallelStencil.jl. However, we made good progress using AD on GPUs within an iterative solver scope. You can find the material in the following demo repo [GitHub - PTsolvers/PT-AD: Pseudo-transient auto-diff playground](https://github.com/PTsolvers/PT-AD) and the corresponding JuliaCon22 presentation on [YouTube](https://www.youtube.com/embed/K2VtJe9baO4).
