> For the complete documentation index, see [llms.txt](https://parallel-ai.gitbook.io/parallel-ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://parallel-ai.gitbook.io/parallel-ai/technology/automatic-parallelization.md).

# Automatic Parallelization

Once the existing sequential code has been analyzed and opportunities for parallelization have been identified, Parallel AI employs its core feature: automatic parallelization. This again follows a 3 stage process:

**Phase 1 - Task Identification:** The system identifies independent tasks within the code that can be executed in parallel. This is based on the absence of data dependencies that would otherwise require tasks to be performed in a specific sequence.

**Phase 2 - Code Transformation:** Parallel AI transforms these independent tasks into a format that can be executed across multiple processing units. This transformation involves converting standard loops and operations into parallel constructs, such as parallel loops or concurrent function calls.

**Phase 3 - Algorithmic Optimization:** Advanced optimization algorithms refine the transformed code to maximize efficiency. This includes optimizing memory usage, minimizing communication overhead between processing units, and balancing load across the available hardware resources.

Now that the code has been transformed into the optimal form for parallel processing it is executed using Parallel AI’s proprietary execution model.

<br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://parallel-ai.gitbook.io/parallel-ai/technology/automatic-parallelization.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
