lenskit.parallel.config#

Functions

effective_cpu_count()

Return the effective CPU count using the best available data.

ensure_parallel_init()

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

get_parallel_config()

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

init_threading([config])

Set up and configure LensKit parallelism.

is_free_threaded(*[, require_active])

Query whether this Python supports free-threading.

lenskit.parallel.config.get_parallel_config()#

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

Return type:

ParallelSettings

lenskit.parallel.config.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.config.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.config.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

lenskit.parallel.config.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