Am 2015-08-26 03:21, schrieb Gregor Thalhammer:

I am glad to report that I finally managed to build recent pyopencl
master on Windows 7 (64bit), with Anaconda Python 2.7 (64bit), and
wrapper tests pass.

Here a summary of the issues I encountered:

* Building with Microsoft Visual Studio 2008 is hopeless, it misses
all the new C++ features (even the integer types such as uint64_t)
used throughout pyopencl.

* Instead I used the mingw compiler toolchain (carlkl/mingwpy 0.1.0b3
from binstar, gcc 4.9.2, x86_64-win32-seh-rev201506), with CXXFLAGS
-std=c++11, (also c++0x is ok) and compiling with
python setup.py build_ext -—compiler=mingw32

* This toolchain, built with win32 thread support, does not support
std::mutex or std::thread. One solution I found is to use
https://github.com/meganz/mingw-std-threads [2]
which provides the missing functions. In debug.h I added
#include "mingw.mutex.h"
#include "mingw.thread.h"

* In pyopencl the OpenCL constants end up as int attributes of Python
classes. However, on Windows a Python int is only 32bit, too small to
hold e.g. device_type.ALL, which is defined with a value of 0xFFFFFFFF
(but got wrapped to -1, which evokes errors).
In wrap_constants.cpp I changed the signature for the last argument
(value) of populate_constants() from long to unsigned long (actually,
shouldn’t this be a cl_uint?)

The changes I applied to the source are attached as a patch file. No
idea if these are a proper way to resolve the issues, nor made I an
attempt to make them platform specific.

Hi Gregor,

that is great news! Thank you very much for slogging through and making this build on Windows. I have merged your patch into PyOpenCL, with some changes to hopefully make it cross-platform. It does build on Linux. It would be great if you could let me know if this also builds on MinGW unmodified. (And if it doesn't, ideally submit any more changes in it that need to be made.) Note that I included the supplemental threads headers as a git submodule, so you may have to do "git submodule update --init" in order to pick up those changes.

Once again, thank you very much for your contribution.

Andreas

_______________________________________________
PyOpenCL mailing list
[email protected]
http://lists.tiker.net/listinfo/pyopencl

Reply via email to