fix: fix bug

This commit is contained in:
wql 2024-09-11 11:10:19 +08:00
parent ab82c952f1
commit 0640628e46
1 changed files with 1 additions and 3 deletions

View File

@ -14,7 +14,6 @@ npu_id_arr=(2 3 5 6)
get_power_dissipation() { get_power_dissipation() {
local npu_id="$1" local npu_id="$1"
# need to varify
power_dissipation=$(npu-smi info -t power -i ${npu_id} | grep 'Power Dissipation(W)' | awk '{print $4}') power_dissipation=$(npu-smi info -t power -i ${npu_id} | grep 'Power Dissipation(W)' | awk '{print $4}')
echo "${power_dissipation}" echo "${power_dissipation}"
} }
@ -22,7 +21,7 @@ get_power_dissipation() {
get_mem_usage() { get_mem_usage() {
local chip="$1" local chip="$1"
local device="$2" local device="$2"
mem_usage=$(npu-smi info | grep '${chip} ${device}' | awk '{print $8}') mem_usage=$(npu-smi info | grep "${chip} ${device}" | awk '{print $8}')
echo "${mem_usage}" echo "${mem_usage}"
} }
@ -32,7 +31,6 @@ loop_cnt=0
while true; do while true; do
device_mem_usage="" device_mem_usage=""
for ((i=0; i<device_cnt; i++)); do for ((i=0; i<device_cnt; i++)); do
echo "get_mem_usage ${chip_id_arr_from_info[i]} ${i}"
mem_usage=$(get_mem_usage ${chip_id_arr_from_info[i]} ${i}) mem_usage=$(get_mem_usage ${chip_id_arr_from_info[i]} ${i})
device_mem_usage="${device_mem_usage}{"npu_id": ${npu_id_arr_from_info[i]}, "chip_id": ${chip_id_arr_from_info[i]}, "device_id": ${i}, "mem_usage": ${mem_usage}}, " device_mem_usage="${device_mem_usage}{"npu_id": ${npu_id_arr_from_info[i]}, "chip_id": ${chip_id_arr_from_info[i]}, "device_id": ${i}, "mem_usage": ${mem_usage}}, "
done done