Closed yves-surrel closed 7 years ago
thanks for reporting this bug, fixed. Gregor
Hi Gregor
I had managed some time ago to install gpyfft on Windows thanks to some file ...egg... that I had found somewhere... I wanted to update my version, but I do not know how to do this (BTW, there could be a simple explanation on the site for silly people that only use prebuilt binaries from http://www.lfd.uci.edu/~gohlke/pythonlibs/#gpy or use pip install (IOW, that do not want to compile anything, because it's hours to sort out why the .lib's or the .h's are not found, or why the linker fails or etc.)
In the zip from github, there is a build subdirectory, but what to do with it?
BTW, I would also be very interested by installing also on MacOS X, as I develop something supposedly running on both environments. There is also a lib.macosx-10.6-x86_64-2.7 and a temp.macosx-10.6-x86_64-2.7 directory in gpyfft-master\build. What to do with them (again...) ?
Sorry for the newbie questions, and thanks a lot for your work.
Yves
Hi Yves,
agreed, building your Python packages yourself can be painful. I use mostly macOS for developing, building there is easy ('python setup.py install' after adjusting the path to clFFT in setup.py), once you have manage to compile clFFT (not so difficult after installing the dependencies with homebrew).
Compiling on Windows is more of a hassle, for Python 2.7 on 64bit Windows I could provide binaries (perhaps on Wednesday), I will add it to the GitHub releases section
Concerning the build directory, the source zip file from GitHub should not contain it (but did not check), it gets created if you (try to) build gpyfft, all files needed for installing are copied into this folder, but there is no automatic cleaning up. So likely it contains useless stuff.
Gregor
Hi Gregor
Thank you for the rapid answer.
"once you have manage to compile clFFT (not so difficult after installing the dependencies with homebrew)." Haha ! Let’s put that aside for the moment…
About Windows: It happens that I have been using clFFT on Windows for 2 years (not with Python, in which I am "fresh"). It is trivial to use the clFFT.dll dynamically (LoadLibrary and GetProcAddress functions of the Windows API). I really don’t understand why it requires in Python to go through any kind of compilation for such a simple dll use (the dll exists in the prebuilt binary available from the GitHub clFFT website) ??? This is not a question for you, just a general remark.
Thanks again
Yves
Le 30 janv. 2017 à 11:24, Gregor Thalhammer notifications@github.com a écrit :
Hi Yves,
agreed, building your Python packages yourself can be painful. I use mostly macOS for developing, building there is easy ('python setup.py install' after adjusting the path to clFFT in setup.py), once you have manage to compile clFFT (not so difficult after installing the dependencies with homebrew).
Compiling on Windows is more of a hassle, for Python 2.7 on 64bit Windows I could provide binaries (perhaps on Wednesday), I will add it to the GitHub releases section
Concerning the build directory, the source zip file from GitHub should not contain it (but did not check), it gets created if you (try to) build gpyfft, all files needed for installing are copied into this folder, but there is no automatic cleaning up. So likely it contains useless stuff.
Gregor
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/geggo/gpyfft/issues/30#issuecomment-276038722, or mute the thread https://github.com/notifications/unsubscribe-auth/AWDNnO3MWCmZbCPqE2toCqiz-HuRNtUoks5rXchsgaJpZM4LwQbb.
Actually the problem I have is not finding the gpyfftlib.py file.
Is it this file that needs a compilation process to be generated?
Yves
Yes, actually your are missing gpyfftlib.pyd (on Windows) or gpyfftlib.so (macOS, Linux), which is the binary Python extension module that provides access to the clFFT library.
Concerning your remark why a compilation is needed: it would be possible to directly call into the library, e.g. using the ctypes or cffi packages, but especially outside Windows this can be unreliable and might lead to crashes. "C libraries are typically meant to be used with a C compiler."
Gregor
Hi Gregor
Yesterday I was struggling to build gpyfft on Windows, due to an error
LINK : fatal error LNK1181: cannot open input file 'clFFT.lib'
when running 'python setup.py install'.
I simply copied
It may help others (I am not sure it is the legal way, but it worked...).
Yves
Hi Yves, thanks for the hint for compiling on Windows, are you using the Visual Studio compiler? I am using the mingwpy compiler package, which seems not to require an import library. So setup.py needs to be reworked to support compiling on Windows with both msvc and mingw, I'll give it a try tomorrow.
Gregor
Hi Gregor
I downloaded Microsoft Visual C++ Compiler for Python 2.7 https://www.microsoft.com/en-us/download/details.aspx?id=44266 I think it is that made the thing to work (although I am not 100 % sure as I poked around installing and deinstalling sw…)
Hope it helps
Yves
Le 31 janv. 2017 à 09:43, Gregor Thalhammer notifications@github.com a écrit :
Hi Yves, thanks for the hint for compiling on Windows, are you using the Visual Studio compiler? I am using the mingwpy compiler package, which seems not to require an import library. So setup.py needs to be reworked to support compiling on Windows with both msvc and mingw, I'll give it a try tomorrow.
Gregor
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/geggo/gpyfft/issues/30#issuecomment-276318427, or mute the thread https://github.com/notifications/unsubscribe-auth/AWDNnNsox-D1zARHWo6VKiXHvQrF6L_qks5rXwJfgaJpZM4LwQbb.
Hi Gregor
From your previous mail
"compile clFFT (not so difficult after installing the dependencies with homebrew) »
May I ask for the recipe ? Is there any batch file or sequence of terminal commands to do this ? I have not the full Xcode (I am not developer, just Python user) but I did install the Xcode Command Line Tools.
Thx in advance
Yves
Well, have no records for the installation steps, but here an attempt on how to build the clFFT libs on macOS, without guarantee for success
install Xcode Command Line Tools
install homebrew (http://brew.sh)
install cmake:
brew install cmake
install boost:
brew install boost
get sources for clFFT
build clFFT: in src directory of clFFT
cmake -G "Unix Makefiles" make optionally: make install
could be that some other dependencies are missing. In case, try to install them with brew.
hope that helps Gregor
Hi Gregor
Thank you for the code; I will try tonight and let you know.
For debugging, I suggest that FFT also prints the layouts:
if True:
print('axes', axes )
print('in_array.shape: ', in_array.shape)
print('in_array.strides/itemsize', tuple(s //
in_array.dtype.itemsize for s in in_array.strides)) print('shape transform ', t_shape) print('layout_in ', str(layout_in).split('.')[1]) print('t_strides ', t_strides_in) print('distance_in ', t_distance_in) print('batchsize ', t_batchsize_in) print('layout_out ', str(layout_out).split('.')[1]) print('t_stride_out ', t_strides_out) print('inplace ', t_inplace) print('')
There could be an attribute verbose to switch this display on and off.
Yves
Hi Gregor
Some news: your procedure for MacOSX seemed to work out of the box (I only had to sudo python setup.py install).
However, there seems to be something wrong, because simple_example.py throws an error:
/var/folders/r9/r79q21p53kn7r0hq552f8mbm0000gn/T/tmpt4K4g1.py in
/Users/yves/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/gpyfft-0.6.0-py2.7-macosx-10.6-x86_64.egg/gpyfft/fft.pyc in enqueue(self, forward, wait_for_events) 150 151 def enqueue(self, forward = True, wait_for_events = None): --> 152 return self.enqueue_arrays(forward=forward, data=self.data, result=self.result, wait_for_events=wait_for_events) 153 154 def enqueue_arrays(self, data = None, result = None, forward = True, wait_for_events = None):
/Users/yves/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/gpyfft-0.6.0-py2.7-macosx-10.6-x86_64.egg/gpyfft/fft.pyc in enqueue_arrays(self, data, result, forward, wait_for_events) 182 else: 183 events = self.plan.enqueue_transform((self.queue,), (data_buffer,), --> 184 direction_forward = forward, temp_buffer = self.temp_buffer, wait_for_events = wait_for_events) 185 186 return events
gpyfft\gpyfftlib.pyx in gpyfft.gpyfftlib.Plan.enqueue_transform (gpyfft/gpyfftlib.c:7533)()
gpyfft\gpyfftlib.pyx in gpyfft.gpyfftlib.errcheck (gpyfft/gpyfftlib.c:2214)()
GpyFFT_Error: 'INVALID_WORK_GROUP_SIZE’
Have you any idea about that ? BTW, is it the proper way to report problems ?
Thx
Yves
Le 31 janv. 2017 à 11:57, Gregor Thalhammer notifications@github.com a écrit :
Well, have no records for the installation steps, but here an attempt on how to build the clFFT libs on macOS, without guarantee for success
install Xcode Command Line Tools
install homebrew (http://brew.sh http://brew.sh/)
install cmake:
brew install cmake
install boost: brew install boost
get sources for clFFT
build clFFT: in src directory of clFFT
cmake -G "Unix Makefiles" make optionally: make install
could be that some other dependencies are missing. In case, try to install them with brew.
hope that helps Gregor
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/geggo/gpyfft/issues/30#issuecomment-276345098, or mute the thread https://github.com/notifications/unsubscribe-auth/AWDNnOY7VkE6CMSrZj1DtahAsgLPuSWwks5rXyGqgaJpZM4LwQbb.
Hi, great, you managed to build everything yourself! The error your encountered typically occurs if you select the CPU device for OpenCL context creation, on macOS it has limited capabilities. Try selecting a GPU device. Issues are for reporting any problem you find. best Gregor
Hi Gregor
My final mail, probably.
Yes, you were right; I replaced
context = cl.create_some_context()
by
context=cl.Context(dev_type=cl.device_type.GPU)
and everything began to work as fine on MacOSX as on Windows. (Could be included or mentioned in simple_example.py). The only thing that puzzles me is that you mentioned you were primarily developing on MacOS X, so you should have been faced to the problem ???
Thanks a lot for your help
Yves
Le 31 janv. 2017 à 16:57, Gregor Thalhammer notifications@github.com a écrit :
Hi, great, you managed to build everything yourself! The error your encountered typically occurs if you select the CPU device for OpenCL context creation, on macOS it has limited capabilities. Try selecting a GPU device. Issues are for reporting any problem you find. best Gregor
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/geggo/gpyfft/issues/30#issuecomment-276422827, or mute the thread https://github.com/notifications/unsubscribe-auth/AWDNnBDgjL8rnZo0peb14Cz9p3wGYXORks5rX2f1gaJpZM4LwQbb.
This puzzled me a bit, found the issue and added a comment in README.md. Probably you stumbled on a newer feature of pyopencl that create_some_context() silently chooses a device (typically the CPU device) when not run directly in a terminal.
have fun Gregor
Throws
at line
Change to what is in 'basic usage' at https://github.com/geggo/gpyfft