test: fix
This commit is contained in:
parent
c4fcb9689b
commit
6122d9b04d
|
@ -11,39 +11,6 @@ chip_id_arr_from_info=(0 1 0 1 0 1 0 1)
|
|||
npu_id_arr_from_info=(2 2 3 3 5 5 6 6)
|
||||
npu_id_arr=(2 3 5 6)
|
||||
|
||||
loop_cnt=0
|
||||
|
||||
while true; do
|
||||
device_mem_usage=""
|
||||
for ((i=0; i<device_cnt; i++)); do
|
||||
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}}, "
|
||||
done
|
||||
device_mem_usage="${device_mem_usage%??}"
|
||||
|
||||
npu_power_dissipation=""
|
||||
for npu_id in "${npu_id_arr[@]}"; do
|
||||
power_dissipation=$(get_power_dissipation ${npu_id})
|
||||
npu_power_dissipation="${npu_power_dissipation}{"npu_id": ${npu_id}, "power_dissipation": ${power_dissipation}}, "
|
||||
done
|
||||
npu_power_dissipation="${npu_power_dissipation%??}"
|
||||
|
||||
cur_time=$(date +"%Y-%m-%d %H:%M:%S")
|
||||
|
||||
json="{\"cur_time\": \"${cur_time}\", \"npu_power_dissipation\": [${npu_power_dissipation}], \"device_mem_usage\": [${device_mem_usage}]}"
|
||||
echo "$json" >> output_file_path
|
||||
sleep sleep_time
|
||||
|
||||
if [ "$print_to_screen" -eq "1" ]; then
|
||||
echo "$json"
|
||||
fi
|
||||
|
||||
loop_cnt+=1
|
||||
if [ "$loop_cnt" -eq "1500" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
get_power_dissipation() {
|
||||
local npu_id="$1"
|
||||
|
@ -57,4 +24,39 @@ get_mem_usage() {
|
|||
local device="$2"
|
||||
mem_usage=$(npu-smi info | grep '${chip} ${device}' | awk '{print $8}')
|
||||
echo "${mem_usage}"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
loop_cnt=0
|
||||
|
||||
while true; do
|
||||
device_mem_usage=""
|
||||
for ((i=0; i<device_cnt; i++)); do
|
||||
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}}, "
|
||||
done
|
||||
device_mem_usage="${device_mem_usage%??}"
|
||||
|
||||
npu_power_dissipation=""
|
||||
for npu_id in "${npu_id_arr[@]}"; do
|
||||
power_dissipation="get_power_dissipation ${npu_id}"
|
||||
npu_power_dissipation="${npu_power_dissipation}{"npu_id": ${npu_id}, "power_dissipation": ${power_dissipation}}, "
|
||||
done
|
||||
npu_power_dissipation="${npu_power_dissipation%??}"
|
||||
|
||||
cur_time=$(date +"%Y-%m-%d %H:%M:%S")
|
||||
|
||||
json="{\"cur_time\": \"${cur_time}\", \"npu_power_dissipation\": [${npu_power_dissipation}], \"device_mem_usage\": [${device_mem_usage}]}"
|
||||
echo "$json" >> output_file_path
|
||||
sleep "${sleep_time}"
|
||||
|
||||
if [ "$print_to_screen" -eq "1" ]; then
|
||||
echo "$json"
|
||||
fi
|
||||
|
||||
loop_cnt+=1
|
||||
if [ "$loop_cnt" -eq "1500" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue