-
Notifications
You must be signed in to change notification settings - Fork 895
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PromptFlow] Optimize memory computation (#1328)
# Description **Optimize memory computation** 1. Optimize the calculation logic of the maximum number of processes 2. Prioritize using the environment variable "PF_WORKER_COUNT" as the number of processes if users set. The following table summarizes the logic for determining the number of processes and corresponding log messages under different conditions (based on whether fork is used and the setting of the environment variable PF_WORKER_COUNT): <div style="overflow-x:auto;"> <table style="table-layout: auto;"> <tr> <th style="white-space: nowrap;">Scenario </th> <th style="white-space: nowrap;">Fork_Used </th> <th style="white-space: nowrap;">PF_WORKER_COUNT Set</th> <th style="white-space: nowrap;">Worker Count</th> <th style="white-space: nowrap;">NLines</th> <th style="white-space: nowrap;">Estimated Available Worker Count</th> <th style="white-space: nowrap;">Calculation of Processes</th> </tr> <tr> <td>1</td> <td>No(spawn)</td> <td>No</td> <td>16</td> <td>4</td> <td><strong>2</strong></td> <td>Min(16, 4, 2) = <strong>2</strong></td> </tr> <tr> <td colspan="8" style="white-space: normal;"> <strong style="font-size: larger;">Log Message:</strong><br> Set process count to <strong>2</strong> by taking the minimum value among the factors of {'default_worker_count': 16, 'row_count': 4, 'estimated_worker_count_based_on_memory_usage': 2}.</td> </tr> <tr> <td>2</td> <td>No(spawn)</td> <td>Yes (<strong>2</strong>)</td> <td>2</td> <td>4</td> <td>2</td> <td><strong>PF_WORKER_COUNT = 2</strong></td> </tr> <tr> <td colspan="8" style="white-space: normal;"> <strong style="font-size: larger;">Log Message:</strong><br> Set process count to <strong>2</strong> with the environment variable 'PF_WORKER_COUNT'. </td> </tr> <tr> <td>3</td> <td>No(spawn)</td> <td>Yes (<strong>6</strong>)</td> <td>6</td> <td>4</td> <td>2</td> <td><strong>PF_WORKER_COUNT = 6</strong></td> </tr> <tr> <td colspan="8" style="white-space: normal;"> <strong style="font-size: larger;">Log Message:</strong><br> Set process count to <strong>6</strong> with the environment variable 'PF_WORKER_COUNT'.<br> <strong style="font-size: larger;">Warning Message:</strong><br> The current process count (<strong>6</strong>) is larger than recommended process count (2) that estimated by system available memory. This may cause memory exhaustion.</td> </tr> <tr> <td>4</td> <td>Yes(fork)</td> <td>No</td> <td>16</td> <td><strong>4</strong></td> <td>N/A</td> <td>Min(16, 4) = <strong>4</strong></td> </tr> <tr> <td colspan="8" style="white-space: normal;"> <strong style="font-size: larger;">Log Message:</strong><br> Set process count to <strong>4</strong> by taking the minimum value among the factors of {'default_worker_count': 16, 'row_count': 4}.</td> </tr> <tr> <td>5</td> <td>Yes(fork)</td> <td>Yes (<strong>3</strong>)</td> <td>3</td> <td>4</td> <td>N/A</td> <td><strong>PF_WORKER_COUNT = 3</strong></td> </tr> <tr> <td colspan="8" style="white-space: normal;"> <strong style="font-size: larger;">Log Message:</strong><br> Set process count to <strong>3</strong> with the environment variable 'PF_WORKER_COUNT'.</td> </tr> </table> </div> # All Promptflow Contribution checklist: - [ ] **The pull request does not introduce [breaking changes].** - [ ] **CHANGELOG is updated for new features, bug fixes or other significant changes.** - [ ] **I have read the [contribution guidelines](../CONTRIBUTING.md).** - [ ] **Create an issue and link to the pull request to get dedicated review from promptflow team. Learn more: [suggested workflow](../CONTRIBUTING.md#suggested-workflow).** ## General Guidelines and Best Practices - [ ] Title of the pull request is clear and informative. - [ ] There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, [see this page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md). ### Testing Guidelines - [ ] Pull request includes test coverage for the included changes.
- Loading branch information
Showing
6 changed files
with
337 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.