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

parallelize_over_rows

def parallelize_over_rows[func: def(Int, Int) capturing thin -> 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 thin -> None): Function to call on range of rows.

Args:

def parallelize_over_rows[FuncType: def(Int, Int) -> 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) -> 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.

Was this page helpful?