ak.to_kernels
-------------

Defined in `awkward.operations.convert <https://github.com/scikit-hep/awkward-1.0/blob/80bbef0738a6b7928333d7c705ee1b359991de5b/src/awkward/operations/convert.py>`__ on `line 782 <https://github.com/scikit-hep/awkward-1.0/blob/80bbef0738a6b7928333d7c705ee1b359991de5b/src/awkward/operations/convert.py#L782>`__.

.. py:function:: ak.to_kernels(array, kernels, highlevel=True, behavior=None)


    :param array: Data to convert to a specified ``kernels`` set.
    :param kernels: If ``"cpu"``, the array structure is
                recursively copied (if need be) to main memory for use with
                the default ``libawkward-cpu-kernels.so``; if ``"cuda"``, the
                structure is copied to the GPU(s) for use with
                ``libawkward-cuda-kernels.so``.
    :type kernels: ``"cpu"`` or ``"cuda"``
    :param highlevel: If True, return an :py:obj:`ak.Array`; otherwise, return
                  a low-level :py:obj:`ak.layout.Content` subclass.
    :type highlevel: bool
    :param behavior: Custom :py:obj:`ak.behavior` for the output array, if
                 high-level.
    :type behavior: None or dict

Converts an array from ``"cpu"``, ``"cuda"``, or ``"mixed"`` kernels to ``"cpu"``
or ``"cuda"``.

An array is ``"mixed"`` if some components are set to use ``"cpu"`` kernels and
others are set to use ``"cuda"`` kernels. Mixed arrays can't be used in any
operations, and two arrays set to different kernels can't be used in the
same operation.

Any components that are already in the desired kernels library are viewed,
rather than copied, so this operation can be an inexpensive way to ensure
that an array is ready for a particular library.

To use ``"cuda"``, the package
`awkward-cuda-kernels <https://pypi.org/project/awkward-cuda-kernels>`__
be installed, either by

.. code-block:: python


    pip install awkward-cuda-kernels

or as an optional dependency with

.. code-block:: python


    pip install awkward[cuda] --upgrade

It is only available for Linux as a binary wheel, and only supports Nvidia
GPUs (it is written in CUDA).

See :py:obj:`ak.kernels`.

