Skip to content

Commit ded42a6

Browse files
authored
Merge pull request #98 from leonardchan/tpu7x-auto
Add --numactl_bind flag to H2D benchmark script
2 parents 5dd6f85 + 21c6940 commit ded42a6

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

Ironwood/scripts/run_host_device_benchmark.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
CONFIG_DIR="Ironwood/configs/host_device"
55
SPECIFIC_CONFIG=""
66
INTERLEAVED=false
7+
NUMACTL_BIND=false
78

89
# Helper function for usage
910
usage() {
1011
echo "Usage: $0 [OPTIONS]"
1112
echo "Options:"
1213
echo " --config <path> Path to specific config file (optional)"
1314
echo " --interleaved Run with numactl --interleave=all"
15+
echo " --numactl_bind Run with numactl --cpunodebind=0 --membind=0"
1416
echo " --help Show this help message"
1517
exit 1
1618
}
@@ -20,6 +22,7 @@ while [[ "$#" -gt 0 ]]; do
2022
case $1 in
2123
--config) SPECIFIC_CONFIG="$2"; shift ;;
2224
--interleaved) INTERLEAVED=true ;;
25+
--numactl_bind) NUMACTL_BIND=true ;;
2326
--help) usage ;;
2427
*) echo "Unknown parameter passed: $1"; usage ;;
2528
esac
@@ -33,6 +36,7 @@ echo "********************************************************"
3336
echo ""
3437
echo "Configuration:"
3538
echo " Interleaved: $INTERLEAVED"
39+
echo " numactl Bound: $NUMACTL_BIND"
3640
echo ""
3741

3842
if [ -n "$SPECIFIC_CONFIG" ]; then
@@ -44,6 +48,11 @@ else
4448
shopt -u nullglob
4549
fi
4650

51+
if [[ "$INTERLEAVED" = true && "$NUMACTL_BIND" = true ]]; then
52+
echo "Only one of --interleaved and --numactl_bind is allowed to be set at once."
53+
exit 1
54+
fi
55+
4756
if [ ${#CONFIGS[@]} -eq 0 ]; then
4857
echo "No configuration files found!"
4958
exit 1
@@ -61,6 +70,14 @@ for CONFIG_FILE in "${CONFIGS[@]}"; do
6170
echo "Warning: numactl not found. Running without interleaving."
6271
$CMD
6372
fi
73+
elif [ "$NUMACTL_BIND" = true ]; then
74+
if command -v numactl &> /dev/null; then
75+
echo "Running with numactl --cpunodebind=0 --membind=0"
76+
numactl --cpunodebind=0 --membind=0 $CMD
77+
else
78+
echo "Warning: numactl not found. Running without binding."
79+
$CMD
80+
fi
6481
else
6582
$CMD
6683
fi

0 commit comments

Comments
 (0)