package modelkit-parallel

  1. Overview
  2. Docs
Bounded parallel execution for ModelKit

Install

dune-project
 Dependency

Authors

Maintainers

Sources

modelkit-0.5.0.tbz
sha256=1fe8fa7c7f904dd098a21a2ca30fd69230750b8cf8aa2ae481b97a16531b47b4
sha512=c946cd1ac014726f4d21791e14d806a205680e6edfa2f80ed8d3680f24f48ca3c5a2f89d5afa68c11eac4053ead448b6381fb3d06dc8ff129097af6c69b262fb

doc/modelkit-parallel/Modelkit_parallel/index.html

Module Modelkit_parallelSource

Optional bounded Domainslib execution for ModelKit.

Requested domains include the calling domain. A value of one delegates to ModelKit's portable sequential backend without creating a Domainslib pool. Parallel execution uses O(tasks) atomic result slots, runs at most domains task bodies concurrently, preserves logical result order, and returns the error from the lowest failing task index.

inner_threads describes the maximum threads used inside one task. When it is omitted, common BLAS/OpenMP environment limits are inspected and the largest valid value is used; otherwise one is assumed. Diagnostics never mutate process environment or numerical-library settings.

Sourcetype thread_limit = {
  1. variable : string;
  2. threads : int;
}

One valid positive limit read from the process environment.

Sourcetype thread_limit_source =
  1. | Assumed_sequential
  2. | Explicit
  3. | Environment of thread_limit array

How diagnostics.inner_threads was determined.

Sourcetype warning =
  1. | Invalid_environment_limit of {
    1. variable : string;
    2. value : string;
    }
  2. | Conflicting_environment_limits of thread_limit array
  3. | Nested_parallelism of {
    1. fold_domains : int;
    2. inner_threads : int;
    }
  4. | Potential_oversubscription of {
    1. estimated_runnable_threads : int;
    2. recommended_domains : int;
    }

Observable configuration concerns. Warnings do not prevent execution.

Sourcetype diagnostics = {
  1. fold_domains : int;
  2. recommended_domains : int;
  3. inner_threads : int;
  4. inner_thread_source : thread_limit_source;
  5. estimated_runnable_threads : int;
  6. warnings : warning array;
}

The effective fold and inner-task concurrency assessment. The runnable estimate is saturated at max_int rather than overflowing.

Sourcetype t
Sourceval create : ?inner_threads:int -> domains:int -> unit -> (t, Modelkit.Error.t) result

create ~domains () validates a positive total domain count. Supplying inner_threads overrides environment detection for diagnostics only; the backend does not configure numerical libraries.

Sourceval diagnostics : t -> diagnostics
Sourceval warning_to_string : warning -> string
Sourceval execution : t -> Modelkit.Execution.t

execution configuration packages this backend for cross-validation, learning-curve, validation-curve, permutation-test, and search calls.

include Modelkit.EXECUTION with type t := t
Sourceval concurrency : t -> int
Sourceval map : t -> f:(index:int -> 'input -> ('output, 'error) result) -> 'input array -> ('output array, 'error) result