Skip to content

Commit

Permalink
set parallel_job according to CUDA memory in Windows CI unittest (#44695
Browse files Browse the repository at this point in the history
)

* set parallel_job according to CUDA memory

* fix bug: add whitespace between conten and [] or condition wont work
  • Loading branch information
betterpig committed Aug 1, 2022
1 parent ffb3154 commit c28bb98
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tools/windows/run_unittests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,13 @@ function run_unittest_gpu() {
if [ "$2" == "" ]; then
parallel_job=$parallel_level_base
else
parallel_job=`expr $2 \* $parallel_level_base`
# set parallel_job according to CUDA memory and suggested parallel num,
# the latter is derived in linux server with 16G CUDA memory.
cuda_memory=$(nvidia-smi --query-gpu=memory.total --format=csv | tail -1 | awk -F ' ' '{print $1}')
parallel_job=$(($2 * $cuda_memory / 16000))
if [ $parallel_job -lt 1 ]; then
parallel_job=1
fi
fi
echo "************************************************************************"
echo "********These unittests run $parallel_job job each time with 1 GPU**********"
Expand Down

0 comments on commit c28bb98

Please sign in to comment.