Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pyspark] Enable running GPU tests on variable number of GPUs. (#8335)
- Loading branch information
1 parent
4633b47
commit 748d516
Showing
2 changed files
with
30 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
#!/bin/bash | ||
|
||
echo "{\"name\":\"gpu\",\"addresses\":[\"0\",\"1\",\"2\",\"3\"]}" | ||
# This script is only made for running XGBoost tests on official CI where we have access | ||
# to a 4-GPU cluster, the discovery command is for running tests on a local machine where | ||
# the driver and the GPU worker might be the same machine for the ease of development. | ||
|
||
if ! command -v nvidia-smi &> /dev/null | ||
then | ||
# default to 4 GPUs | ||
echo "{\"name\":\"gpu\",\"addresses\":[\"0\",\"1\",\"2\",\"3\"]}" | ||
exit | ||
else | ||
# https://github.com/apache/spark/blob/master/examples/src/main/scripts/getGpusResources.sh | ||
ADDRS=`nvidia-smi --query-gpu=index --format=csv,noheader | sed -e ':a' -e 'N' -e'$!ba' -e 's/\n/","/g'` | ||
echo {\"name\": \"gpu\", \"addresses\":[\"$ADDRS\"]} | ||
fi |
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