Skip to content

Commit f083c26

Browse files
committed
test: just rocr visible devices
Signed-off-by: vsoch <[email protected]>
1 parent 727ee64 commit f083c26

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

fluxbind/scripts/run_mapping.sh

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,15 @@ fi
4040
BIND_LOCATION="${BIND_INFO%;*}"
4141
CUDA_DEVICES="${BIND_INFO#*;}"
4242

43+
# check for nvidia-smi vs. rocm-smi command
4344
if [[ "$CUDA_DEVICES" != "NONE" ]]; then
44-
export CUDA_VISIBLE_DEVICES=$CUDA_DEVICES
45-
export ROCR_VISIBLE_DEVICES=$CUDA_DEVICES
46-
export HIP_VISIBLE_DEVICES=$CUDA_DEVICES
45+
if command -v nvidia-smi &> /dev/null && nvidia-smi -L &> /dev/null; then
46+
export CUDA_VISIBLE_DEVICES="$CUDA_DEVICES"
47+
elif command -v rocm-smi &> /dev/null && rocm-smi &> /dev/null; then
48+
export ROCR_VISIBLE_DEVICES="$CUDA_DEVICES"
49+
else
50+
echo "Warning: GPU binding requested, but neither nvidia-smi nor rocm-smi found. GPU assignment may not work." >&2
51+
fi
4752
fi
4853

4954
if [[ "${BIND_LOCATION}" == "UNBOUND" ]]; then
@@ -87,8 +92,11 @@ if [[ "$FLUXBIND_QUIET" != "1" ]]
8792
echo -e "${prefix}: Effective Cpuset Mask: ${CYAN}$cpuset_mask${RESET}"
8893
echo -e "${prefix}: Logical CPUs (PUs): ${BLUE}${logical_cpu_list:-none}${RESET}"
8994
echo -e "${prefix}: Physical Cores: ${ORANGE}${physical_core_list:-none}${RESET}"
90-
if [[ "$CUDA_DEVICES" != "NONE" ]]; then
91-
echo -e "${prefix}: CUDA Devices: ${YELLOW}${CUDA_DEVICES}${RESET}"
95+
if [[ ! -z "$CUDA_VISIBLE_DEVICES" ]]; then
96+
echo -e "${prefix}: CUDA Devices: ${YELLOW}${CUDA_VISIBLE_DEVICES}${RESET}"
97+
fi
98+
if [[ ! -z "$ROCR_VISIBLE_DEVICES" ]]; then
99+
echo -e "${prefix}: ROCR Devices: ${YELLOW}${ROCR_VISIBLE_DEVICES}${RESET}"
92100
fi
93101
echo
94102
fi

0 commit comments

Comments
 (0)