diff --git a/.gitmodules b/.gitmodules index 779ec4875e9d74d3b4eef45f6349e551c3258339..cb5a4e231848994b7d000813df14d87155613ece 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "pyopencl/compyte"] path = pyopencl/compyte url = https://github.com/inducer/compyte +[submodule "src/c_wrapper/mingw-std-threads"] + path = src/c_wrapper/mingw-std-threads + url = https://github.com/meganz/mingw-std-threads.git diff --git a/MANIFEST.in b/MANIFEST.in index 27620315df94c908997e2ebfcd1748144a3f81e0..b04caf8b64c87d4469166559989695921e684050 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -4,6 +4,7 @@ include pyopencl/cl/*.cl include src/c_wrapper/*.hpp include src/c_wrapper/*.h include src/c_wrapper/*.cpp +include src/c_wrapper/mingw-std-wrappers/mingw.*.h include *.h include test/*.py include test/*.h diff --git a/pyopencl/cffi_cl.py b/pyopencl/cffi_cl.py index f2c9206378a2b898ad0602905d743ce7469a2c29..a4ba6e41595825ccea3c56965fc19e33308a87fc 100644 --- a/pyopencl/cffi_cl.py +++ b/pyopencl/cffi_cl.py @@ -35,7 +35,8 @@ import sys from pyopencl._cffi import ffi as _ffi from .compyte.array import f_contiguous_strides, c_contiguous_strides -_lib = _ffi.dlopen(None) + +from pyopencl._cffi import lib as _lib class _CLKernelArg(object): @@ -456,7 +457,8 @@ class migrate_mem_object_flags_ext(_NoInit): # noqa _locals = locals() -@_ffi.callback('void (*)(const char*, const char* name, long value)') +# TODO: constant values are cl_ulong +@_ffi.callback('void (*)(const char*, const char* name, unsigned long value)') def _constant_callback(type_, name, value): setattr(_locals[_ffi_pystr(type_)], _ffi_pystr(name), value) # noqa diff --git a/src/c_wrapper/debug.h b/src/c_wrapper/debug.h index c5616587058bcd4a3784cfe7a97ce73401aed5b9..d314da4ff8ae12f63a557697385e45bc89944e23 100644 --- a/src/c_wrapper/debug.h +++ b/src/c_wrapper/debug.h @@ -1,8 +1,18 @@ #include "wrap_cl.h" #include "function.h" #include + +#ifdef __MINGW32__ + +#include "mingw-std-threads/mingw.mutex.h" +#include "mingw-std-threads/mingw.thread.h" + +#else + #include +#endif + #ifndef __PYOPENCL_DEBUG_H #define __PYOPENCL_DEBUG_H diff --git a/src/c_wrapper/mingw-std-threads b/src/c_wrapper/mingw-std-threads new file mode 160000 index 0000000000000000000000000000000000000000..776ce7faf9368ec9588ee77458799c281cb25737 --- /dev/null +++ b/src/c_wrapper/mingw-std-threads @@ -0,0 +1 @@ +Subproject commit 776ce7faf9368ec9588ee77458799c281cb25737 diff --git a/src/c_wrapper/wrap_cl_core.h b/src/c_wrapper/wrap_cl_core.h index 9f4c751fa666e56d04416e3f5de407e6d07f0b56..0cae572ab211743350a9ad05ac22ecf0226b5027 100644 --- a/src/c_wrapper/wrap_cl_core.h +++ b/src/c_wrapper/wrap_cl_core.h @@ -56,7 +56,7 @@ void set_py_funcs(int (*_gc)(), void *(*_ref)(void*), void (*_deref)(void*), int have_gl(); unsigned bitlog2(unsigned long v); -void populate_constants(void(*add)(const char*, const char*, long value)); +void populate_constants(void(*add)(const char*, const char*, unsigned long value)); int get_debug(); void set_debug(int debug); diff --git a/src/c_wrapper/wrap_constants.cpp b/src/c_wrapper/wrap_constants.cpp index 1ac31e15c7291e798463ef503448abc3ae9dcf11..952d3b51b063529d7f3d603f0f9fac68fbf9e77f 100644 --- a/src/c_wrapper/wrap_constants.cpp +++ b/src/c_wrapper/wrap_constants.cpp @@ -2,7 +2,7 @@ #include extern "C" -void populate_constants(void(*add)(const char*, const char*, long value)) +void populate_constants(void(*add)(const char*, const char*, unsigned long value)) { #define _ADD_ATTR(TYPE, PREFIX, NAME, SUFFIX, ...) \ add(TYPE, #NAME, CL_##PREFIX##NAME##SUFFIX)