Skip to content

Commit c3e0a74

Browse files
committed
output to CSV folder; change SHARD to start from 1
1 parent 700a94f commit c3e0a74

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

benchmarks/run_input_shard.sh

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,31 @@
44

55
# Capture timestamp once for consistent filename
66
TIMESTAMP=$(date +%s)
7-
OUTPUT_FILE="benchmarks_autotune_${TIMESTAMP}_input_shard_$((SHARD+1))_of_${WORLD_SIZE}.txt"
7+
OUTPUT_FILE="benchmarks_autotune_${TIMESTAMP}_input_shard_${SHARD}_of_${WORLD_SIZE}.txt"
8+
CSV_OUTPUT_DIR="benchmarks_autotune_${TIMESTAMP}_input_shard_${SHARD}_of_${WORLD_SIZE}_csv"
89

910
# Retry until success
1011
attempt=0
1112
while true; do
1213
# while (( attempt < 10 )); do
1314
attempt=$((attempt + 1))
14-
echo "Attempt $attempt: Running benchmark for shard $((SHARD+1))/${WORLD_SIZE}..."
15+
echo "Attempt $attempt: Running benchmark for shard ${SHARD}/${WORLD_SIZE}..."
1516

1617
# TIMESTAMP=$(date +%s)
17-
# OUTPUT_FILE="benchmarks_autotune_${TIMESTAMP}_input_shard_$((SHARD+1))_of_${WORLD_SIZE}.txt"
18+
# OUTPUT_FILE="benchmarks_autotune_${TIMESTAMP}_input_shard_${SHARD}_of_${WORLD_SIZE}.txt"
1819

19-
CUDA_VISIBLE_DEVICES=$((RANK_OFFSET+SHARD)) python benchmarks/run.py --input-shard $((SHARD+1))/${WORLD_SIZE} --metrics accuracy,tflops,gbps,speedup >"$OUTPUT_FILE" 2>&1
20+
mkdir -p ${CSV_OUTPUT_DIR} || true
21+
CUDA_VISIBLE_DEVICES=$((RANK_OFFSET+SHARD-1)) python benchmarks/run.py --input-shard ${SHARD}/${WORLD_SIZE} --metrics accuracy,tflops,gbps,speedup --csv --output-dir ${CSV_OUTPUT_DIR} >"$OUTPUT_FILE" 2>&1
2022

2123
exit_code=$?
2224
if [ $exit_code -eq 0 ]; then
23-
echo "Success! Benchmark completed for shard $((SHARD+1))/${WORLD_SIZE}"
25+
echo "Success! Benchmark completed for shard ${SHARD}/${WORLD_SIZE}"
2426
break
2527
else
2628
echo "Failed with exit code $exit_code. Retrying..."
2729
sleep 10 # wait a few seconds before retrying
2830
fi
2931
done
3032

31-
# SHARD=0 RANK_OFFSET=4 WORLD_SIZE=4 bash benchmarks/run_input_shard.sh
33+
# Runs the 1st shard of input on GPU-0:
34+
# SHARD=1 RANK_OFFSET=4 WORLD_SIZE=4 bash benchmarks/run_input_shard.sh

0 commit comments

Comments
 (0)