# Installation

## Installing from Conda Forge

### Installing PyOpenCL

By far the easiest way to install PyOpenCL is to use the packages available in Conda Forge. Conda Forge is a repository of community-maintained packages for the Conda package manager. The following instructions are aimed at Linux and macOS. The analogous steps for Windows should also work.

Install a version of miniforge that fits your system:

    curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
    bash ./Miniforge3-*.sh
    # (answer questions, pick install location)

Then run:

    source /WHERE/YOU/INSTALLED/MINIFORGE/bin/activate root
    conda install pyopencl

You can install these pieces of software in your user account and do not need root/administrator privileges.

Note

This installs a conda environment based on Conda Forge. This is not interchangeable with a conda environment based on the (more common) anaconda. If you have an existing conda environment sitting around, just following the instructions below will likely not work. Instead, the suggested approach is to create new environment from scratch, starting with miniforge, above.

### Enabling access to CPUs and GPUs via (Py)OpenCL

Note that PyOpenCL is no fun (i.e. cannot run code) without an OpenCL device driver (a so-called “ICD”, for “installable client driver”) that provides access to hardware through OpenCL. If you get an error message like `pyopencl._cl.LogicError: clGetPlatformIDs failed: PLATFORM_NOT_FOUND_KHR`, that means PyOpenCL installed successfully, but you have no OpenCL drivers installed.

Note that drivers (ICDs) are separate pieces of software from PyOpenCL. They might be provided by your hardware vendor (e.g. for Nvidia or AMD GPUs). If you have such hardware, see below for instructions on how to make those work with PyOpenCL from Conda Forge.

It is important to note that OpenCL is not restricted to GPUs. In fact, no special hardware is required to use OpenCL for computation–your existing CPU is enough. On Linux or macOS, type:

    conda install pocl

to install a CPU-based OpenCL driver. On macOS, PoCL can offer a marked robustness (and, sometimes, performance) improvement over the OpenCL drivers built into the operating system.

On Linux and Windows, you can use Intel’s CPU OpenCL runtime:

    conda install intel-opencl-rt

On Linux Intel Broadwell or newer processors with an Intel graphics card, you can use NEO:

    conda install intel-compute-runtime

On Linux Intel Sandybridge or newer processors with an Intel graphics card, you can use Beignet:

    conda install beignet

On Linux, Windows and macOS, you can use Oclgrind to detect memory access errors:

    conda install oclgrind

You are now ready to run code based on PyOpenCL, such as the code examples.

### Using vendor-supplied OpenCL drivers (mainly on Linux)

The instructions above help you get a basic OpenCL environment going that will work independently of whether you have specialized hardware (such as GPUs or FPGAs) available. If you do have such hardware, read on for how to make it work.

On Linux, PyOpenCL finds which drivers are installed by looking for files with the extension `.icd` in a directory. PyOpenCL as installed from Conda will look for these files in `/WHERE/YOU/INSTALLED/MINICONDA/etc/OpenCL/vendors`. They are just simple text files containing either just the file names or the fully qualified path names of the shared library providing the OpenCL driver.

Note

If you ran the commands above in a Conda environment (i.e. if the environment indicator on your command line prompt says anything other than `(root)`), then you may need to use a path like the following instead:

`/WHERE/YOU/INSTALLED/MINICONDA/envs/ENVIRONMENTNAME/etc/OpenCL/vendors`

Note that you should replace `ENVIRONMENTNAME` with the name of your environment, shown between parentheses on your command line prompt. This path (for the currently-active conda environment) can be obtained from the environment variable `CONDA_PREFIX`, i.e.,

`$CONDA_PREFIX/etc/OpenCL/vendors` (once the Conda environment is activated).

On Linux, if you have other OpenCL drivers installed (such as for your GPU), those will be in `/etc/OpenCL/vendors`. You can make them work with PyOpenCL from Conda Forge by using the command:

    conda install ocl-icd-system

will make sure these system-wide ICDs are also visible in your conda environment. As an alternative, one may manually copy ICD files from `/etc/OpenCL/vendors` into, e.g., `$CONDA_PREFIX/etc/OpenCL/vendors`.

If you are looking for more information, see ocl-icd and its documentation. Ocl-icd is the “ICD loader” used by PyOpenCL when installed from Conda Forge on Linux. It represents the code behind `libOpenCL.so`.

