Parallel execution of multiple unrelated statements written sequentially #78507
Labels
enhancement
Not as big of a feature, but technically not a bug. Should be easy to fix
triaged
This issue has been looked at a team member, and triaged and prioritized into an appropriate module
馃殌 The feature, motivation and pitch
Often, I write statements in a sequential manner that do not relate to each other - the order of their execution does not matter. Such statements can be parallelized to achieve better performance. One example: resize three different images using nearest, bilinear, and bicubic:
Old method:
New method:
Of course, the implementation mentioned above is just an example. The core idea is to take a list of functions (same or different), and their respective arguments. These functions are then executed in parallel using the new API function.
Alternatives
Currently, the functionality can be implemented using vmap or python multiprocessing. However, each of these requires a lot of additional code and has a lot of added complexity. If we assume that every line to be executed in parallel is independent and all arguments are immutable, I believe the lines can easily be run in parallel on GPU.
Additional context
No response
cc @ngimel @bdhirsh
The text was updated successfully, but these errors were encountered: