lenskit.parallel#

LensKit parallel computation support.

lenskit.parallel.init_threading(config=None)#

Set up and configure LensKit parallelism. This only needs to be called if you want to control when and how parallelism is set up; components using parallelism will call ensure_init(), which will call this function with its default arguments if it has not been called.

Parameters:

config (ParallelSettings | None)

lenskit.parallel.get_parallel_config()#

Get the active parallel configuration, making sure parallelism is configured first.

Return type:

ParallelSettings

lenskit.parallel.effective_cpu_count()#

Return the effective CPU count using the best available data. Tries the following in order:

  1. os.process_cpu_count()

  2. os.sched_getaffinity()

  3. os.cpu_count()

Return type:

int

lenskit.parallel.ensure_parallel_init()#

Make sure LensKit parallelism is configured, and configure with defaults if it is not.

Components using parallelism or intensive computations should call this function before they begin training.

lenskit.parallel.is_free_threaded(*, require_active=False)#

Query whether this Python supports free-threading.

Parameters:

require_active (bool) – Require that the GIL is actually disabled (i.e., no modules have re-enabled the GIL) in order to return True.

Returns:

Whether or not this Python supports free-threading.

Return type:

bool

Modules

config

ray

Support for parallelism with Ray.