On macOS, using the command:

    conda install ocl_icd_wrapper_apple

will make sure that the Apple provided CPU and GPU implementations are available.

On Windows, the packaging of PyOpenCL for Conda Forge relies on the Khronos ICD Loader, and it is packaged so that the OpenCL drivers that are registered in the OS using registry keys are automatically available.

## Installing from PyPI wheels

PyOpenCL distributes wheels for most popular OSs and Python versions. To check available versions please visit PyPI page for PyOpenCL.

On Linux, the wheels come with OCL-ICD bundled and configured to use any OpenCL implementation supporting the ICD interface and listed in `/etc/OpenCL/vendors`. Wheels for Windows and MacOS are built using the ICD Loader from the Khronos Group.

To install, type:

    pip install pyopencl

You can also install the following CPU based OpenCL implementation using pip shipped as binary wheels. Note that pyopencl has to be installed using a wheel for pyopencl to recognize these wheels.

To install pyopencl with PoCL, a CPU based implementation do:

    pip install pyopencl[pocl]

To install pyopencl with oclgrind, an OpenCL debugger do:

    pip install pyopencl[oclgrind]

Note

Avoid mixing components installed from Conda Forge and PyPI. For example, installing PyOpenCL from pip followed by OCL-ICD from Conda Forge can redirect the ICD loader, removing access to system-wide ICDs.

## Installing via Christoph Gohlke’s binary wheels (Windows)

Christoph Gohlke distributes binary wheels for PyOpenCL on Windows.

## Installing from source

Information on how to install PyOpenCL from source is still available on the Former PyOpenCL Wiki, but that should mostly not be necessary unless you have very specific needs or would like to modify PyOpenCL yourself.

# Tips

## Syntax highlighting

You can obtain Vim syntax highlighting for OpenCL C inlined in Python by checking this file.

Note that the triple-quoted strings containing the source must start with `"""//CL// ..."""`.

## IPython integration

PyOpenCL comes with IPython integration, which lets you seamlessly integrate PyOpenCL kernels into your IPython notebooks. Simply load the PyOpenCL IPython extension using:

    %load_ext pyopencl.ipython_ext

and then use the `%%cl_kernel` ‘cell-magic’ command. See this notebook (which ships with PyOpenCL) for a demonstration.

You can pass build options to be used for building the program executable by using the `-o` flag on the first line of the cell (next to the `%%cl_kernel` directive). For example:

    %%cl_kernel -o "-cl-fast-relaxed-math"

There are also line magics: `cl_load_edit_kernel` which will load a file into the next cell (adding `cl_kernel` to the first line) and `cl_kernel_from_file` which will compile kernels from a file (as if you copy-and-pasted the contents of the file to a cell with `cl_kernel`). Both of these magics take options `-f` to specify the file and optionally `-o` for build options.

Added in version 2014.1.

# Guidelines

## API Stability

I consider PyOpenCL’s API “stable”. That doesn’t mean it can’t change. But if it does, your code will generally continue to run. It may however start spewing warnings about things you need to change to stay compatible with future versions.

Deprecation warnings will be around for a whole year, as identified by the first number in the release name. (the “2014” in “2014.1”) I.e. a function that was deprecated in 2014.n will generally be removed in 2015.n (or perhaps later). Further, the stability promise applies for any code that’s part of a released version. It doesn’t apply to undocumented bits of the API, and it doesn’t apply to unreleased code downloaded from git.

## Relation with OpenCL’s C Bindings

We’ve tried to follow these guidelines when binding the OpenCL’s C interface to Python:

- Remove the `cl_`, `CL_` and `cl` prefix from data types, macros and function names.

- Follow PEP 8, i.e.

  - Make function names lowercase.

  - If a data type or function name is composed of more than one word, separate the words with a single underscore.

- `get_info` functions become attributes.

- Object creation is done by constructors, to the extent possible. (i.e. minimize use of “factory functions”)

- If an operation involves two or more “complex” objects (like e.g. a kernel enqueue involves a kernel and a queue), refuse the temptation to guess which one should get a method for the operation. Instead, simply leave that command to be a function.

## Interoperability with other OpenCL software

Just about every object in `pyopencl` supports the following interface (here shown as an example for `pyopencl.MemoryObject`, from which `pyopencl.Buffer` and `pyopencl.Image` inherit):

- `pyopencl.MemoryObject.from_int_ptr()`

