Skip to content

Commit 96f1316

Browse files
authored
test-jax.sh: handle integrated devices (#1691)
The old logic choked because these do not report a GPU memory size.
1 parent 0536c02 commit 96f1316

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

.github/container/test-jax.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,15 @@ fi
119119

120120
readarray -t GPU_MEMORIES < <(nvidia-smi --query-gpu=memory.total --format=csv,noheader)
121121
NGPUS="${#GPU_MEMORIES[@]}"
122-
GPU_MEMORIES_MIB=("${GPU_MEMORIES[@]/ MiB/}")
122+
if [[ " ${GPU_MEMORIES[*]} " =~ [[:space:]]\[N/A\][[:space:]] ]]; then
123+
# On iGPU devices, nvidia-smi reports [N/A] GPU memory; use the system
124+
# memory size instead to estimate what each GPU can use
125+
SYSTEM_MEMORY_MIB=$(grep MemTotal /proc/meminfo | awk '{print $2 / 1024}')
126+
declare -a GPU_MEMORIES_MIB
127+
for (( i = 0; i < NGPUS; i++ )); do GPU_MEMORIES_MIB+=($(( SYSTEM_MEMORY_MIB / NGPUS ))); done
128+
else
129+
GPU_MEMORIES_MIB=("${GPU_MEMORIES[@]/ MiB/}")
130+
fi
123131

124132
FLAGS=()
125133

0 commit comments

Comments
 (0)