lenskit.schemas.settings.ParallelSettings ========================================= .. py:class:: lenskit.schemas.settings.ParallelSettings(_case_sensitive = None, _nested_model_default_partial_update = None, _env_prefix = None, _env_prefix_target = None, _env_file = ENV_FILE_SENTINEL, _env_file_encoding = None, _env_ignore_empty = None, _env_nested_delimiter = None, _env_nested_max_split = None, _env_parse_none_str = None, _env_parse_enums = None, _cli_prog_name = None, _cli_parse_args = None, _cli_settings_source = None, _cli_parse_none_str = None, _cli_hide_none_type = None, _cli_avoid_json = None, _cli_enforce_required = None, _cli_use_class_docs_for_groups = None, _cli_show_env_vars = None, _cli_exit_on_error = None, _cli_prefix = None, _cli_flag_prefix_char = None, _cli_implicit_flags = None, _cli_ignore_unknown_args = None, _cli_kebab_case = None, _cli_shortcuts = None, _secrets_dir = None, _build_sources = None, **values) Bases: :py:obj:`pydantic_settings.BaseSettings` Configuration for LensKit's parallel processing. These settings are in the ``[parallel]`` table in ``lenskit.toml``. .. seealso:: :ref:`parallel-config` .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:attribute:: num_cpus :type: int :value: 0 The number of CPUs LensKit should consider using. This is auto-detected from the system environment, and should only be configured manually if you want to override LensKit's CPU detection for some reason. Note that the auto-detected values *do* account for operating system scheduling affinities and CPU limits. This value is not used directly as a limit, but is used to derive the default values for the other concurrency controls (threads, etc.). .. py:attribute:: use_ray :type: bool :value: False Use Ray to parallelize batch operations, hyperparameter tuning, etc. .. py:attribute:: num_batch_jobs :type: int :value: 0 Number of batch inference jobs to run in parallel. Can be overridden with the :envvar:`LK_NUM_BATCH_JOBS` environment variable. .. py:attribute:: num_procs :type: int :value: 0 Number of processes to use. .. py:attribute:: num_threads :type: int :value: 0 Number of threads to use. Can be overridden with the :envvar:`LK_NUM_THREADS` environment variable. Specify -1 to use all available threads. .. py:attribute:: num_backend_threads :type: int :value: 0 Number of threads for compute backends to use. Can be overridden with the :envvar:`LK_NUM_BACKEND_THREADS` environment variable. Specify -1 to leave threading limits unmodified. .. py:attribute:: tune_jobs :type: int | None :value: None Maximum number of hyperparamter tuning jobs. Alias for :attr:`TuneSettings.jobs`. .. py:property:: total_threads .. py:method:: resolve_defaults() Resolve default values for thread/process counts. .. py:method:: env_vars() Get the parallel configuration as a set of environment variables to configure a child process. The set also includes ``OMP_NUM_THREADS`` and related variables for BLAS and MKL to configure OMP early.