[Python-talk] SWIG tips? Howto?
Bruce Labitt
bruce.labitt at myfairpoint.net
Tue Aug 18 21:37:48 EDT 2009
Kent Johnson wrote:
> On Tue, Aug 18, 2009 at 3:07 PM, <bruce.labitt at autoliv.com> wrote:
>
>
>> I have used FFTW before (www.fftw.org) for my work. How hard would it be
>> to use SWIG to wrap a few FFTW routines to hopefully speed up the FFTs?
>>
>
> Google is your friend...
> http://developer.berlios.de/projects/pyfftw/
> http://www.nabble.com/FFTW-python-bindings-again-td21676636.html
>
>
Looks like there are some warts still. Memory alignment for one thing.
May still be worth pursuing.
>
>> I will try using FFTW (using SWIG) on my workstation. If it is fast
>> enough, I'm done. If not, I can try my blade processor. For large FFTs
>> it is 40x faster, for smaller ones, maybe 20x. The only issue there is I
>> will have to connect and run remotely.
>> Is there a way to do this? I only want the fft to run remotely. This is
>> what I envision:
>> 1. Python running on my workstation passes an array to the QS22,
>> 2. QS22 processes array using FFTW, sends back answer,
>> 3. Python continues loop to 1, until done
>>
>
> How do the two systems communicate? Maybe you can
> - save a file containing the array in a common location
> - start a process on QS22 to process the file and save results
> - read results
>
>
I have done the above for big files. I used paramiko to make the ssh
connection, run the C program on the saved input file, and logged out.
Then I read the results from NFS. It works. Not pretty, but it does
work. Probably will start out that way. Of course, the connection will
stay open for all N files (fft input data).
> or you could communicate through sockets...
>
Just looked at that. This would very cool. But I would have to do
sockets on the QS22 side in C. One day, sigh. Lots of reading to do
that... Setting things up seem straight forward. (As much as 15
minutes of reading a tutorial makes me an expert lol) I am real fuzzy
on how think about the problem.
Once the connection was established, I need to send the array length N,
then the data. It is not clear to me how to send an array of N binary
complex double precision numbers, from a little endian to a big endian
machine over a socket. I could send them as strings, but that a) would
not be as precise and b) take at least twice as long.
If all the data was there, then the algorithm would run. When complete
the QS22 would send the data to a python socket that was listening on my
server. Could the python socket be controlled by paramiko? Or would I
use another module?
-Bruce
More information about the Python-talk
mailing list