diff --git a/pyopencl/_buffers.py b/pyopencl/_buffers.py index 27cf4f4cdf1766bf67a8c594dbde63f81d3ee7ef..bbf81a2fe3bb631dd9d28f13b86caa56a4fb84bc 100644 --- a/pyopencl/_buffers.py +++ b/pyopencl/_buffers.py @@ -106,7 +106,7 @@ try: CheckBuffer = ctypes.pythonapi.PyObject_CheckBuffer CheckBuffer.argtypes = [ctypes.py_object] CheckBuffer.restype = ctypes.c_int -except AttributeError as err: +except AttributeError: # Python 2.6 doesn't appear to have CheckBuffer support... def CheckBuffer(x): # noqa return True diff --git a/pyopencl/characterize/__init__.py b/pyopencl/characterize/__init__.py index 873e1c11c834b4c9b0dfa28837440f318b3a7b21..eae523be2f045bcadafb28166001cc6beeaf445f 100644 --- a/pyopencl/characterize/__init__.py +++ b/pyopencl/characterize/__init__.py @@ -390,8 +390,8 @@ def has_struct_arg_count_bug(dev, ctx=None): def _may_have_svm(dev): - has_svm = (dev.platform._get_cl_version() >= (2, 0) and - cl.get_cl_header_version() >= (2, 0)) + has_svm = (dev.platform._get_cl_version() >= (2, 0) + and cl.get_cl_header_version() >= (2, 0)) if dev.platform.name == "Portable Computing Language": has_svm = ( @@ -402,18 +402,18 @@ def _may_have_svm(dev): def has_coarse_grain_buffer_svm(dev): - return (_may_have_svm(dev) and - bool(dev.svm_capabilities + return (_may_have_svm(dev) + and bool(dev.svm_capabilities & cl.device_svm_capabilities.COARSE_GRAIN_BUFFER)) def has_fine_grain_buffer_svm(dev): - return (_may_have_svm(dev) and - bool(dev.svm_capabilities + return (_may_have_svm(dev) + and bool(dev.svm_capabilities & cl.device_svm_capabilities.FINE_GRAIN_BUFFER)) def has_fine_grain_system_svm(dev): - return (_may_have_svm(dev) and - bool(dev.svm_capabilities + return (_may_have_svm(dev) + and bool(dev.svm_capabilities & cl.device_svm_capabilities.FINE_GRAIN_SYSTEM)) diff --git a/src/bitlog.cpp b/src/bitlog.cpp index 88b820fa362668f9af11a31c8913dbeb03052e94..37ea93f79d2edd1298b1e181aa2c6a6bca81fdaf 100644 --- a/src/bitlog.cpp +++ b/src/bitlog.cpp @@ -1,9 +1,33 @@ -#include "bitlog.hpp" +// Base-2 logarithm bithack +// +// Copyright (C) 2009 Andreas Kloeckner +// Copyright (C) Sean Eron Anderson (in the public domain) +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +#include "bitlog.hpp" -/* from http://graphics.stanford.edu/~seander/bithacks.html */ const char pyopencl::log_table_8[] = { 0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, diff --git a/src/bitlog.hpp b/src/bitlog.hpp index e3ffbe01fe0ae00df25102246922deaa8dbf8b2e..5d2e398b02f2d774a247f2f3b774b38a6d6a7f3f 100644 --- a/src/bitlog.hpp +++ b/src/bitlog.hpp @@ -1,4 +1,29 @@ // Base-2 logarithm bithack. +// +// Copyright (C) 2009 Andreas Kloeckner +// Copyright (C) Sean Eron Anderson (in the public domain) +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + #ifndef _AFJDFJSDFSD_PYOPENCL_HEADER_SEEN_BITLOG_HPP #define _AFJDFJSDFSD_PYOPENCL_HEADER_SEEN_BITLOG_HPP @@ -10,13 +35,15 @@ namespace pyopencl { + /* from http://graphics.stanford.edu/~seander/bithacks.html */ + extern const char log_table_8[]; inline unsigned bitlog2_16(uint16_t v) { if (unsigned long t = v >> 8) return 8+log_table_8[t]; - else + else return log_table_8[v]; } @@ -24,7 +51,7 @@ namespace pyopencl { if (uint16_t t = v >> 16) return 16+bitlog2_16(t); - else + else return bitlog2_16(v); } @@ -33,7 +60,7 @@ namespace pyopencl #if (ULONG_MAX != 4294967295) if (uint32_t t = v >> 32) return 32+bitlog2_32(t); - else + else #endif return bitlog2_32(v); } diff --git a/src/mempool.hpp b/src/mempool.hpp index b24fcb02f8528b9e06f8011b69849a8a804b939d..3469af8c1d5599d7b79e9cbd1f057df912b7d1f3 100644 --- a/src/mempool.hpp +++ b/src/mempool.hpp @@ -1,4 +1,28 @@ // Abstract memory pool implementation +// +// Copyright (C) 2009-17 Andreas Kloeckner +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + #ifndef _AFJDFJSDFSD_PYGPU_HEADER_SEEN_MEMPOOL_HPP #define _AFJDFJSDFSD_PYGPU_HEADER_SEEN_MEMPOOL_HPP @@ -345,7 +369,7 @@ namespace PYGPU_PACKAGE } else throw PYGPU_PACKAGE::error( - "pooled_device_allocation::free", + "pooled_device_allocation::free", #ifdef PYGPU_PYCUDA CUDA_ERROR_INVALID_HANDLE #endif diff --git a/src/numpy_init.hpp b/src/numpy_init.hpp index 9d6393f480471d5829b226bef5f0d6d61c6643d8..2cf7fe0760ea8e37618960eae240c0ff5b329bd6 100644 --- a/src/numpy_init.hpp +++ b/src/numpy_init.hpp @@ -1,3 +1,29 @@ +// Numpy import/init +// +// Copyright (C) 2009 Andreas Kloeckner +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + + #ifndef _FAYHVVAAA_PYOPENCL_HEADER_SEEN_NUMPY_INIT_HPP #define _FAYHVVAAA_PYOPENCL_HEADER_SEEN_NUMPY_INIT_HPP diff --git a/src/tools.hpp b/src/tools.hpp index 935dab7ac03daf52a0610e6a202b65503856da1c..7fd906ef3263376304d8c05dda28156976a67976 100644 --- a/src/tools.hpp +++ b/src/tools.hpp @@ -1,3 +1,29 @@ +// Various odds and ends +// +// Copyright (C) 2009 Andreas Kloeckner +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + + #ifndef _ASDFDAFVVAFF_PYCUDA_HEADER_SEEN_TOOLS_HPP #define _ASDFDAFVVAFF_PYCUDA_HEADER_SEEN_TOOLS_HPP diff --git a/src/wrap_cl.cpp b/src/wrap_cl.cpp index 29b546e7a07441323cdf6614907b2fe5995f5915..2ea3d5913524a2000d03f719165a6208e5d1381a 100644 --- a/src/wrap_cl.cpp +++ b/src/wrap_cl.cpp @@ -1,3 +1,29 @@ +// PyOpenCL-flavored C++ wrapper of the CL API +// +// Copyright (C) 2009 Andreas Kloeckner +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + + #include "wrap_cl.hpp" diff --git a/src/wrap_cl.hpp b/src/wrap_cl.hpp index 0821bbab3b9c5e6fca2726ddefc30bcf770683ef..f76aba6b18054b9533945f735289b989e1240360 100644 --- a/src/wrap_cl.hpp +++ b/src/wrap_cl.hpp @@ -1,3 +1,29 @@ +// PyOpenCL-flavored C++ wrapper of the CL API +// +// Copyright (C) 2009 Andreas Kloeckner +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + + #ifndef _AFJHAYYTA_PYOPENCL_HEADER_SEEN_WRAP_CL_HPP #define _AFJHAYYTA_PYOPENCL_HEADER_SEEN_WRAP_CL_HPP diff --git a/src/wrap_cl_part_1.cpp b/src/wrap_cl_part_1.cpp index c3e6d5e81d2db08e43d60abcfa4b6c6cbfe32b3b..a87158f95344ba3e0c1edcffbffc98966bf22c81 100644 --- a/src/wrap_cl_part_1.cpp +++ b/src/wrap_cl_part_1.cpp @@ -1,3 +1,29 @@ +// Wrap CL +// +// Copyright (C) 2009-18 Andreas Kloeckner +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + + #include "wrap_cl.hpp" diff --git a/src/wrap_cl_part_2.cpp b/src/wrap_cl_part_2.cpp index 208ea1dcb23e41244255cde0650b8e8a3f0676c9..edef9ab7d8ce013a80be87647af6c9e3a6b20d06 100644 --- a/src/wrap_cl_part_2.cpp +++ b/src/wrap_cl_part_2.cpp @@ -1,3 +1,29 @@ +// Wrap CL +// +// Copyright (C) 2009-18 Andreas Kloeckner +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + + #include "wrap_cl.hpp" diff --git a/src/wrap_constants.cpp b/src/wrap_constants.cpp index 597e49c21219a7ef7220f2d3e7947bef16fb9cc2..48a165c08afbef8b11648e4cad3c979fb727ea3e 100644 --- a/src/wrap_constants.cpp +++ b/src/wrap_constants.cpp @@ -1,3 +1,29 @@ +// Wrap CL constants and errors +// +// Copyright (C) 2009 Andreas Kloeckner +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + + #include "wrap_cl.hpp" diff --git a/src/wrap_helpers.hpp b/src/wrap_helpers.hpp index 4a2d1ee99e8fd044897e9791680ffc1a5c139222..651274e021791af6db2fe6bcb78fcbdcef8c84b7 100644 --- a/src/wrap_helpers.hpp +++ b/src/wrap_helpers.hpp @@ -1,3 +1,29 @@ +// Wrapper-helping odds and ends +// +// Copyright (C) 2009 Andreas Kloeckner +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + + #ifndef PYCUDA_WRAP_HELPERS_HEADER_SEEN #define PYCUDA_WRAP_HELPERS_HEADER_SEEN diff --git a/src/wrap_mempool.cpp b/src/wrap_mempool.cpp index a15efeb64c848c4e5e3928c98a5fb9186749e12b..a6db0924e0aae8ac8ce3dfe50d4380234be6aa79 100644 --- a/src/wrap_mempool.cpp +++ b/src/wrap_mempool.cpp @@ -1,4 +1,30 @@ -// Gregor Thalhammer (on Apr 13, 2011) said it's necessary to import Python.h +// Warp memory pool +// +// Copyright (C) 2009 Andreas Kloeckner +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. + + +// Gregor Thalhammer (on Apr 13, 2011) said it's necessary to import Python.h // first to prevent OS X from overriding a bunch of macros. (e.g. isspace) #include diff --git a/test/test_clmath.py b/test/test_clmath.py index beebc2a8c0ad717e7139c340bff14a07fb77b60c..20f467aec8cee647c450564f256d54c8a0693566 100644 --- a/test/test_clmath.py +++ b/test/test_clmath.py @@ -298,8 +298,7 @@ def test_bessel(ctx_factory): if use_pyfmmlib and ( which_func == "j" - or - (which_func == "y" and n in [0, 1])): + or (which_func == "y" and n in [0, 1])): pyfmm_bessel = pfymm_result[:, n] error_pyfmm = get_err(cl_bessel, pyfmm_bessel) assert error_pyfmm < 1e-10, error_pyfmm diff --git a/test/test_wrapper.py b/test/test_wrapper.py index fff07e0d1e115d0ff80482a754f6d5b542fb2ea6..fba8ceb9d6cdcdc04792f9d4e9f1f5f8b817d184 100644 --- a/test/test_wrapper.py +++ b/test/test_wrapper.py @@ -667,8 +667,8 @@ def test_wait_for_events(ctx_factory): def test_unload_compiler(platform): - if (platform._get_cl_version() < (1, 2) or - cl.get_cl_header_version() < (1, 2)): + if (platform._get_cl_version() < (1, 2) + or cl.get_cl_header_version() < (1, 2)): from pytest import skip skip("clUnloadPlatformCompiler is only available in OpenCL 1.2") _skip_if_pocl(platform, (0, 13), 'pocl does not support unloading compiler') @@ -688,8 +688,8 @@ def test_platform_get_devices(ctx_factory): dev_types = [cl.device_type.ACCELERATOR, cl.device_type.ALL, cl.device_type.CPU, cl.device_type.DEFAULT, cl.device_type.GPU] - if (platform._get_cl_version() >= (1, 2) and - cl.get_cl_header_version() >= (1, 2) + if (platform._get_cl_version() >= (1, 2) + and cl.get_cl_header_version() >= (1, 2) and not platform.name.lower().startswith("nvidia")): dev_types.append(cl.device_type.CUSTOM) @@ -706,8 +706,8 @@ def test_platform_get_devices(ctx_factory): def test_user_event(ctx_factory): ctx = ctx_factory() - if (ctx._get_cl_version() < (1, 1) and - cl.get_cl_header_version() < (1, 1)): + if (ctx._get_cl_version() < (1, 1) + and cl.get_cl_header_version() < (1, 1)): from pytest import skip skip("UserEvent is only available in OpenCL 1.1") @@ -762,8 +762,8 @@ def test_buffer_get_host_array(ctx_factory): buf = cl.Buffer(ctx, mf.READ_WRITE | mf.USE_HOST_PTR, hostbuf=host_buf) host_buf2 = buf.get_host_array(25, np.float32) assert (host_buf == host_buf2).all() - assert (host_buf.__array_interface__['data'][0] == - host_buf.__array_interface__['data'][0]) + assert (host_buf.__array_interface__['data'][0] + == host_buf.__array_interface__['data'][0]) assert host_buf2.base is buf buf = cl.Buffer(ctx, mf.READ_WRITE | mf.ALLOC_HOST_PTR, size=100) @@ -887,8 +887,8 @@ def test_global_offset(ctx_factory): def test_sub_buffers(ctx_factory): ctx = ctx_factory() - if (ctx._get_cl_version() < (1, 1) or - cl.get_cl_header_version() < (1, 1)): + if (ctx._get_cl_version() < (1, 1) + or cl.get_cl_header_version() < (1, 1)): from pytest import skip skip("sub-buffers are only available in OpenCL 1.1") @@ -917,8 +917,8 @@ def test_spirv(ctx_factory): ctx = ctx_factory() queue = cl.CommandQueue(ctx) - if (ctx._get_cl_version() < (2, 1) or - cl.get_cl_header_version() < (2, 1)): + if (ctx._get_cl_version() < (2, 1) + or cl.get_cl_header_version() < (2, 1)): from pytest import skip skip("SPIR-V program creation only available in OpenCL 2.1 and higher")