IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /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. /get-started.md).

Mojo function

sync_parallelize

def sync_parallelize[FuncType: def(Int) raises -> None](func: FuncType, num_work_items: Int, ctx: Optional[DeviceContextBase[CompilationTarget()]] = None)

Executes func(0) ... func(num_work_items-1) as parallel sub-tasks, and returns when all are complete.

Non-raising closures still bind this signature. Exceptions raised by func abort rather than propagating to the caller.

Parameters:

  • ​FuncType (def(Int) raises -> None): The body function type.

Args:

Was this page helpful?