.. index:: pair: class; gpr::linalg::ProbeExecutor .. _doxid-classgpr_1_1linalg_1_1_probe_executor: class gpr::linalg::ProbeExecutor ================================ .. toctree:: :hidden: Overview ~~~~~~~~ .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class ProbeExecutor { public: // construction :target:`ProbeExecutor`(); // methods Eigen::VectorXd :ref:`run`(int n_probes, const std::function& probe_fn, :ref:`KernelInverse::Kind` kind, const :ref:`MpiContext`& ctx) const; }; .. _details-classgpr_1_1linalg_1_1_probe_executor: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Methods ------- .. index:: pair: function; run .. _doxid-classgpr_1_1linalg_1_1_probe_executor_1a23e13e6ac99e7e8e1b6cbcf7b90c1fa1: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::VectorXd run(int n_probes, const std::function& probe_fn, :ref:`KernelInverse::Kind` kind, const :ref:`MpiContext`& ctx) const Run ``n_probes`` probe evaluations under the dispatch policy implied by ``kind``, against the MPI context ``ctx``, and return the global result vector. The result vector has length ``n_probes`` on every rank. Performance contract: the std::function parameter is type-erased; lambdas larger than the SBO threshold (~24-32 bytes on libstdc++) heap-allocate on construction. Callers should construct the std::function ONCE outside the loop and reuse it, not re-bind on every probe. The probe lambda itself is invoked n_probes / nprocs times under RankLocal kind, n_probes times under Distributed kind. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - n_probes - Total number of probes to evaluate. Must be >= 0. * - probe_fn - Callable with signature ``double(int)`` returning the scalar contribution of probe ``idx`` (in the range [0, n_probes)). May return NaN to signal failure; the executor will then return a vector of ``NaN`` on every rank. * - kind - Dispatch policy. ``RankLocal`` triggers round-robin partitioning + Allreduce-SUM. ``Distributed`` runs every probe on every rank with no Allreduce. * - ctx - MPI context. Use ``:ref:`MpiContext::local() ``` for the single-process path (always available) or ``MpiContext::world()`` under the ScaLAPACK build. .. rubric:: Returns: The ``n_probes`` -element vector of probe values, identical on every rank.