-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
No bug: Basic sanity tests for sonar GPU logic
- Loading branch information
Lars T Hansen
committed
Dec 12, 2024
1 parent
fb7b203
commit 9db5716
Showing
3 changed files
with
55 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Check that `sonar sysinfo` can detect an AMD GPU if it ought to (based on info from the file | ||
# system). This test must be run on a node with such a device to have any effect, hence will not be | ||
# effective in the github runner. | ||
# | ||
# Requirement: the `jq` utility. | ||
|
||
set -e | ||
if [[ ! -e /sys/module/amdgpu ]]; then | ||
echo "No device" | ||
exit 0 | ||
fi | ||
|
||
( cd .. ; cargo build ) | ||
output=$(../target/debug/sonar sysinfo) | ||
numcards=$(jq .gpu_cards <<< $output) | ||
if [[ ! ( $numcards =~ ^[0-9]+$ ) ]]; then | ||
echo "Bad output from jq: <$numcards>" | ||
exit 1 | ||
fi | ||
if (( $numcards == 0 )); then | ||
echo "Number of cards should be nonzero" | ||
exit 1 | ||
fi | ||
echo "OK" |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Check that `sonar sysinfo` can detect an NVIDIA GPU if it ought to (based on info from the file | ||
# system). This test must be run on a node with such a device to have any effect, hence will not be | ||
# effective in the github runner. | ||
# | ||
# Requirement: the `jq` utility. | ||
|
||
set -e | ||
if [[ ! -e /sys/module/nvidia ]]; then | ||
echo "No device" | ||
exit 0 | ||
fi | ||
|
||
( cd .. ; cargo build ) | ||
output=$(../target/debug/sonar sysinfo) | ||
numcards=$(jq .gpu_cards <<< $output) | ||
if [[ ! ( $numcards =~ ^[0-9]+$ ) ]]; then | ||
echo "Bad output from jq: <$numcards>" | ||
exit 1 | ||
fi | ||
if (( $numcards == 0 )); then | ||
echo "Number of cards should be nonzero" | ||
exit 1 | ||
fi | ||
echo "OK" |
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