Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update configure.sh #23

Open
wants to merge 1 commit into
base: Verus2.2
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 34 additions & 3 deletions configure.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,37 @@
# To change the cuda arch, edit Makefile.am and run ./build.sh
#!/bin/bash

extracflags="-march=native -D_REENTRANT -falign-functions=16 -falign-jumps=16 -falign-labels=16"
# Get CPU information
arch=$(lscpu | awk '/Architecture:/ { print $2 }')
model_name=$(lscpu | awk -F ': +' '/Model name:/ { print $2 }')

./configure CXXFLAGS="-O2 $extracflags"
# Common compiler flags
common_flags="-O3 -ffinite-loops -ffast-math -D_REENTRANT -finline-functions -falign-functions=16 -fomit-frame-pointer -fpic -pthread -flto -fuse-ld=lld -fno-stack-protector"

# Set architecture-specific flags
if [[ "$arch" == "aarch64" ]]; then
if [[ "$model_name" == *"Cortex-A53"* ]]; then
cpu_flags="-march=armv8-a+crypto -mtune=cortex-a53 -mfix-cortex-a53-835769"
elif [[ "$model_name" == *"Cortex-A73"* ]]; then
cpu_flags="-march=armv8-a+crypto -mtune=cortex-a73"
else
# Default to ARMv8-A architecture (Cortex-A53) if unknown
echo "Unknown or unsupported model: $model_name. Defaulting to ARMv8-A."
cpu_flags="-march=armv8-a+crypto -mtune=cortex-a53"
fi
else
# Default to ARMv8-A architecture (Cortex-A53) if unknown architecture
echo "Unknown or unsupported architecture: $arch. Defaulting to Native Tuning."
cpu_flags="-mtune=native"
fi

# Set vectorization flags
vectorization_flags="-Rpass-missed=loop-vectorize -Rpass-analysis=loop-vectorize -Wl"

# Combine all flags
all_flags="$common_flags $cpu_flags $vectorization_flags"

# Configure and build
./configure --target=aarch64-linux-gnu --host=x86_64-linux-gnu --build=x86_64-linux-gnu \
CXXFLAGS="-Wl,-hugetlbfs-align -funroll-loops -finline-functions $all_flags" \
            CFLAGS="-Wl,-hugetlbfs-align -finline-functions $all_flags" \
            CXX=clang++ CC=clang LDFLAGS="-v -flto -Wl,-hugetlbfs-align"