Skip to content

Commit fb2f8d8

Browse files
committed
avoid $PWD
Signed-off-by: Harmen Stoppels <me@harmenstoppels.nl>
1 parent cf3a1fb commit fb2f8d8

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

benchmark/benchmark.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
#!/bin/sh
22

3-
export SPACK_COMPILER_WRAPPER_PATH="$PWD"
3+
SCRIPT_DIR=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)
4+
REPO_DIR=$(CDPATH='' cd -- "$SCRIPT_DIR/.." && pwd)
5+
CC_SH="$REPO_DIR/cc.sh"
6+
7+
if [ ! -f "$CC_SH" ]; then
8+
echo "Cannot find cc.sh at $CC_SH" >&2
9+
exit 1
10+
fi
11+
12+
export SPACK_COMPILER_WRAPPER_PATH="$SCRIPT_DIR"
413
export SPACK_DEBUG_LOG_DIR="/tmp"
514
export SPACK_DEBUG_LOG_ID="bench"
615
export SPACK_SHORT_SPEC="py-torch@2.11.0%gcc@14.2.0 arch=linux-ubuntu24.04-aarch64"
@@ -85,14 +94,14 @@ export SPACK_COMPILER_FLAGS_KEEP=""
8594
export SPACK_COMPILER_FLAGS_REPLACE=""
8695

8796
# Warmup
88-
./g++ -c foo.c -o foo.o
97+
"$SCRIPT_DIR/g++" -c foo.c -o foo.o
8998

9099
# Do a 1000 runs
91100
N=1000
92101
_start=$(date +%s)
93102
_i=0
94103
while [ $_i -lt $N ]; do
95-
./g++ -c foo.c -o foo.o
104+
"$SCRIPT_DIR/g++" -c foo.c -o foo.o
96105
_i=$((_i + 1))
97106
done
98107
_end=$(date +%s)

0 commit comments

Comments
 (0)