- `pyopencl.MemoryObject.int_ptr`

This allows retrieving the C-level pointer to an OpenCL object as a Python integer, which may then be passed to other C libraries whose interfaces expose OpenCL objects. It also allows turning C-level OpenCL objects obtained from other software to be turned into the corresponding `pyopencl` objects.

Added in version 2013.2.

# User-visible Changes

## Unreleased

Note

This version is currently under development. You can get snapshots from PyOpenCL’s git repository.

## Version 2022.2

- Added opaque-style SVM and `pyopencl.SVMPointer`.

- Added `pyopencl.tools.SVMPool`.

- Added automatic queue-synchronized deallocation of SVM.

## Version 2020.2

- Drop Python 2 support.

- Add `allow_empty_ndrange` to kernel enqueue.

- Bug fixes.

## Version 2018.2

- Use pybind11.

- Many bug fixes.

- Support arrays with offsets in scan kernels.

## Version 2018.1

- Introduce eliminate_empty_output_lists argument of `pyopencl.algorithm.ListOfListsBuilder`.

- Many bug fixes.

## Version 2017.2

- Many bug fixes.

## Version 2017.1

- Introduce `pyopencl.cltypes`

## Version 2016.2

- Deprecate RANLUXCL. It will be removed in the 2018.x series of PyOpenCL.

- Introduce Random123 random number generators. See `pyopencl.clrandom` for more information.

- Add support for range and slice kwargs and data-less reductions to `pyopencl.reduction.ReductionKernel`.

- Add support for SPIR-V. (See `pyopencl.Program`.)

- Add support for Shared Virtual Memory (SVM).

- `pyopencl.MemoryMap` is usable as a context manager.

## Version 2016.1

- The `from_int_ptr` methods now take a retain parameter for more convenient ownership management.

- Kernel build options (if passed as a list) are now properly quoted. (This is a potentially compatibility-breaking change.)

- Many bug fixes. (GL interop, Windows, event callbacks and more)

## Version 2015.2.4

- Fix building on Windows, using mingwpy and VS 2015.

## Version 2015.2.3

- Fix one more Ubuntu 14.x build issue.

## Version 2015.2.2

- Fix compatibility with CL 1.1

- Fix compatibility with Ubuntu 14.x.

- Various bug fixes

## Version 2015.2.1

- Fix global_offset kernel launch parameter

## Version 2015.2

- [INCOMPATIBLE] Changed PyOpenCL’s complex numbers from `float2` and `double2` OpenCL vector types to custom `struct`. This was changed because it very easily introduced bugs where

  - complex*complex

  - real+complex

  look like they may do the right thing, but silently do the wrong thing.

- Rewrite of the wrapper layer to be based on CFFI

- Pypy compatibility

- Faster kernel invocation through Python launcher code generation

- PoCL compatibility

## Version 2015.1

- Support for new-style buffer protocol

- Numerous fixes

## Version 2014.1

- IPython integration

- Bug fixes

## Version 2013.2

- Add `pyopencl.array.Array.map_to_host()`.

- Support strides on `pyopencl.enqueue_map_buffer()` and `pyopencl.enqueue_map_image()`.

- `pyopencl.ImageFormat` was made comparable and hashable.

- `pyopencl.reduction` supports slicing (contributed by Alex Nitz)

- Added Interoperability with other OpenCL software

- Bug fixes

## Version 2013.1

- Vastly improved Prefix Sums (“scan”).

- Add `pyopencl.tools.match_dtype_to_c_struct()`, for better integration of the CL and `numpy` type systems.

- More/improved Bessel functions. See the source.

- Add `PYOPENCL_NO_CACHE` environment variable to aid debugging. (e.g. with AMD’s CPU implementation, see their programming guide)

- Deprecated `pyopencl.tools.register_dtype()` in favor of `pyopencl.tools.get_or_register_dtype()`.

- Clean up the `pyopencl.array.Array` constructor interface.

- Deprecate `pyopencl.array.DefaultAllocator`.

- Deprecate `pyopencl.tools.CLAllocator`

- Introduce `pyopencl.tools.DeferredAllocator`, `pyopencl.tools.ImmediateAllocator`.

- Allow arrays whose beginning does not coincide with the beginning of their `pyopencl.array.Array.data` `pyopencl.Buffer`. See `pyopencl.array.Array.base_data` and `pyopencl.array.Array.offset`. Note that not all functions in PyOpenCL support such arrays just yet. These will fail with `pyopencl.array.ArrayHasOffsetError`.

