Articles on peterbell10's Bloghttps://blogs.python-gsoc.orgUpdates on different articles published on peterbell10's BlogenTue, 27 Aug 2019 01:17:48 +0000Final weekhttps://blogs.python-gsoc.org/en/peterbell10s-blog/final-week-1/<h2>What did you do this week?</h2> <p>With the coding period coming to an end, this week I've wound down coding and focused on writing up my <a href="https://gdoc.pub/doc/e/2PACX-1vR6iXXG1uS9ds47GvDgQk6XtpYzVTtYepu5B8onBrMmoorfKHhnHbN0ArDoXgoA23nZrcrm_DSFMW45">final work submission</a>. This means I've been looking back at the work I've been doing; reading through my old PRs and comparing against my project's original goals.</p> <p>My original proposal focused solely on adding backend support to <span style="font-family: Courier New,Courier,monospace;">scipy.fftpack</span>, yet the scope of my work over the past 3 months was not limited there. The resulting <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span> subpackage is a complete rewrite of <span style="font-family: Courier New,Courier,monospace;">scipy.fftpack</span> from the ground-up featuring not just the backend system but also an improved interface and the replacement of <span style="font-family: Courier New,Courier,monospace;">FFTPACK</span> with pypocketfft under the hood.</p> <p>My contributions were also not just limited to SciPy; I've also made contributed to <span style="font-family: Courier New,Courier,monospace;">pypocketfft</span>, <span style="font-family: Courier New,Courier,monospace;">uarray</span>, pyFFTW and <span style="font-family: Courier New,Courier,monospace;">cupy</span>. I've really enjoyed getting to collaborate with this range of open source projects and am very pleased with how my work has gone over GSoC. I would thoroughly recommend that any students interested in open source software should consider doing a project themself.</p>PeterBell10@live.co.uk (peterbell10)Tue, 27 Aug 2019 01:17:48 +0000https://blogs.python-gsoc.org/en/peterbell10s-blog/final-week-1/Working towards pre-planned transformshttps://blogs.python-gsoc.org/en/peterbell10s-blog/working-towards-pre-planned-transforms/<h2>What did you do this week?</h2> <p>The main feature I've been working on this week has been adding pre-planned transforms to <span style="font-family: Courier New,Courier,monospace;">pypocketfft</span> in (<a href="https://gitlab.mpcdf.mpg.de/mtr/pypocketfft/merge_requests/28/">pypocketfft!28</a>). This will allow users to speed-up cases where many transforms of the same shape are done, without needing to rely on any internal caches. This gives the users a small performance improvement in <span style="font-family: Courier New,Courier,monospace;">pypocketfft</span> but adding this to the <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span> interface will also allow other backends to benefit. e.g. <span style="font-family: Courier New,Courier,monospace;">pyFFTW</span> can have a significantly more expensive planning phase.</p> <p>Plans have now been added into the c++ interface of <span style="font-family: Courier New,Courier,monospace;">pypocketfft</span> but I have still got to expose these in the python interface. Additionally, I've made a number of other contributions in several other places:</p> <ul> <li>Refactored the real transform tests to use pytest and to test all the transforms in long double precision as well (<a href="https://github.com/scipy/scipy/pull/10669">scipy#10669</a>)</li> <li>Fixed a race condition in my custom threadpool code that was causing crashes on macOS (<a href="https://gitlab.mpcdf.mpg.de/mtr/pypocketfft/merge_requests/27">pypocketfft!27</a>)</li> <li>Added benchmarks to my multithreading PR (<a href="https://github.com/scipy/scipy/pull/10614">scipy#10614</a>)</li> <li>Opened an issue in <span style="font-family: Courier New,Courier,monospace;">mkl_fft</span> about adding a <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span> interface (<a href="https://github.com/IntelPython/mkl_fft/issues/42">mkl_fft#42</a>). Unfortunately, <span style="font-family: Courier New,Courier,monospace;">mkl_ffl</span> doesn't seem to be very active and the issue hasn't received any response yet.</li> <li>Fixed a compile warning in <span style="font-family: Courier New,Courier,monospace;">uarray</span> (<a href="https://github.com/Quansight-Labs/uarray/pull/195/">uarray#195</a>)</li> </ul> <h2>What is coming up next?</h2> <p>The coding period has officially ended and it's now time to "submit the code". Most of my code has already been merged into the SciPy master branch so this will just involve writing a summary of my work over the whole GSoC project.</p> <p>I would also like to finish up the pre-planned transform code but it's likely too late to get this merged in time for the evaluation.</p> <h2>Did you get stuck anywhere?</h2> <p>Fixing the race condition in <span style="font-family: Courier New,Courier,monospace;">pypocketfft</span> was quite challenging. The only symptom was a <span style="font-family: Courier New,Courier,monospace;">SEGFAULT</span> that occurred only rarely and only on macOS, a platform which I don't use and so couldn't reproduce the issue locally. This made diagnosing and solving the issue very tricky. Thankfully, Martin (pypocketfft's author) had access to apple hardware and was eventually able to give me enough details that I found an issue from another project that had run into almost exactly the same issue.</p> <p> </p>PeterBell10@live.co.uk (peterbell10)Tue, 20 Aug 2019 01:44:27 +0000https://blogs.python-gsoc.org/en/peterbell10s-blog/working-towards-pre-planned-transforms/Adding multithreading to scipy.ffthttps://blogs.python-gsoc.org/en/peterbell10s-blog/adding-multithreading-to-scipy-fft/<h2>What did you do this week?</h2> <ul> <li>Fixed a small inconsistency with the <span style="font-family: Courier New,Courier,monospace;">numpy.fft</span> API when the transform shape is given but not the axes (<a href="https://github.com/scipy/scipy/pull/10594">scipy#10594</a>)</li> <li>Gotten my CuPy PR into a review ready state. Fixing uarray backend support (<a href="https://github.com/cupy/cupy/pull/2355">scipy#2355</a>)</li> <li>Migrated pypocketfft from OpenMP to a custom thread-pool that I wrote to handle <span style="font-family: Courier New,Courier,monospace;">fork</span> on POSIX systems. This addresses all the main concerns with adding OpenMP into SciPy (<a href="https://gitlab.mpcdf.mpg.de/mtr/pypocketfft/merge_requests/23">pypocketfft!23</a>, <a href="https://gitlab.mpcdf.mpg.de/mtr/pypocketfft/merge_requests/24">pypocketfft!24</a>)</li> <li>Using the updated pypocketfft, I was then able to open a PR adding multithreading support to the <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span> API (<a href="https://github.com/scipy/scipy/pull/10614">scipy#10614</a>)</li> </ul> <h2>What is coming up next?</h2> <p>- Create, or at least open issue for, a mkl-fft backend<br> - Expand the <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span> tutorial to include installing and using new FFT backends</p> <p>There are also a number of minor features that could be added to pypocketfft such as shape changing transforms or pre-planned transforms. Though at this late stage in the project, my focus is on polishing the current feature set.</p> <h2>Did you get stuck anywhere?</h2> <p>No significant blockers this week.</p> <p> </p>PeterBell10@live.co.uk (peterbell10)Mon, 12 Aug 2019 22:16:00 +0000https://blogs.python-gsoc.org/en/peterbell10s-blog/adding-multithreading-to-scipy-fft/CuPy backend and pypocketfft cleanuphttps://blogs.python-gsoc.org/en/peterbell10s-blog/cupy-backend-and-pypocketfft-cleanup/<h2>What did you do this week?</h2> <ul> <li>I have opened a PR on cupy adding a <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span> backend</li> <li>Fixed a few small incompatibilities with the <span style="font-family: Courier New,Courier,monospace;">numpy.fft</span> interface</li> <li>Updated <span style="font-family: Courier New,Courier,monospace;">next_fast_len</span>, a utility function to find the fastest lengths for computing the FFT (<a href="https://gitlab.mpcdf.mpg.de/mtr/pypocketfft/merge_requests/17/">pypocketfft!17</a>, <a href="https://github.com/scipy/scipy/pull/10570">scipy#10570</a>)</li> <li>Various clean-ups and refactoring of pypocketfft's multi-dimensional transform functions (<a href="https://gitlab.mpcdf.mpg.de/mtr/pypocketfft/merge_requests/16/">pypocketfft!16</a>, <a href="https://gitlab.mpcdf.mpg.de/mtr/pypocketfft/merge_requests/20">pypocketfft!20</a>)</li> <li>Restarted a discussions about use of OpenMP in SciPy. pypocketfft already supports OpenMP for parallelising transforms over multidimensional arrays, however there are a number of issues preventing SciPy from building with this feature enabled.</li> </ul> <h2><span style="font-family: Arial,Helvetica,sans-serif;">What is coming up next?</span></h2> <ul> <li>Replace OpenMP in pypocketfft with a custom thread-pool. The discussions on SciPy-dev have suggested that OpenMP isn't going to be a suitable solution so I will attempt to replace it.</li> <li>Finishing up my CuPy backend PR. It is mostly completed but needs a few more tests.</li> <li>Implement shape-changing transforms in pypocketfft.</li> </ul> <h2>Did you get stuck anywhere?</h2> <p>I found it quite difficult to get cuda and CuPy working properly on my computer and still occasionally have problems with it stopping recognising my cuda device. However, it's at least functional now if not quite perfect.</p> <p> </p>PeterBell10@live.co.uk (peterbell10)Tue, 06 Aug 2019 01:16:02 +0000https://blogs.python-gsoc.org/en/peterbell10s-blog/cupy-backend-and-pypocketfft-cleanup/So long, FFTPACKhttps://blogs.python-gsoc.org/en/peterbell10s-blog/so-long-fftpack/<h2>What did you do this week?</h2> <p><br> Perhaps the most significant task this week was completely removing the fortran <span style="font-family: Courier New,Courier,monospace;">FFTPACK</span> code from SciPy and rewriting <span style="font-family: Courier New,Courier,monospace;">scipy.fftpack</span> using <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span>'s <span style="font-family: Courier New,Courier,monospace;">pocketfft</span> backend. This drastically simplifies the code with a diff of -8,856 lines of code.</p> <p>I've also made a number of smaller improvements to <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span> as well as a significant performance improvement to <span style="font-family: Courier New,Courier,monospace;">scipy.signal.fftconvolve</span>.</p> <p>The first <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span> backend has also been created after my <span style="font-family: Arial,Helvetica,sans-serif;">pyFFTW</span> PR was merged this week. This means that SciPy users can accelerate their FFT transforms with all of pyFFTW's features using nothing more than a few function calls.</p> <h2>What is coming up next?</h2> <ul> <li>Adding a CuPy backend for <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span></li> <li>Implementing efficient shape-changing transforms in <span style="font-family: Courier New,Courier,monospace;">pypocketfft</span></li> <li>Writing tests for the pyFFTW real-to-real transforms PR</li> <li>Adding the ability to query active backends for uarray</li> </ul> <h2><br> Did you get stuck anywhere?</h2> <p>No blockers this week.</p> <p> </p>PeterBell10@live.co.uk (peterbell10)Mon, 29 Jul 2019 15:29:16 +0000https://blogs.python-gsoc.org/en/peterbell10s-blog/so-long-fftpack/Backend support mergedhttps://blogs.python-gsoc.org/en/peterbell10s-blog/backend-support-merged/<h2>What did you do this week?</h2> <p>This has been a very exciting week for me, with lots of progress made on my GSoC project. For the past couple of months I've been working on adding the new <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span> module which supercedes the existing <span style="font-family: Courier New,Courier,monospace;">scipy.fftpack</span> submodule and adds a range of new features and interface improvements. Chief among these planned features was a backend system, allowing users to install their own fft libraries as implementations for the <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span> interface.</p> <p>I'm pleased to say that this week, my backend PR was merged into master. <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span> can now be implemented by any backend supporting the <a href="https://uarray.readthedocs.io/en/latest/"><span style="font-family: Courier New,Courier,monospace;">uarray</span> protocol</a> and provides a range of ways for the user to control their installed backends <a href="https://scipy.github.io/devdocs/fft.html#backend-control">[1]</a>. Around the same time, it was also announced that I've officially been accepted into the <a href="https://mail.python.org/pipermail/scipy-dev/2019-July/023619.html">scipy core developers</a> along with one of my mentors - Greg.</p> <p>But even with my projects main goals out of the way, there are still a number of improvements and stretch goals that I've been working on:</p> <ul> <li>continued work on a pyFFTW backend which should be merged soon (<a href="https://github.com/pyFFTW/pyFFTW/pull/269">pyFFTW#269</a>)</li> <li>improved normalization of <span style="font-family: Courier New,Courier,monospace;">idct</span>/<span style="font-family: Courier New,Courier,monospace;">idst</span> which is inconsistent in <span style="font-family: Courier New,Courier,monospace;">scipy.fftpack</span> (<a href="https://github.com/scipy/scipy/pull/10470">scipy#10470</a>)</li> <li>improved the performance of the n-dimensional FFT interface (<a href="https://github.com/scipy/scipy/pull/10490">scipy#10490</a>)</li> <li>a new PR wrapping pypocketfft's new sine and cosine transforms (DCT &amp; DST) (<a href="https://github.com/scipy/scipy/pull/10493">scipy#10493</a>)</li> </ul> <h2>What is coming up next?</h2> <p>With the DCT and DST transforms now in <span style="font-family: Courier New,Courier,monospace;">pypocketfft</span>, the <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span> submodule will no longer depend on <span style="font-family: Courier New,Courier,monospace;">scipy.fftpack</span> for any of it's transforms. So, it should be time to flip the dependecy on its head and remove all of the old fortran <span style="font-family: Courier New,Courier,monospace;">fftpack </span>code, replacing it with a very thin wrapper around <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span>.</p> <p>I can also work on one of the main stretch goals for this project which was finializing the addition of DCT and DST wrappers to <span style="font-family: Courier New,Courier,monospace;">pyFFTW</span>. There has been a PR for this on <span style="font-family: Courier New,Courier,monospace;">pyFFTW </span>for many years (<a href="https://github.com/pyFFTW/pyFFTW/pull/95">pyFFTW#95</a>) but they have lacked the man-power to finally finish it off and merge. Similar to pypocketfft, these real transforms were the<br> main feature missing from <span style="font-family: Courier New,Courier,monospace;">pyFFTW</span>'s interfaces.</p> <h2>Did you get stuck anywhere?</h2> <p>No blockers this week.</p> <p> </p>PeterBell10@live.co.uk (peterbell10)Mon, 22 Jul 2019 12:51:49 +0000https://blogs.python-gsoc.org/en/peterbell10s-blog/backend-support-merged/For fork's sake - Fixing multiprocessing issueshttps://blogs.python-gsoc.org/en/peterbell10s-blog/for-fork-s-sake-fixing-multiprocessing-issues/<h2>What did you do this week?</h2> <p>It was also reported that <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span> does not interact well with python's <span style="font-family: Courier New,Courier,monospace;">multiprocessing</span> library. I was able to track down the issue and resolve it within a few hours, adding a unit test to ensure this wouldn't be broken again. However, when I went to update my uarray PR to use the new fast C++ version, the test started to fail. It turns out, the uarray multimethod objects needed to be <span style="font-family: Courier New,Courier,monospace;">pickle</span>able in a very specific way that mimicks the behaviour of python <span style="font-family: Courier New,Courier,monospace;">Function</span> types. Thankfully, after applying this fix the issue was resolved.</p> <p>I've also this week:</p> <ul> <li>added Hermitian symmetric transforms to <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span> (merged in <a href="https://github.com/scipy/scipy/pull/10425">scipy#10425</a>)</li> <li>added <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span> to the 1.4.0 <a href="https://github.com/scipy/scipy/wiki/Release-note-entries-for-SciPy-1.4.0#scipyfft-added">release notes</a></li> <li>updated my PR adding uarray support to <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span></li> <li>started work on adding a `scipy.fft` compatible interface to pyfftw in <a href="https://github.com/pyFFTW/pyFFTW/pull/269">pyFFTW#269</a>. This will be one of the first useful backend implementations for the new backend system.</li> </ul> <h2><span style="font-family: Arial,Helvetica,sans-serif;">What is coming up next?</span></h2> <p>The backend system PR is set to be merged very soon so I should be able to focus on adding the <span style="font-family: Courier New,Courier,monospace;">uarray</span> protocol to <span style="font-family: Courier New,Courier,monospace;">pyfftw</span> and possibly contributing compatible backends to other FFT libraries.</p> <p>I can also work on pre-planned transforms.</p> <h2>Did you get stuck anywhere?</h2> <p>The <span style="font-family: Courier New,Courier,monospace;">multiprocessing</span> incompatibilities posed an unexpected challange but I was able to work though the problems alright.</p> <p> </p>PeterBell10@live.co.uk (peterbell10)Mon, 15 Jul 2019 12:42:59 +0000https://blogs.python-gsoc.org/en/peterbell10s-blog/for-fork-s-sake-fixing-multiprocessing-issues/Improving uarray performancehttps://blogs.python-gsoc.org/en/peterbell10s-blog/improving-uarray-performance/<h2>What did you do this week?</h2> <p>I have been focused on my uarray PR (<a href="https://github.com/Quansight-Labs/uarray/pull/170">uarray#1780</a>). uarray defines a protocol for dispatching function calls to multiple different backend implentations. In my PR, I've been reimplementing the core function dispatch mechanism in C++ using the Python C-API. This week I've moved the backend registration system in to C++ which means the protocol is now 100% C++. This has brought the overhead down from ~5 us per function call to just ~700 ns or about 10 times more than a normal python function call. This overhead was one of the main blockers for the adoption of uarray so is very nice to see it come down.<br>     <br> I've also updated the vendored version of pypocketfft in <a href="https://github.com/scipy/scipy/pull/10393">scipy#10393</a>. This new version includes a small cache for the FFT "twiddle factors" which I helped implement. This improves benchmarks by ~20% in most cases or as much as 60% for some input sizes.</p> <h2>What is coming up next?</h2> <p>My <span style="font-family: Courier New,Courier,monospace;">uarray</span> PR has already been merged over the weekend so I can update my <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span> code and update the benchmarks there. I also plan on using the new version of pypocketfft to add support for Hermitian FFTs (like numpy's <span style="font-family: Courier New,Courier,monospace;">hfft</span>). This would make <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span> a complete replacement for <span style="font-family: Courier New,Courier,monospace;">numpy.fft</span>'s functionality.</p> <p>I can also work on adding pre-planned transforms to the <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span> interface. This would also require pocketfft's plan cacheing much more flexible so I expect we can add user config options to our automatic plan cacheing.</p> <h2>Did you get stuck anywhere?</h2> <p>No significan blockers this week.</p> <p> </p>PeterBell10@live.co.uk (peterbell10)Mon, 08 Jul 2019 13:51:16 +0000https://blogs.python-gsoc.org/en/peterbell10s-blog/improving-uarray-performance/scipy.fft has been merged!https://blogs.python-gsoc.org/en/peterbell10s-blog/scipy-fft-has-been-merged/<h2>What did you do this week?</h2> <p>My PR for <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span> has been merged into SciPy's master branch and is now slated for release in version 1.4. I've been doing some follow-up PRs responding to some late feedback with follow-up PRs, mostly focused on documentation.</p> <p>I've also started learning the Python C-API and written a proof of concept implementation of <span style="font-family: Courier New,Courier,monospace;">uarray</span>'s <span style="font-family: Courier New,Courier,monospace;">__ua_function__</span> protocol in C++. It still relies on some python code which is slowing it down but even still I've measured around a 2x reduction in function call overhead.</p> <h2>What is coming up next?</h2> <p>Now that <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span> has been merged into <span style="font-family: Arial,Helvetica,sans-serif;">SciPy</span>, I can open a new draft PR with the uarray code. This should allow for more feedback from the SciPy community and we can move towards getting backend support into <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span>.<br> While that is ongoing I can continue to work on my C++ implementation of uarray to move more of it into native code and bring down the overhead further.</p> <p>pypocketfft has also just released an update with a new interface that should allow for a nice refactoring of the <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span> code.</p> <h2>Did you get stuck anywhere?</h2> <p>I spent a lot of my time trying to debug some segfaults that were happening in uarray's test suite. I assumed the issue must be in my C++ code since I was unfamiliar with the Python C-API. However, after a lot of investigation the bugs turned out to be in NumPy and Dask, not my code.</p> <p> </p>PeterBell10@live.co.uk (peterbell10)Mon, 01 Jul 2019 12:59:42 +0000https://blogs.python-gsoc.org/en/peterbell10s-blog/scipy-fft-has-been-merged/Fourth Weekly Check-inhttps://blogs.python-gsoc.org/en/peterbell10s-blog/fourth-weekly-check-in/<h2>What did you do this week?</h2> <p>My main <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span> PR is now very close to being merged and so I've been responding to some final review comments and making minor tweaks. Otherwise, I'm keeping the changes minimal to give it a chance to be reviewed fully.</p> <p>I've also been collaborating with the author of the pypocketfft library: many of the changes I made for my PR have now been merged into the upstream repo. I've also been having discussions with him about improving the API such as adding real-to-complex inverse FFTs and a cache for FFT plans to improve performace of repeated transforms. These have already been prototyped and show promising results.</p> <p>On the backend front, I've been actively contributing to uarray. I've been working with the maintainer to solidify the protocol, as well as contributing a new feature to remove default-valued positional arguments. It's currently looking like the performance overhead of uarray is the biggest hurdle so I've been benchmarking the overhead involved and discussing how to mitigate that.</p> <h2>What is coming up next?</h2> <p>I plan to rewrite the core of the uarray using the python C API to try and bring down the overhead to a more acceptable level. This would be my first time using the C API, so progress may be slow at first but since this is key to the backend system's performance, it should be well worth the effort.</p> <p>Once my first PR is merged, I can also open a new PR which updates to the latest version of pypocketfft which has a reworked API and also includes many of the features I added for use in SciPy. Updating now should also make it easier to maintain in future since it will reduce the size of the patch added over the library.</p> <h2>Did you get stuck anywhere?</h2> <p>I haven't had any real blockers this week and I think good progress has been made.</p> <p> </p>PeterBell10@live.co.uk (peterbell10)Mon, 24 Jun 2019 00:35:32 +0000https://blogs.python-gsoc.org/en/peterbell10s-blog/fourth-weekly-check-in/Third Weekly Check-inhttps://blogs.python-gsoc.org/en/peterbell10s-blog/third-weekly-check-in/<h2>What did you do this week?</h2> <p>I started off looking into uarray, a library for multi-method dispatch for different backends. I created a working prototype for uarray support in <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span> and used this to start benchmarking the overheads involved. I've also been looking into it's design and had online discussions with one of the authors.</p> <p>I also made some requested changes to my <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span> pull-request, including updating the tutorials and benchmark suite. This revealed some serious performance regressions for 1D FFTs, as compared with <span style="font-family: Courier New,Courier,monospace;">scipy.fftpack</span>. So, I deverted my attention to resolving these issues which saw over 10x improvement for small FFTs.</p> <h2><br> What is coming up next?</h2> <p>I need to evaluate the uarray aproach in comparison to my custom backend solution that I implemented last week. Of particular interest is the performance overhead which will need to be compared and possibly optimised. There are also a number of design choices that differ between uarray and my custom solution which I will need to reconsider and discuss on the mailing list.</p> <h2>Did you get stuck anywhere?</h2> <p>No significant blockers, although the work on optimising for 1D FFTs did take time away from the backend work that I had planned to focusing on.</p> <p> </p>PeterBell10@live.co.uk (peterbell10)Mon, 17 Jun 2019 00:15:17 +0000https://blogs.python-gsoc.org/en/peterbell10s-blog/third-weekly-check-in/Second Weekly Check-inhttps://blogs.python-gsoc.org/en/peterbell10s-blog/second-weekly-check-in/<h2>What did you do this week?</h2> <p>I have been working on my <a href="https://github.com/scipy/scipy/pull/10238">pull request</a> to add <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span>. This included:</p> <ul> <li>Investigating and fixing test failures</li> <li>Adding an optimized general purpose FFT for real input</li> <li>Writing documentation</li> <li>Solving build issues</li> </ul> <p>I've also created a <a href="https://github.com/peterbell10/scipy/pull/1">working prototype</a> backend system, with tests for the basic functionality of switching between backends and calling functions.</p> <h2>What is coming up next?</h2> <p>I will hopefully start to get reviews for my open pull request and can respond to feedback. I'll also continue to work on the backend system by expanding my current prototype and creating a parallel implementation using <a href="https://uarray.readthedocs.io/en/latest/">uarray</a> which implements a similar backend system. This will be used to open a discussion about whether or not uarray is suitable and ready to be deployed within SciPy.</p> <p>There are also a number of improvements that can be made to the general state of FFTs within SciPy. For example, <span style="font-family: Courier New,Courier,monospace;">scipy.fftpack </span>can be made to use the faster PocketFFT implementation and PocketFFT itself can be expanded to include the sine and cosine transforms that are in fftpack.</p> <h2>Did you get stuck anywhere?</h2> <p>SciPy imports most of the NumPy API into it's own namespace. In particular, I discovered that <span style="font-family: Courier New,Courier,monospace;">numpy.fft.fft</span> is imported as <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span>; conflicting with my new <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span> module. This will hopefully be deprecated and removed in a future version of SciPy but for the time being I've had to use a workaround for the issue. By overriding the module's <span style="font-family: Courier New,Courier,monospace;">__class__</span>, we can make the <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span> module callable as if it were a function. This works, but has some unfortunate side effects, one of which was thoroughly confusing the documentation generator (sphinx) which silently ignored the whole <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span> module.</p> <p>This whole tangle took a while to work out but I got there in the end.</p> <p> </p>PeterBell10@live.co.uk (peterbell10)Sun, 09 Jun 2019 19:47:22 +0000https://blogs.python-gsoc.org/en/peterbell10s-blog/second-weekly-check-in/First Weekly Check-inhttps://blogs.python-gsoc.org/en/peterbell10s-blog/first-weekly-check-in/<h2>What did you do this week?</h2> <p>I have been working towards a minimum viable product for the <span style="font-family: Courier New,Courier,monospace;">scipy.fft</span> submodule. This involved writing a wrapper around pypocketfft to satisfy the <span style="font-family: Courier New,Courier,monospace;">numpy.fft</span> interface, as well as integrating pypocketfft into SciPy's build system. I have opened a <a href="https://github.com/scipy/scipy/pull/10238">draft PR</a> in which all of numpy's fft tests are passing and all but one of the fftpack tests are passing.</p> <h2>What is coming up next?</h2> <p>The draft PR needs to be polished to the point where it is review ready:</p> <ul> <li>Some small precision issues need to be resolved</li> <li>Documentation needs to be written</li> <li>fftpack had various optimisations for real input which need to be reimplemented with pocketfft</li> </ul> <p>I can also begin work on the backend system:</p> <ul> <li>mechanism for installing a backend</li> <li>configuration API to give users more control over each backend</li> </ul> <h2><br> Did you get stuck anywhere?</h2> <p>I initially had a lot of trouble getting the build system to work. Any attempt to add or modify scipy submodules were causing build failures in completely unrelated parts of SciPy. I was only able to resolve this after reinstalling my entire python environment. After solving that, I had no major blockers.</p> <p> </p>PeterBell10@live.co.uk (peterbell10)Sun, 02 Jun 2019 21:38:38 +0000https://blogs.python-gsoc.org/en/peterbell10s-blog/first-weekly-check-in/Hello World!https://blogs.python-gsoc.org/en/peterbell10s-blog/hello-world-2/<p><span style="font-family: Arial,Helvetica,sans-serif;">Hello, my name is Peter from the UK where I'm studing computational physics. I've used scipy a lot throughout my degree and through my participation in GSoC, I hope to return the favour! Over the summer I'll be working to enhance scipy's fast-fourier transform (fft) library.  This will include the ability for  users to supply their own implementations at run time.</span></p> <p><span style="font-family: Arial,Helvetica,sans-serif;">Initially, this was just going to be a new backend system for the existing module</span> <span style="font-family: Courier New,Courier,monospace;">scipy.fftpack. </span><span style="font-family: Arial,Helvetica,sans-serif;">Over the past few weeks, I've </span>already had lots of great discussion with the community; both on the mailing list (<a href="https://mail.python.org/pipermail/scipy-dev/2019-May/023506.html">SciPy-Dev</a>) and on GitHub in a <a href="https://github.com/scipy/scipy/issues/10175">related issue</a>. From this discussion, the project has now evolved into creating a new module <span style="font-family: Courier New,Courier,monospace;">scipy.fft </span><span style="font-family: Arial,Helvetica,sans-serif;">which will now also have:</span></p> <ul> <li><span style="font-family: Arial,Helvetica,sans-serif;">support for multiple backends</span></li> <li><span style="font-family: Arial,Helvetica,sans-serif;">default to using <a href="https://github.com/scipy/scipy/issues/10175">pocketfft</a> for improved performance and accuray</span></li> <li><span style="font-family: Arial,Helvetica,sans-serif;">an interface that matches better with </span><span style="font-family: Courier New,Courier,monospace;">numpy.fft</span></li> </ul> <p><span style="font-family: Arial,Helvetica,sans-serif;">The next steps will be to draft up the interface to </span><span style="font-family: Courier New,Courier,monospace;">scipy.fft </span><span style="font-family: Arial,Helvetica,sans-serif;">with the new default implementation. This will no doubt be iterated on in a pull </span>request on github. Once that gets merged, I should be in a good place to start implementing support for different backends.</p>PeterBell10@live.co.uk (peterbell10)Tue, 28 May 2019 18:43:33 +0000https://blogs.python-gsoc.org/en/peterbell10s-blog/hello-world-2/