package modelkit-parallel

  1. Overview
  2. Docs
Bounded parallel execution for ModelKit

Install

dune-project
 Dependency

Authors

Maintainers

Sources

modelkit-0.3.2.tbz
sha256=a0335f799da12302a0568320b5f5c4c26c531a336740fea07f326cb2729ae8ac
sha512=bc692df9c0a868f99c14159c03c0c975d6fd51d6283a0e8491197abde8cebcd04f26ba990b66dc3ac711ab01bc8f7c2a4279fdf5b30a64ded5f622e0b2bcc630

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_validate and finite grid-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