lenskit.config.ParallelSettings =============================== .. py:class:: lenskit.config.ParallelSettings :canonical: lenskit.config._schema.ParallelSettings 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 .. 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: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.