diff --git a/MANIFEST.in b/MANIFEST.in index aef7d36079902368807d1d82c6c55321870160b6..7483e8d6fdfe592ab39e6094659a468cf1f57992 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,8 +1,9 @@ include pyopencl/cl/*.h include pyopencl/cl/*.cl -include src/wrapper/*.hpp -include src/wrapper/*.cpp +include src/c_wrapper/*.hpp +include src/c_wrapper/*.h +include src/c_wrapper/*.cpp include test/*.py include test/*.h include examples/*.py @@ -20,7 +21,4 @@ include aksetup_helper.py include README_SETUP.txt include README.rst -recursive-include bpl-subset/bpl_subset/boost *.h *.hpp *.cpp *.html *.inl *.ipp *.pl *.txt -recursive-include bpl-subset/bpl_subset/libs *.h *.hpp *.cpp *.html *.inl *.ipp *.pl *.txt - recursive-include contrib *.vim *.py README diff --git a/pyopencl/_cffi.py b/pyopencl/_cffi.py index 5c23341ee0da76de4bcf86c927bcd1ea93ffeb62..712949ccaedad22444276cc6c2e4b77f49c8902a 100644 --- a/pyopencl/_cffi.py +++ b/pyopencl/_cffi.py @@ -1,9 +1,9 @@ from cffi import FFI import os.path - current_directory = os.path.dirname(__file__) + _ffi = FFI() _cl_header = """ @@ -98,25 +98,25 @@ with open(os.path.join(current_directory, 'wrap_cl_core.h')) as _f: _ffi.cdef('%s\n%s' % (_cl_header, _wrap_cl_header)) -def _get_verifier(**kwargs): +# def _get_verifier(**kwargs): - # called by setup.py at build-time, with the relevant sources/include dirs/defines. - # called by pyopencl at runtime with no kwargs, as we do not want to build at runtime, - # but only get the cached version. +# # called by setup.py at build-time, with the relevant sources/include dirs/defines. +# # called by pyopencl at runtime with no kwargs, as we do not want to build at runtime, +# # but only get the cached version. - _ffi.verify( - """ - #include - """, - # needs to be the same as ext_package in setup.py - ext_package='pyopencl', - modulename='cffi_wrapcl', - **kwargs) +# _ffi.verify( +# """ +# #include +# """, +# # needs to be the same as ext_package in setup.py +# ext_package='pyopencl', +# modulename='cffi_wrapcl', +# **kwargs) - return _ffi.verifier +# return _ffi.verifier def _get_lib(): - # is expected to return the library from cache - return _ffi, _get_verifier().load_library() + # todo: cross platform library extension? + return _ffi, _ffi.dlopen(os.path.join(current_directory, "_wrapcl.so")) diff --git a/pyopencl/cffi_cl.py b/pyopencl/cffi_cl.py index ceb0fbb0b4c61033318eb1c1aaadfae492a1b396..8f8ce993535a7877bed7f9a619babfd049ac889b 100644 --- a/pyopencl/cffi_cl.py +++ b/pyopencl/cffi_cl.py @@ -734,7 +734,7 @@ class Sampler(_Common): filter_mode)) self.ptr = ptr[0] -# class GLTexture(MemoryObject): +# class GLTexture(Image): # _id = 'gl_texture' # def __init__(self, context, flags, texture_target, miplevel, texture, dims): diff --git a/setup.py b/setup.py index 931767dab75b2c351fd5f812e2500cf7e96843a1..ff6653163c68d0185a3274b21142748378e67cd0 100644 --- a/setup.py +++ b/setup.py @@ -162,12 +162,12 @@ def main(): import shutil shutil.copyfile("src/c_wrapper/wrap_cl_core.h", "pyopencl/wrap_cl_core.h") - from pyopencl._cffi import _get_verifier - import os.path - current_directory = os.path.dirname(__file__) + # from pyopencl._cffi import _get_verifier + # import os.path + # current_directory = os.path.dirname(__file__) - # for development: clean cache such that the extension is rebuilt - shutil.rmtree(os.path.join(current_directory, 'pyopencl', '__pycache__/'), ignore_errors=True) + # # for development: clean cache such that the extension is rebuilt + # shutil.rmtree(os.path.join(current_directory, 'pyopencl', '__pycache__/'), ignore_errors=True) setup(name="pyopencl", # metadata @@ -214,20 +214,31 @@ def main(): ext_package="pyopencl", ext_modules=[ - _get_verifier( - sources=[ - "src/c_wrapper/wrap_cl.cpp", - "src/c_wrapper/wrap_constants.cpp", - #"src/c_wrapper/wrap_mempool.cpp", - "src/c_wrapper/bitlog.cpp", - ], - include_dirs=conf["CL_INC_DIR"] + ["src/c_wrapper/"], - library_dirs=conf["CL_LIB_DIR"], - libraries=conf["CL_LIBNAME"], - define_macros=list(EXTRA_DEFINES.items()), - extra_compile_args=conf["CXXFLAGS"], - extra_link_args=conf["LDFLAGS"], - ).get_extension() + # _get_verifier( + # sources=[ + # "src/c_wrapper/wrap_cl.cpp", + # "src/c_wrapper/wrap_constants.cpp", + # #"src/c_wrapper/wrap_mempool.cpp", + # "src/c_wrapper/bitlog.cpp", + # ], + # include_dirs=conf["CL_INC_DIR"] + ["src/c_wrapper/"], + # library_dirs=conf["CL_LIB_DIR"], + # libraries=conf["CL_LIBNAME"], + # define_macros=list(EXTRA_DEFINES.items()), + # extra_compile_args=conf["CXXFLAGS"], + # extra_link_args=conf["LDFLAGS"], + # ).get_extension() + NumpyExtension("_wrapcl", + ["src/c_wrapper/wrap_cl.cpp", + "src/c_wrapper/wrap_constants.cpp", + #"src/c_wrapper/wrap_mempool.cpp", + "src/c_wrapper/bitlog.cpp",], + include_dirs=conf["CL_INC_DIR"] + ["src/c_wrapper/"], + library_dirs=conf["CL_LIB_DIR"], + libraries=conf["CL_LIBNAME"], + define_macros=list(EXTRA_DEFINES.items()), + extra_compile_args=conf["CXXFLAGS"], + extra_link_args=conf["LDFLAGS"]) ], include_package_data=True,