{"action":"created","issue":{"url":"https://api.github.com/repos/ycasg/PyNLO/issues/1","repository_url":"https://api.github.com/repos/ycasg/PyNLO","labels_url":"https://api.github.com/repos/ycasg/PyNLO/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/ycasg/PyNLO/issues/1/comments","events_url":"https://api.github.com/repos/ycasg/PyNLO/issues/1/events","html_url":"https://github.com/ycasg/PyNLO/issues/1","id":124810511,"number":1,"title":"Brokenpy FFTW for GNLSE solver","user":{"login":"ycasg","id":8630824,"avatar_url":"https://avatars.githubusercontent.com/u/8630824?v=3","gravatar_id":"","url":"https://api.github.com/users/ycasg","html_url":"https://github.com/ycasg","followers_url":"https://api.github.com/users/ycasg/followers","following_url":"https://api.github.com/users/ycasg/following{/other_user}","gists_url":"https://api.github.com/users/ycasg/gists{/gist_id}","starred_url":"https://api.github.com/users/ycasg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ycasg/subscriptions","organizations_url":"https://api.github.com/users/ycasg/orgs","repos_url":"https://api.github.com/users/ycasg/repos","events_url":"https://api.github.com/users/ycasg/events{/privacy}","received_events_url":"https://api.github.com/users/ycasg/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-04T18:18:22Z","updated_at":"2016-02-29T23:11:36Z","closed_at":null,"body":"I attempted to upgrade the LaserFOAM GNLSE solver to use FFTW instead of the numpy FFTs. While I did get this to the point of \"working\", there is a serious bug. The first time a solver runs, the output is typically good. However, if the code is re-run (even if the Python interpreter is closed), the FFT arrays randomly become full of zeros or corrupted.\r\n\r\nI think that the problem lies with my use of pyFFTW and is related to memory allocation, but I couldn't track it down. For now, the four-wave mixing solver is set to use the Numpy FFTs, solving the problem. "},"comment":{"url":"https://api.github.com/repos/ycasg/PyNLO/issues/comments/190442159","html_url":"https://github.com/ycasg/PyNLO/issues/1#issuecomment-190442159","issue_url":"https://api.github.com/repos/ycasg/PyNLO/issues/1","id":190442159,"user":{"login":"DanHickstein","id":1107796,"avatar_url":"https://avatars.githubusercontent.com/u/1107796?v=3","gravatar_id":"","url":"https://api.github.com/users/DanHickstein","html_url":"https://github.com/DanHickstein","followers_url":"https://api.github.com/users/DanHickstein/followers","following_url":"https://api.github.com/users/DanHickstein/following{/other_user}","gists_url":"https://api.github.com/users/DanHickstein/gists{/gist_id}","starred_url":"https://api.github.com/users/DanHickstein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanHickstein/subscriptions","organizations_url":"https://api.github.com/users/DanHickstein/orgs","repos_url":"https://api.github.com/users/DanHickstein/repos","events_url":"https://api.github.com/users/DanHickstein/events{/privacy}","received_events_url":"https://api.github.com/users/DanHickstein/received_events","type":"User","site_admin":false},"created_at":"2016-02-29T23:11:36Z","updated_at":"2016-02-29T23:11:36Z","body":"I just got fftw installed on the mac (not super-easy to do, it strangely needs to be [installed twice](http://stackoverflow.com/questions/25000994/error-in-linking-fftw-libraries-for-pyfftw-installation) to work correctly) and I tried to use the pyfftw option in the `FourWaveMixing.SSFM`. It fails (pulse energy goes to zero) on the first step of the propagation. Is that basically what you are saying here? It kinda sounds like you are saying that it should fail after the first step.\r\n\r\nAnyway, I was able to get pyFFTW working with the \"Monkey-patch\" method described here:\r\nhttp://hgomersall.github.io/pyFFTW/sphinx/tutorial.html\r\nBasically, I just replaced `np.fft` with `pyfftw.interfaces.numpy_fft`.\r\n\r\nThis resulted in a modest speedup, but basically the same speedup that I got by switching from `numpy.fft` to `scipy.fftpack`, which is [generally a bit faster](http://stackoverflow.com/questions/6363154/what-is-the-difference-between-numpy-fft-and-scipy-fftpack).\r\n\r\nRun times for a SSFM supercontinuum generation simulation on my iMac:\r\n\r\n```\r\nnumpy.fft - 14.7 sec\r\npyfftw.interfaces.numpy_fft - 10.3 sec\r\nscipy.fftpack - 11.2 sec\r\n```\r\n\r\nI imagine that pyFFTW can be faster if it was used in the way that it was intended. But, it might be a good idea to switch from numpy.fft to scipy.fftpack in the mean time."}}