Contexts ========= Xsuite supports different plaforms allowing the exploitation of different kinds of hardware (CPUs and GPUs). A context is initialized by instanciating objects from one of the context classes available Xobjects, which is then passed to the other Xsuite components (see example in :doc:`Getting Started Guide `). Contexts are interchangeable as they expose the same API. Custom kernel functions can be added to the contexts. General source code with annotations can be provided to define the kernels, which is then automatically specialized for the chosen platform (see :doc:`dedicated section `). Three contexts are presently available: - The :ref:`Cupy context`, based on `cupy`_-`cuda`_ to run on NVidia GPUs - The :ref:`Pyopencl context`, bases on `PyOpenCL`_, to run on CPUs or GPUs throught PyOPENCL library. - The :ref:`CPU context`, to use conventional CPUs The corresponfig API is described in the following subsections. .. _cupy: https://cupy.dev .. _cuda: https://developer.nvidia.com/cuda-zone .. _PyOpenCL: https://documen.tician.de/pyopencl/ .. _cupy_context: Cupy context ------------- .. autoclass:: xobjects.ContextCupy :members: :undoc-members: :member-order: bysource :inherited-members: .. _pyopencl_context: PyOpenCL context ----------------- .. autoclass:: xobjects.ContextPyopencl :members: :undoc-members: :member-order: bysource :inherited-members: .. _cpu_context: CPU context ------------ .. autoclass:: xobjects.ContextCpu :members: :undoc-members: :member-order: bysource :inherited-members: