-
Notifications
You must be signed in to change notification settings - Fork 117
[test] Add nvidia-smi check #1861
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b1e922b
Add flexible nvidia-smi check
victorusu 76f3c3c
Merge branch 'master' into nvidia_smi
60f82fe
Modernize and simplify the test
1f26d31
Make the test not flexible
victorusu 16b7dc8
Address PR comments
vkarak 561efc9
Merge branch 'master' into nvidia_smi
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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # Copyright 2016-2021 Swiss National Supercomputing Centre (CSCS/ETH Zurich) | ||
| # ReFrame Project Developers. See the top-level LICENSE file for details. | ||
| # | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
|
|
||
| import reframe as rfm | ||
| import reframe.utility.sanity as sn | ||
| import reframe.utility.typecheck as typ | ||
|
|
||
|
|
||
| @rfm.simple_test | ||
| class nvidia_smi_check(rfm.RunOnlyRegressionTest): | ||
| gpu_mode = parameter(['accounting', 'compute', 'ecc']) | ||
| valid_systems = ['daint:gpu', 'dom:gpu'] | ||
| valid_prog_environs = ['builtin'] | ||
| executable = 'nvidia-smi' | ||
| executable_opts = ['-a', '-d'] | ||
| num_tasks = 1 | ||
| num_tasks_per_node = 1 | ||
| exclusive = True | ||
| tags = {'maintenance', 'production'} | ||
| maintainers = ['VH'] | ||
| mode_values = variable(typ.Dict[str, str], value={ | ||
| 'accounting': 'Enabled', | ||
| 'compute': 'Exclusive_Process', | ||
| 'ecc': 'Enabled' | ||
| }) | ||
|
|
||
| @rfm.run_before('run') | ||
| def set_display_opt(self): | ||
| self.executable_opts.append(self.gpu_mode.upper()) | ||
|
|
||
| @rfm.run_before('sanity') | ||
| def set_sanity(self): | ||
| modeval = self.mode_values[self.gpu_mode] | ||
| if self.gpu_mode == 'ecc': | ||
| patt = rf'Current\s+: {modeval}' | ||
| else: | ||
| patt = rf'{self.gpu_mode.capitalize()} Mode\s+: {modeval}' | ||
|
|
||
| num_gpus_detected = sn.count(sn.findall(patt, self.stdout)) | ||
| num_gpus_all = self.num_tasks | ||
|
|
||
| # We can't an use f-string here, because it will misinterpret the | ||
| # placeholders for the sanity function message | ||
| errmsg = ('{0} out of {1} GPU(s) have the correct %s mode' % | ||
| self.gpu_mode) | ||
| self.sanity_patterns = sn.assert_eq( | ||
| num_gpus_detected, num_gpus_all, errmsg | ||
| ) | ||
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.
Uh oh!
There was an error while loading. Please reload this page.