Skip to content

Commit

Permalink
Bash cpuflags (#109)
Browse files Browse the repository at this point in the history
* added bash-only script to detect cpuid flags based on g++ and/or clang

* wip bash script

* unified arch detection

* wip arch detection

* dynamic executable detection

* removed old regex

* added lscpu detection as first-choice

* Updated install_tsl.sh

---------

Co-authored-by: Alexander Krause <[email protected]>
  • Loading branch information
JPietrzykTUD and alexKrauseTUD authored Sep 4, 2024
1 parent 0d2c81d commit e9922f6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/install_tsl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@ WORK_DIR=$(pwd)


curl -L "https://github.com/db-tu-dresden/TSL/releases/latest/download/tsl.tar.gz" -o ${TMP_DIR}/tsl.tar.gz
LSCPU_FLAGS_STRING=$(LANG=en;lscpu | grep 'Flags:' | sed -E 's/Flags:\s*//g' | sed -E 's/\s/:/g')
curl -L "https://github.com/db-tu-dresden/TSL/releases/latest/download/detect_flags.sh" -o ${TMP_DIR}/detect_flags.sh
chmod +x ${TMP_DIR}/detect_flags.sh

#create array from flags string
AVAIL_FLAGS=(${LSCPU_FLAGS_STRING//:/ })
# AVAIL_FLAGS=($(${TMP_DIR}/detect_flags.sh))
IFS=' ' read -r -a AVAIL_FLAGS <<< "$(${TMP_DIR}/detect_flags.sh)"
unset IFS


#unpack tsl.conf
tar -xf ${TMP_DIR}/tsl.tar.gz -C ${TMP_DIR} ${TAR_PREFIX_TSL_DIR}/tsl.conf

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release-tsl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ jobs:
files: |
${{ github.workspace }}/tsl.tar.gz
${{ github.workspace }}/.github/workflows/install_tsl.sh
${{ github.workspace }}/detect_flags.sh
${{ github.workspace }}/${{ steps.rpm.outputs.out }}/${{ steps.rpm.outputs.name}}
${{ github.workspace }}/${{ steps.deb.outputs.out }}/${{ steps.deb.outputs.name}}
tag_name: ${{ inputs.tag-name }}
2 changes: 1 addition & 1 deletion detect_flags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function parse_flags {
fi
}

lscpu_exe=$(which lscpu)
lscpu_exe=$(which lscpu 2>/dev/null)
if [[ ! -z ${lscpu_exe} && -f $lscpu_exe && -x $lscpu_exe ]]; then
flags=$(eval LANG=en;lscpu|grep -i flags | tr ' ' '\n' | grep -v -E '^Flags:|^$' | sort -d | tr '\n' ' ')
echo "$flags"
Expand Down

0 comments on commit e9922f6

Please sign in to comment.