{ "info": { "author": "kieran hervold", "author_email": "hervold@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "=========\npy2OpenCL\n=========\n\nOpenCL is a powerful means of applying the same simple function (a \"kernel\") to\nlarge arrays of similar data.\n\npy2OpenCL uses Python's AST module to convert a Python function to an OpenCL\nkernel (written in a C-like language), then uses Andreas Kl\u00f6ckner's PyOpenCL\nmodule to submit the kernel to the GPU. It is not meant to convert arbitrary\nPython code to OpenCL, as that would be impossible. Instead, it is limited to\nsimple Python lambdas and functions containing only simple mathematical operations\nand built-in OpenCL functions.\n\n\nExamples\n========\n\nThe following code returns a new numpy array holding the results of the lambda function:\n\n\n import numpy as np\n from py2opencl import Py2OpenCL, F\n \n py2 = Py2OpenCL( lambda x: -x if x < 0.5 else F.sin(x) )\n a = py2.map( np.random.rand(10000000) )\n\n print py2.kernel\n\n >> __kernel void sum( __global const float *x, __global float *res_g) {\n >> int gid = get_global_id(0);\n >> res_g[gid] = (((x[gid] < 0.5)) ? -x[gid] : sin( x[gid] ));\n >> }\n\n\nMore complex functions are supported, though there are many constraints. The following function\naverages the pixels of an image:\n\n import numpy as np\n from py2opencl import Py2OpenCL, F\n import Image\n \n img_path = 'py2opencl/test/Lenna.png'\n \n img = np.array( Image.open( img_path ).convert('RGB') )\n\n def avg( x, y, z, dest, src ):\n # note that the C code produced will handle wrapping automatically\n right = src[ x+1, y, z ]\n left = src[ x-1, y, z ]\n up = src[ x, y-1, z ]\n down = src[ x, y+1, z ]\n dest[x,y,z] = (right / 4) + (left / 4) + (up / 4) + (down / 4)\n \n dest = Py2OpenCL( avg ).map( img )\n Image.fromarray( dest, 'RGB').save('foo.png')\n\n\nOpenCL Drivers\n==============\n\nPy2OpenCL should work out-of-the-box on Mac OS X. If you're on Linux and don't have a fancy GPU,\nI'd suggest AMD's ICD, found `here http://developer.amd.com/tools-and-sdks/opencl-zone/opencl-tools-sdks/amd-accelerated-parallel-processing-app-sdk/`\n(as of 26 Jul 2014). It supports modern Intel CPU's, no GPU required. (Presumably it supports AMD CPUs as well.)\n\nAs of this writing, Intel's beignet driver appears to be broken on Ubuntu 14.04.\n\n\nTested Platforms\n================\n\n- NVIDIA CUDA / nvidia-opencl-icd-331 on Ubuntu 14.04\n- AMD Accelerated Parallel Processing (AMD-APP-SDK-v2.9) on Intel Core i7-3610QM, Ubuntu 14.04\n- Apple's OpenCL drivers for the Intel Core i5-4258U, OS X 10.9\n- Apple's OpenCL drivers for the Intel \"Iris\" (Intel HD 4000), OS X 10.9\n\n\nTODO\n====\n\n- support while loops and C-style for loops (ie, 'for i in range(n)')\n- performance writeup", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/hervold/py2opencl", "keywords": null, "license": "LICENSE.txt", "maintainer": null, "maintainer_email": null, "name": "py2opencl", "package_url": "https://pypi.org/project/py2opencl/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/py2opencl/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/hervold/py2opencl" }, "release_url": "https://pypi.org/project/py2opencl/0.4.0/", "requires_dist": null, "requires_python": null, "summary": "auto-creation of OpenCL kernels from pure Python code", "version": "0.4.0" }, "last_serial": 1302433, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "d6dbf167979c2e54d4a29a72df342276", "sha256": "ee8882f877ebda87f849deb5dd331eebf915542b1362177447704b443fbf8acb" }, "downloads": -1, "filename": "py2opencl-0.1.0.tar.gz", "has_sig": false, "md5_digest": "d6dbf167979c2e54d4a29a72df342276", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19336, "upload_time": "2014-07-27T06:05:24", "url": "https://files.pythonhosted.org/packages/38/06/c8cf42917b6173d5a10f35d3b2350b56cdc29a7673c8dd2234d4256559a8/py2opencl-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "62110a5aa8f5baf760b7768030e55d7b", "sha256": "64caf594e10fb427a5b6bdb13ac650a45ce7d5c2502944f8e01a9dd98a5c41d3" }, "downloads": -1, "filename": "py2opencl-0.1.1.tar.gz", "has_sig": false, "md5_digest": "62110a5aa8f5baf760b7768030e55d7b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19349, "upload_time": "2014-07-27T06:09:23", "url": "https://files.pythonhosted.org/packages/09/3f/a2d034cfa7f8939852818851464366a76c5cdc879608c2d5e638a466a98c/py2opencl-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "e56d4568a32eede197498525053b7cb2", "sha256": "f4cb39be2830231b3f88eb3a285952e340a2402cf40617a5d1ab787518b3ca53" }, "downloads": -1, "filename": "py2opencl-0.2.0.tar.gz", "has_sig": false, "md5_digest": "e56d4568a32eede197498525053b7cb2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23037, "upload_time": "2014-08-27T05:33:17", "url": "https://files.pythonhosted.org/packages/9a/6c/2d20aab150d1d034cfd806143c51ebd76ec4dcf015f0f88edef369622790/py2opencl-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "dd41201be09efd618d28410bc067a222", "sha256": "defdd17438f999f6772197c158e1a2549967d7f3a243560e8bd307e43472abf9" }, "downloads": -1, "filename": "py2opencl-0.2.1.tar.gz", "has_sig": false, "md5_digest": "dd41201be09efd618d28410bc067a222", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23057, "upload_time": "2014-08-27T06:26:56", "url": "https://files.pythonhosted.org/packages/d2/38/233eb7efcedd80c859260e4700bc9648da7a1d4760dfd4e8d723bba16881/py2opencl-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "2f142efd9c4cce0e8cd9bafeab7e35b0", "sha256": "a9fa8059dd7bc4816780a2b1d16b369205f7b87a217d4d6b90ddd1aeb29172f5" }, "downloads": -1, "filename": "py2opencl-0.2.2.tar.gz", "has_sig": false, "md5_digest": "2f142efd9c4cce0e8cd9bafeab7e35b0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 499516, "upload_time": "2014-08-29T06:36:28", "url": "https://files.pythonhosted.org/packages/9b/77/bf0ab278ea82199f40c7e26075aa361716f29f592ad6141a918f9e74ebb7/py2opencl-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "06a3f2e7b43b355acdb45c5f027ec0c3", "sha256": "ba1e649fb323cf467418b01fb34fc1e99586a61f85613960d2050ba83eb4680f" }, "downloads": -1, "filename": "py2opencl-0.2.3.tar.gz", "has_sig": false, "md5_digest": "06a3f2e7b43b355acdb45c5f027ec0c3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 499555, "upload_time": "2014-09-03T06:07:22", "url": "https://files.pythonhosted.org/packages/b2/04/fc1ed7e9af0b170b2b19f874ba34889cff2b2f870387fa15756a2ad8a128/py2opencl-0.2.3.tar.gz" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "a0710afff8a8bfbc9283fe32ea291b4e", "sha256": "f857c7fa410154f8c36764c1074419c131a01a4ee9018647958e6e89417d3e03" }, "downloads": -1, "filename": "py2opencl-0.2.4.tar.gz", "has_sig": false, "md5_digest": "a0710afff8a8bfbc9283fe32ea291b4e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 499603, "upload_time": "2014-09-03T06:26:52", "url": "https://files.pythonhosted.org/packages/cc/81/deaf50988ed73d4806e23fee75c6c96e1287da08b462e379e89b0c1b0006/py2opencl-0.2.4.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "703e251ee4ea99ec8cb34e2ef085871b", "sha256": "8073b01d54e42bb54a40c1152e258b5f0da6c8540f4d35abe543276e3fcf9642" }, "downloads": -1, "filename": "py2opencl-0.3.0.tar.gz", "has_sig": false, "md5_digest": "703e251ee4ea99ec8cb34e2ef085871b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 500364, "upload_time": "2014-09-11T03:20:27", "url": "https://files.pythonhosted.org/packages/17/51/0b2062b183b8836604c030da9d455115d848903063c3deabae737ad9bdcd/py2opencl-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "built for Linux-3.13.0-39-generic-x86_64-with-glibc2.4", "digests": { "md5": "9db005f40dba27035ddc3d498a56e9e9", "sha256": "890d7b60aa892e274a9f1a9e70dd1b7e747317301eb8a1cec3f96da082f1bb41" }, "downloads": -1, "filename": "py2opencl-0.4.0.linux-x86_64.tar.gz", "has_sig": false, "md5_digest": "9db005f40dba27035ddc3d498a56e9e9", "packagetype": "bdist_dumb", "python_version": "any", "requires_python": null, "size": 26650, "upload_time": "2014-11-11T16:48:30", "url": "https://files.pythonhosted.org/packages/e0/a5/72e5e8d26511149ffbd0fecdf62cf7123ccea4a3c2cbb314ec18742f0d0e/py2opencl-0.4.0.linux-x86_64.tar.gz" } ] }, "urls": [ { "comment_text": "built for Linux-3.13.0-39-generic-x86_64-with-glibc2.4", "digests": { "md5": "9db005f40dba27035ddc3d498a56e9e9", "sha256": "890d7b60aa892e274a9f1a9e70dd1b7e747317301eb8a1cec3f96da082f1bb41" }, "downloads": -1, "filename": "py2opencl-0.4.0.linux-x86_64.tar.gz", "has_sig": false, "md5_digest": "9db005f40dba27035ddc3d498a56e9e9", "packagetype": "bdist_dumb", "python_version": "any", "requires_python": null, "size": 26650, "upload_time": "2014-11-11T16:48:30", "url": "https://files.pythonhosted.org/packages/e0/a5/72e5e8d26511149ffbd0fecdf62cf7123ccea4a3c2cbb314ec18742f0d0e/py2opencl-0.4.0.linux-x86_64.tar.gz" } ] }