Code autogeneration =================== The xsuite library uses code autogeneration to specialize kernel code for the different contexts. Three contexts are presently available: ``cpu``, ``cuda``, and ``opencl``. The developer writes a single C source code, providing additional information through the comment strings (annotations) described in the following. ``vectorize_over`` block ~~~~~~~~~~~~~~~~~~~~~~~~ The syntax is the following: .. code-block:: C for (int myvar=0; myvar //only_for_context cpu ``gpufun`` directive ~~~~~~~~~~~~~~~~~~~~~ The ``\*gpufun*\`` directive is used to qualify device functions. The code generator replaces it with ``__device__`` in the CUDA code. ``gpukern`` directive ~~~~~~~~~~~~~~~~~~~~~ The ``\*gpukern*\`` directive is used to qualify kernel functions. The code generator replaces it with ``__global__`` in the CUDA code and with ``__kernel`` in the OpenCL code. ``gpuglmem`` directive ~~~~~~~~~~~~~~~~~~~~~~~ The ``\*gpuglmem*\`` directive is used to qualify pointers to locations in the device global memoru. The code generator replaces it with ``__global`` in the OpenCL code.