Module tokenizers::utils::parallelism

source ·
Expand description

This module defines helpers to allow optional Rayon usage.

Constants§

Traits§

  • Converts any serial iterator into a CondIterator, that can either run parallelly or serially.
  • Allows to convert into an iterator that can be executed either parallelly or serially.
  • Shared reference version of MaybeParallelIterator, works the same but returns an iterator over references, does not consume self
  • Exclusive reference version of MaybeParallelIterator, works the same but returns an iterator over mutable references, does not consume self
  • Allows to convert into chunks that can be executed either parallelly or serially.

Functions§

  • Returns the number of threads in the current registry. If this code is executing within a Rayon thread-pool, then this will be the number of threads for the thread-pool of the current thread. Otherwise, it will be the number of threads for the global thread-pool.
  • Get the currently set value for TOKENIZERS_PARALLELISM env variable
  • Check if at some point we used a parallel iterator
  • Check if the TOKENIZERS_PARALLELISM env variable has been explicitly set
  • Set the value for TOKENIZERS_PARALLELISM for the current process