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

parallelize_over_rows

parallelize_over_rows[func: def(Int, Int) capturing -> None](shape: IndexList[element_type=shape.element_type], axis: Int, grain_size: Int, ctx: Optional[DeviceContext] = None)

Parallelize func over non-axis dims of shape.

Parameters:

  • func (def(Int, Int) capturing -> None): Function to call on range of rows.

Args:

parallelize_over_rows[FuncType: def(Int, Int) register_passable -> None](func: FuncType, shape: IndexList[element_type=shape.element_type], axis: Int, grain_size: Int, ctx: Optional[DeviceContext] = None)

Parallelize func over non-axis dims of shape.

Parameters:

  • FuncType (def(Int, Int) register_passable -> None): The body function type.

Args:

  • func (FuncType): The closure carrying the captured state of the body function.
  • shape (IndexList[element_type=shape.element_type]): Shape to parallelize over.
  • axis (Int): Rows are slices along the axis dimension of shape.
  • grain_size (Int): The minimum number of elements to warrant using an additional thread.
  • ctx (Optional[DeviceContext]): Optional CPU DeviceContext to execute the work on.