-
Notifications
You must be signed in to change notification settings - Fork 360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: give kinda helpful message if too many open files #1110
Open
leondz
wants to merge
8
commits into
NVIDIA:main
Choose a base branch
from
leondz:update/large_parallel_exception_handling
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+68
−23
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f5f5de6
give kinda helpful message if too many open files
leondz 49ce62d
also give advice for parallel_requests too high
leondz 2289c9a
cap worker pool size to the volume of work requested
leondz 354566a
get the error message right
leondz 98a7454
add configurable cap on max # of workers to spawn
leondz e5efe41
also cap pool sizes with max_workers
leondz 06ecb96
reduce max_workers to something well below default soft ulimit
leondz f728007
document max_workers
leondz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
|
||
from garak import _config | ||
from garak.configurable import Configurable | ||
from garak.exception import GarakException | ||
import garak.resources.theme | ||
|
||
|
||
|
@@ -162,13 +163,27 @@ def generate( | |
) | ||
multi_generator_bar.set_description(self.fullname[:55]) | ||
|
||
with Pool(_config.system.parallel_requests) as pool: | ||
for result in pool.imap_unordered( | ||
self._call_model, [prompt] * generations_this_call | ||
): | ||
self._verify_model_result(result) | ||
outputs.append(result[0]) | ||
multi_generator_bar.update(1) | ||
pool_size = min( | ||
generations_this_call, | ||
_config.system.parallel_requests, | ||
_config.system.max_workers, | ||
) | ||
Comment on lines
+166
to
+170
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Direct access to config here suggest we should have a helper that owns process or thread pools that references |
||
|
||
try: | ||
with Pool(pool_size) as pool: | ||
for result in pool.imap_unordered( | ||
self._call_model, [prompt] * generations_this_call | ||
): | ||
self._verify_model_result(result) | ||
outputs.append(result[0]) | ||
multi_generator_bar.update(1) | ||
except OSError as o: | ||
if o.errno == 24: | ||
msg = "Parallelisation limit hit. Try reducing parallel_requests or raising limit (e.g. ulimit -n 4096)" | ||
logging.critical(msg) | ||
raise GarakException(msg) from o | ||
else: | ||
raise (o) | ||
|
||
else: | ||
generation_iterator = tqdm.tqdm( | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ system: | |
lite: true | ||
show_z: false | ||
enable_experimental: false | ||
max_workers: 500 | ||
|
||
run: | ||
seed: | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing show this is not really configurable as
_config
has not yet loadedgarak.site.yaml
and also has not loaded--config
supplied file if passed on cli.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch, thanks, will amend and I guess write a test for
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess, without undue gymnastics, we can either:
garak.cli
isn't universal, but otohargparse
only applies within this module; top-level values ingarak._config
is the opposite of the direction we're trying to move in)max_workers
validation but let the config-based one be enforcedHaving params that are only configurable in
garak.core.yaml
isn't a good optionwdyt? are there other options that make sense? currently leaning toward (2)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just do the cli provided validation call after config is loaded and before starting to instantiate things say around here?
garak/garak/cli.py
Lines 369 to 371 in 27d4554