- Add `pyopencl.array.Array.__getitem__()` and `pyopencl.array.Array.__setitem__()`, supporting generic slicing.

  It is possible to create non-contiguous arrays using this functionality. Most operations (elementwise etc.) will not work on such arrays.

  Note also that some operations (specifically, reductions and scans) on sliced arrays that start past the beginning of the original array will fail for now. This will be fixed in a future release.

- `pyopencl.CommandQueue` may be used as a context manager (in a `with` statement)

- Add `pyopencl.clmath.atan2()`, `pyopencl.clmath.atan2pi()`.

- Add `pyopencl.array.concatenate()`.

- Add `pyopencl.Kernel.capture_call()`.

Note

The addition of `pyopencl.array.Array.__getitem__()` has an unintended consequence due to numpy bug 3375. For instance, this expression:

    numpy.float32(5) * some_pyopencl_array

may take a very long time to execute. This is because `numpy` first builds an object array of (compute-device) scalars (!) before it decides that that’s probably not such a bright idea and finally calls `pyopencl.array.Array.__rmul__`.

Note that only left arithmetic operations of `pyopencl.array.Array` by `numpy` scalars are affected. Python’s number types (`float` etc.) are unaffected, as are right multiplications.

If a program that used to run fast suddenly runs extremely slowly, it is likely that this bug is to blame.

Here’s what you can do:

- Use Python scalars instead of `numpy` scalars.

- Switch to right multiplications if possible.

- Use a patched `numpy`. See the bug report linked above for a pull request with a fix.

- Switch to a fixed version of `numpy` when available.

## Version 2012.1

- Support for complex numbers.

- Support for Bessel functions. (experimental)

- Numerous fixes.

## Version 2011.2

- Add `pyopencl.enqueue_migrate_mem_objects()`.

- Add `pyopencl.image_from_array()`.

- IMPORTANT BUGFIX: Kernel caching was broken for all the 2011.1.x releases, with severe consequences on the execution time of `pyopencl.array.Array` operations. Henrik Andresen at a PyOpenCL workshop at DTU first noticed the strange timings.

- All comparable PyOpenCL objects are now also hashable.

- Add `pyopencl.tools.context_dependent_memoize` to the documented functionality.

- Base `pyopencl.clrandom` on RANLUXCL (`https://bitbucket.org/ivarun/ranluxcl>`), add functionality.

- Add `pyopencl.NannyEvent` objects.

- Add `pyopencl.characterize`.

- Ensure compatibility with OS X Lion.

- Add `pyopencl.tools.register_dtype()` to enable scan/reduction on struct types.

- `pyopencl.enqueue_migrate_mem_objects()` was renamed `pyopencl.enqueue_migrate_mem_objects_ext`. `pyopencl.enqueue_migrate_mem_objects()` now refers to the OpenCL 1.2 function of this name, if available.

- `pyopencl.Device.create_sub_devices()` was renamed `pyopencl.Device.create_sub_devices_ext`. `pyopencl.Device.create_sub_devices()` now refers to the OpenCL 1.2 function of this name, if available.

- Alpha support for OpenCL 1.2.

## Version 2011.1.2

- More bug fixes.

## Version 2011.1.1

- Fixes for Python 3 compatibility. (with work by Christoph Gohlke)

## Version 2011.1

- All is_blocking parameters now default to True to avoid crashy-by-default behavior. (suggested by Jan Meinke) In particular, this change affects `pyopencl.enqueue_read_buffer`, `pyopencl.enqueue_write_buffer`, `pyopencl.enqueue_read_buffer_rect`, `pyopencl.enqueue_write_buffer_rect`, `pyopencl.enqueue_read_image`, `pyopencl.enqueue_write_image`, `pyopencl.enqueue_map_buffer`, `pyopencl.enqueue_map_image`.

- Add `pyopencl.reduction`.

- Add Reductions.

- Add `pyopencl.scan`.

- Add `pyopencl.MemoryObject.get_host_array()`.

- Deprecate context arguments of `pyopencl.array.to_device()`, `pyopencl.array.zeros()`, `pyopencl.array.arange()`.

- Make construction of `pyopencl.array.Array` more flexible (cqa argument.)

- Add Memory Pools.

