IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).

Mojo function

bench_multicontext

def bench_multicontext[bench_fn: def(mut Bencher, DeviceContext, Int) raises capturing thin -> None](mut self_: Bench, list_of_ctx: List[DeviceContext], bench_id: BenchId, measures: List[ThroughputMeasure] = List())

Benchmarks or Tests an input function across multiple device contexts.

The metric returned represents the slowest performing device.

Parameters:

  • ​bench_fn (def(mut Bencher, DeviceContext, Int) raises capturing thin -> None): The function to be benchmarked.

Args:

  • ​self_ (Bench): The benchmark configuration.
  • ​list_of_ctx (List[DeviceContext]): A list of device contexts on which the bench_fn is run in parallel.
  • ​bench_id (BenchId): The benchmark Id object used for identification.
  • ​measures (List[ThroughputMeasure]): Optional arg used to represent a list of ThroughputMeasure's.

Raises:

If the operation fails.

def bench_multicontext[FuncType: def(mut Bencher, DeviceContext, Int) -> None](mut self_: Bench, func: FuncType, list_of_ctx: List[DeviceContext], bench_id: BenchId, measures: List[ThroughputMeasure] = List())

Benchmarks or Tests an input function across multiple device contexts.

The metric returned represents the slowest performing device.

Parameters:

  • ​FuncType (def(mut Bencher, DeviceContext, Int) -> None): The body function type.

Args:

  • ​self_ (Bench): The benchmark configuration.
  • ​func (FuncType): The closure carrying the captured state of the body function.
  • ​list_of_ctx (List[DeviceContext]): A list of device contexts on which the bench_fn is run in parallel.
  • ​bench_id (BenchId): The benchmark Id object used for identification.
  • ​measures (List[ThroughputMeasure]): Optional arg used to represent a list of ThroughputMeasure's.

Raises:

If the operation fails.

Was this page helpful?