Skip to content

Commit

Permalink
Make sure compiler command lines are most similar
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Marr <[email protected]>
  • Loading branch information
smarr committed Jan 13, 2024
1 parent bc35dce commit 3f7d13e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions benchmarks/C++/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@ fi

if [[ $CMD == *"clang"* ]]; then
COMPILER_NAME="clang"
WARNINGS="-Wall -Wextra -Wno-unused-private-field"
else
# we assume gcc
COMPILER_NAME="gcc"
WARNINGS="-Wall -Wextra"
fi
COMP_OPT="-march=native -ffp-contract=off -std=c++17"

echo "Using compiler type: $CXX"

SRC='src/harness.cpp src/deltablue.cpp src/memory/object_tracker.cpp src/richards.cpp'

Expand Down Expand Up @@ -107,7 +112,7 @@ then
ORG_OPT="$OPT"

OPT="$ORG_OPT -fprofile-generate"
$CXX -Wall -Wextra -Wno-unused-private-field $SANATIZE $OPT -ffp-contract=off -std=c++17 $SRC -o harness-$CXX
$CXX $WARNINGS $SANATIZE $OPT $COMP_OPT $SRC -o harness-$CXX

for b in "${BENCHMARKS[@]}"; do
LLVM_PROFILE_FILE="prof-%p.profraw" ./harness-$CXX $b
Expand All @@ -120,7 +125,7 @@ then
OPT="$ORG_OPT -fprofile-use"
fi

$CXX -Wall -Wextra -Wno-unused-private-field -march=native $SANATIZE $OPT -ffp-contract=off -std=c++17 $SRC -o harness-$CXX
$CXX $WARNINGS $SANATIZE $OPT $COMP_OPT $SRC -o harness-$CXX
EXIT_CODE=$?
rm *.profraw prof.profdata
exit $EXIT_CODE
Expand All @@ -129,4 +134,4 @@ else
SANATIZE=''
fi

exec $CXX -Wall -Wextra -Wno-unused-private-field -march=native $SANATIZE $OPT -ffp-contract=off -std=c++17 $SRC -o harness-$CXX
exec $CXX $WARNINGS $SANATIZE $OPT $COMP_OPT $SRC -o harness-$CXX

0 comments on commit 3f7d13e

Please sign in to comment.