- Add vector types, see `pyopencl.array.vec`.

- Add `pyopencl.array.Array.strides`, `pyopencl.array.Array.flags`. Allow the creation of arrays in C and Fortran order.

- Add `pyopencl.enqueue_copy()`. Deprecate all other transfer functions.

- Add support for numerous extensions, among them device fission.

- Add a compiler cache.

- Add the ‘g_times_l’ keyword arg to kernel execution.

## Version 0.92

- Add support for OpenCL 1.1.

- Add support for the cl_khr_gl_sharing extension, leading to working GL interoperability.

- Add `pyopencl.Kernel.set_args()`.

- The call signature of `pyopencl.Kernel.__call__()` changed to emphasize the importance of local_size.

- Add `pyopencl.Kernel.set_scalar_arg_dtypes()`.

- Add support for the cl_nv_device_attribute_query extension.

- Add `pyopencl.array.Array()` and related functionality.

- Make build not depend on Boost C++.

## Version 0.91.5

- Add `pyopencl.ImageFormat.channel_count`, `pyopencl.ImageFormat.dtype_size`, `pyopencl.ImageFormat.itemsize`.

- Add missing `pyopencl.enqueue_copy_buffer`.

- Add `pyopencl.create_some_context()`.

- Add `pyopencl.enqueue_barrier()`, which was previously missing.

## Version 0.91.4

A bugfix release. No user-visible changes.

## Version 0.91.3

- All parameters named host_buffer were renamed hostbuf for consistency with the `pyopencl.Buffer` constructor introduced in 0.91. Compatibility code is in place.

- The `pyopencl.Image` constructor does not need a shape parameter if the given hostbuf has hostbuf.shape.

- The `pyopencl.Context` constructor can now be called without parameters.

## Version 0.91.2

- `pyopencl.Program.build()` now captures build logs and adds them to the exception text.

- Deprecate `pyopencl.create_context_from_type` in favor of second form of `pyopencl.Context` constructor

- Introduce `pyopencl.LocalMemory`.

- Document kernel invocation and `pyopencl.Kernel.set_arg()`.

## Version 0.91.1

- Fixed a number of bugs, notably involving `pyopencl.Sampler`.

- `pyopencl.Device`, `pyopencl.Platform`, `pyopencl.Context` now have nicer string representations.

- Add `pyopencl.Image.shape`. (suggested by David Garcia)

## Version 0.91

- Add OpenCL Runtime: OpenGL Interoperability.

- Add a test suite.

- Fix numerous `get_info` bugs. (reports by David Garcia and the test suite)

- Add `pyopencl.ImageFormat.__repr__()`.

- Add `pyopencl.addressing_mode.to_string()` and colleagues.

- The `pitch` arguments to `pyopencl.create_image_2d`, `pyopencl.create_image_3d`, `pyopencl.enqueue_read_image`, and `pyopencl.enqueue_write_image` are now defaulted to zero. The argument order of `enqueue_{read,write}_image` has changed for this reason.

- Deprecate `pyopencl.create_image_2d`, `pyopencl.create_image_3d` in favor of the `pyopencl.Image` constructor.

- Deprecate `pyopencl.create_program_with_source`, `pyopencl.create_program_with_binary` in favor of the `pyopencl.Program` constructor.

- Deprecate `pyopencl.create_buffer`, `pyopencl.create_host_buffer` in favor of the `pyopencl.Buffer` constructor.

- `pyopencl.Image.get_image_info()` now actually exists.

- Add `pyopencl.Image.info`.

- Fix API tracing.

- Add constructor arguments to `pyopencl.ImageFormat`. (suggested by David Garcia)

## Version 0.90.4

- Add build fixes for Windows and OS X.

## Version 0.90.3

- Fix a GNU-ism in the C++ code of the wrapper.

## Version 0.90.2

- Fix `pyopencl.Platform.get_info()`.

- Fix passing properties to `pyopencl.CommandQueue`. Also fix related documentation.

## Version 0.90.1

- Fix building on the Mac.

## Version 0.90

- Initial release.

# License

PyOpenCL is licensed to you under the MIT/X Consortium license:

Copyright (c) 2009-13 Andreas Klöckner and Contributors.

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.

PyOpenCL includes derivatives of parts of the Thrust computing package (in particular the scan implementation). These parts are licensed as follows:

> Copyright 2008-2011 NVIDIA Corporation

> Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

> > <https://www.apache.org/licenses/LICENSE-2.0>

> Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Note

If you use Apache-licensed parts, be aware that these may be incompatible with software licensed exclusively under GPL2. (Most software is licensed as GPL2 or later, in which case this is not an issue.)

PyOpenCL includes parts of the Random123 suite of random number generators:

> Copyright 2010-2012, D. E. Shaw Research. All rights reserved.

> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

> - Redistributions of source code must retain the above copyright notice, this list of conditions, and the following disclaimer.

> - Redistributions in binary form must reproduce the above copyright notice, this list of conditions, and the following disclaimer in the documentation and/or other materials provided with the distribution.

> - Neither the name of D. E. Shaw Research nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

PyOpenCL includes the RANLUXCL random number generator:

> Copyright (c) 2011 Ivar Ursin Nikolaisen

> 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.

# Frequently Asked Questions

The FAQ is maintained collaboratively on the Wiki FAQ page.

# Citing PyOpenCL

We are not asking you to gratuitously cite PyOpenCL in work that is otherwise unrelated to software. That said, if you do discuss some of the development aspects of your code and would like to highlight a few of the ideas behind PyOpenCL, feel free to cite this article:

> Andreas Klöckner, Nicolas Pinto, Yunsup Lee, Bryan Catanzaro, Paul Ivanov, Ahmed Fasih, PyCUDA and PyOpenCL: A scripting-based approach to GPU run-time code generation, Parallel Computing, Volume 38, Issue 3, March 2012, Pages 157-174.

Here’s a Bibtex entry for your convenience:

    @article{kloeckner_pycuda_2012,
       author = {{Kl{\"o}ckner}, Andreas
            and {Pinto}, Nicolas
            and {Lee}, Yunsup
            and {Catanzaro}, B.
            and {Ivanov}, Paul
            and {Fasih}, Ahmed },
       title = "{PyCUDA and PyOpenCL: A Scripting-Based Approach to GPU Run-Time Code Generation}",
       journal = "Parallel Computing",
       volume = "38",
       number = "3",
       pages = "157--174",
       year = "2012",
       issn = "0167-8191",
       doi = "10.1016/j.parco.2011.09.001",
    }

# Acknowledgments

## Contributors

Too many to list. Please see the commit log for detailed acknowledgments.

## Funding

Work on pytential was supported in part by

- the US National Science Foundation under grant numbers DMS-1418961, DMS-1654756, SHF-1911019, and OAC-1931577, and

- the Department of Energy, National Nuclear Security Administration, under Award Number DE-NA0003963.

AK also gratefully acknowledges a hardware gift from Nvidia Corporation.

The views and opinions expressed herein do not necessarily reflect those of the funding agencies.

# Documentation Cross-References

## Numpy

class numpy.int8

  See `numpy.generic`.

class numpy.int32

  See `numpy.generic`.

class numpy.float64

  See `numpy.generic`.

## OpenCL Specification

type cl_platform_id

  See the CL specification.

type cl_device_id

  See the CL specification.

type cl_context

  See the CL specification.

type cl_command_queue

  See the CL specification.

type cl_mem

  See the CL specification.

type cl_program

  See the CL specification.

type cl_kernel

  See the CL specification.

type cl_sampler

  See the CL specification.

type cl_event

  See the CL specification.

void clCreateCommandQueueWithProperties()

  See the CL specification.

void clCreateSamplerWithProperties()

  See the CL specification.

void clCreatePipe()

  See the CL specification.

## Internal Types

class pyopencl._cl.Platform

  See `pyopencl.Platform`.

class pyopencl._cl.Device

  See `pyopencl.Device`.

class pyopencl._cl.CommandQueue

  See `pyopencl.CommandQueue`.

class pyopencl._cl.Context

  See `pyopencl.Context`.

class pyopencl._cl.Event

  See `pyopencl.Event`.

class pyopencl._cl.SVMAllocation

  See `pyopencl.SVMAllocation`.

class pyopencl._cl.MemoryMap

  See `pyopencl.MemoryMap`.

class pyopencl._cl.Sampler

  See `pyopencl.Sampler`.

class pyopencl._cl.Program

  See `pyopencl.Program`.

class pyopencl._cl._Program

  See `pyopencl.Program`.

class pyopencl._cl.Kernel

  See `pyopencl.Kernel`.