#!/bin/bashn=$(nvidia-smi -q -d Memory|grep -A4 GPU|grep Free |grep -Eo "[0-9]+"|awk '{{printf"%s,",$0}}') OLD_IFS="$IFS"IFS=","n_list=($n) IFS="$OLD_IFS"max=${n_list[0]}max_id=0for var in ${!n_list[@]}do if [[ ${max} -le ${n_list[$var]} ]];then max_id=${var} max=${n_list[${var}]} echo "gpu $max_id: $max MiB" fidoneecho "finally chose gpu $max_id, reamain memory $max MiB"# run your command#python main.py --gpu_id $max_id
请问这个问题有知道怎么解决的吗?使用的是TensorFlow 1.11,TensorFlow-gpu 1.11,cudnn7.6.5,gcc 4.9