.. _oneapi-mkl-rng-leapfrog: oneapi::mkl::rng::leapfrog ============================== Proceed state of engine using the leapfrog method. .. contents:: :local: :depth: 1 Description *********** The ``oneapi::mkl::rng::leapfrog`` function generates random numbers in an engine with non-unit stride. This feature is particularly useful in distributing random numbers from the original stream across the stride buffers without generating the original random sequence with subsequent manual distribution. One of the important applications of the leapfrog method is splitting the original sequence into non-overlapping subsequences across stride computational nodes. The function initializes the original random stream (see the following figure) to generate random numbers for the computational node ``idx, 0 ≤idx < stride``, where ``stride`` is the largest number of computational nodes used. **Leapfrog Method** .. figure:: /_figures/GUID-D90F2CB0-58B4-42F5-A1F9-FD1EA859DD44-low.png :scale: 100% :align: center :alt: Leapfrog Method Leapfrog Method The leapfrog method is supported only for those basic generators that allow splitting elements by the leapfrog method, which is more efficient than simply generating them by a generator with subsequent manual distribution across computational nodes. See :ref:`VS Notes ` for details. The following code illustrates the initialization of three independent streams using the leapfrog method: Code for Leapfrog Method ------------------------ .. literalinclude:: /_examples/rng_leapfrog.cpp :language: cpp :linenos: API *** Syntax ------ .. code-block:: cpp template void leapfrog (Engine& engine, std::uint64_t idx, std::uint64_t stride) Include Files ------------- - ``oneapi/mkl/rng.hpp`` Input Parameters ---------------- .. list-table:: :header-rows: 1 * - Name - Type - Description * - engine - ``Engine`` - Object of engine class, which supports leapfrog. * - idx - ``std::uint64_t`` - Index of the computational node. * - stride - ``std::uint64_t`` - Largest number of computational nodes, or stride.