# Saving FFTW plans for future use

**URL:** <https://discourse.julialang.org/t/saving-fftw-plans-for-future-use/102871>\
**Category:** Performance\
**Tags:** package, fftw\
**Created:** [August 16, 2023, 5:27pm UTC](https://discourse.julialang.org/t/saving-fftw-plans-for-future-use/102871 "2023-08-16T17:27:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![erny123](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erny123/32/52255_2.png) [@erny123](https://discourse.julialang.org/u/erny123)\
**Post date:** [August 16, 2023, 5:27pm UTC](https://discourse.julialang.org/t/saving-fftw-plans-for-future-use/102871/1 "2023-08-16T17:27:09Z")

</div>

Is there anyway to save and load FFTW plans?

For example:

```julia
using FFTW

sz = 2^13
ar = rand(ComplexF64,(sz,sz));
pthread =FFTW.plan_fft!(ar,flags=FFTW.MEASURE);
inv(pthread);
pthreadpatient =FFTW.plan_fft!(ar,flags=FFTW.PATIENT);
inv(pthreadpatient);

```

For large data, planning with `FFTW.PATIENT` takes a huge amount of time but may well be worth the initial wait.  
However, if you know your data is going to be the same size the next time you start up Julia, there should be a way to save these FFTW plans to be used again.

Any thoughts?

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [August 16, 2023, 5:31pm UTC](https://discourse.julialang.org/t/saving-fftw-plans-for-future-use/102871/2 "2023-08-16T17:31:27Z")

</div>

[FFTW FAQ: Can I save FFTW’s plans?](https://www.fftw.org/faq/section3.html#savePlans) In Julia, you can call `FFTW.export_wisdom(filename)` to save to a file, and `FFTW.import_wisdom(filename)` to import.

---

<div class="post-metadata">

**Author:** ![erny123](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erny123/32/52255_2.png) [@erny123](https://discourse.julialang.org/u/erny123)\
**Post date:** [August 16, 2023, 5:47pm UTC](https://discourse.julialang.org/t/saving-fftw-plans-for-future-use/102871/3 "2023-08-16T17:47:31Z")

</div>

Thanks @stevengj!
