-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
08a8659
commit ca841a7
Showing
4 changed files
with
77 additions
and
79 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
# Check if the variable is set | ||
if [ -z "$ROCR_VISIBLE_DEVICES" ]; then | ||
echo "Environment variable ROCR_VISIBLE_DEVICES is not set" | ||
exit 1 | ||
fi | ||
|
||
# Get the list of renderDxxx devices in /dev/dri | ||
ROCM_RENDER_DEVICES=($(ls /dev/dri/renderD*)) | ||
|
||
# Split the ROCR_VISIBLE_DEVICES variable by commas to get individual device indices | ||
IFS=',' read -r -a DEVICE_INDICES <<<"$ROCR_VISIBLE_DEVICES" | ||
|
||
# Construct the --device options for Docker | ||
ROCM_DOCKER_DEVICES="--device /dev/kfd" | ||
for INDEX in "${DEVICE_INDICES[@]}"; do | ||
if [ "$INDEX" -lt "${#ROCM_RENDER_DEVICES[@]}" ]; then | ||
ROCM_DOCKER_DEVICES+=" --device ${ROCM_RENDER_DEVICES[$INDEX]}" | ||
else | ||
echo "Index $INDEX is out of range for available render devices" | ||
exit 1 | ||
fi | ||
done | ||
|
||
# export the ROCM_DOCKER_DEVICES variable | ||
export ROCM_DOCKER_DEVICES |