mirror of https://github.com/hpcaitech/ColossalAI
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.1 KiB
34 lines
1.1 KiB
1 year ago
|
ROOT=$(realpath $(dirname $0))
|
||
9 months ago
|
echo $ROOT
|
||
1 year ago
|
PY_SCRIPT=${ROOT}/benchmark_llama.py
|
||
|
GPU=$(nvidia-smi -L | head -1 | cut -d' ' -f4 | cut -d'-' -f1)
|
||
8 months ago
|
mode=$1
|
||
1 year ago
|
|
||
1 year ago
|
mkdir -p logs
|
||
1 year ago
|
|
||
10 months ago
|
CUDA_VISIBLE_DEVICES_set_n_least_memory_usage() {
|
||
|
local n=${1:-"9999"}
|
||
|
echo "GPU Memory Usage:"
|
||
|
local FIRST_N_GPU_IDS=$(nvidia-smi --query-gpu=memory.used --format=csv \
|
||
|
| tail -n +2 \
|
||
|
| nl -v 0 \
|
||
|
| tee /dev/tty \
|
||
|
| sort -g -k 2 \
|
||
|
| awk '{print $1}' \
|
||
|
| head -n $n)
|
||
|
export CUDA_VISIBLE_DEVICES=$(echo $FIRST_N_GPU_IDS | sed 's/ /,/g')
|
||
|
echo "Now CUDA_VISIBLE_DEVICES is set to:"
|
||
|
echo "CUDA_VISIBLE_DEVICES=$CUDA_VISIBLE_DEVICES"
|
||
|
}
|
||
|
|
||
|
CUDA_VISIBLE_DEVICES_set_n_least_memory_usage 1
|
||
|
|
||
1 year ago
|
# benchmark llama2-7b one single GPU
|
||
9 months ago
|
for input_len in 128 512 1024; do
|
||
10 months ago
|
for output_len in 128 256; do
|
||
|
for bsz in 16 32 64; do
|
||
7 months ago
|
python3 ${PY_SCRIPT} -m llama2-7b --tp_size 1 -b ${bsz} -s ${input_len} --output_len ${output_len} --mode ${mode} --test_random_weight | tee logs/${bsz}_${input_len}_${output_len}_${mode}_${GPU}.txt
|
||
10 months ago
|
done
|
||
|
done
|
||
1 year ago
|
done
|