Skip to content

Use compiler action #40

Use compiler action

Use compiler action #40

Workflow file for this run

name: Linux build
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash -l {0}
jobs:
build:
runs-on: ubuntu-latest
name: '${{ matrix.sys.compiler }} ${{ matrix.sys.version }} - ${{ matrix.sys.flags }}'
strategy:
matrix:
sys:
- { compiler: 'gcc', version: '12', flags: 'force_no_instr_set' }
- { compiler: 'gcc', version: '13', flags: 'default' }
- { compiler: 'gcc', version: '14', flags: 'avx' }
- { compiler: 'gcc', version: '13', flags: 'avx512' }
- { compiler: 'gcc', version: '13', flags: 'avx512pf' }
- { compiler: 'gcc', version: '13', flags: 'avx512vbmi' }
- { compiler: 'gcc', version: '14', flags: 'avx512vbmi2' }
- { compiler: 'gcc', version: '13', flags: 'avx512vnni' }
- { compiler: 'clang', version: '16', flags: 'force_no_instr_set' }
- { compiler: 'clang', version: '16', flags: 'default' }
- { compiler: 'clang', version: '17', flags: 'avx' }
- { compiler: 'clang', version: '17', flags: 'sse3' }
- { compiler: 'clang', version: '18', flags: 'avx512' }
steps:
- name: Setup compiler
uses: xtensor-stack/xsimd/.github/actions/setup-compiler-apt@main
with:
compiler: ${{ matrix.sys.compiler }}
version: ${{ matrix.sys.version }}
- name: Checkout xsimd-algorithm
uses: actions/checkout@v7
- name: Set conda environment
uses: mamba-org/setup-micromamba@v2
with:
environment-name: myenv
environment-file: environment-dev.yml
init-shell: bash
cache-downloads: true
- name: Setup SDE
if: startswith(matrix.sys.flags, 'avx512')
run: sh install_sde.sh
- name: Configure build
env:
CC: ${{ env.CC }}
CXX: ${{ env.CXX }}
run: |
if [[ '${{ matrix.sys.flags }}' == 'avx' ]]; then
CXX_FLAGS="$CXX_FLAGS -march=sandybridge"
fi
if [[ '${{ matrix.sys.flags }}' == 'sse3' ]]; then
CXX_FLAGS="$CXX_FLAGS -march=nocona"
fi
if [[ '${{ matrix.sys.flags }}' == 'avx512' ]]; then
CXX_FLAGS="$CXX_FLAGS -march=skylake-avx512"
fi
if [[ '${{ matrix.sys.flags }}' == 'avx512pf' ]]; then
CXX_FLAGS="$CXX_FLAGS -march=knl"
fi
if [[ '${{ matrix.sys.flags }}' == 'avx512vbmi' ]]; then
CXX_FLAGS="$CXX_FLAGS -march=cannonlake"
fi
if [[ '${{ matrix.sys.flags }}' == 'avx512vbmi2' ]]; then
CXX_FLAGS="$CXX_FLAGS -march=icelake-server"
fi
if [[ '${{ matrix.sys.flags }}' == 'avx512vnni' ]]; then
CXX_FLAGS="$CXX_FLAGS -march=knm"
fi
if [[ '${{ matrix.sys.flags }}' == 'force_no_instr_set' ]]; then
:
else
CMAKE_EXTRA_ARGS="$CMAKE_EXTRA_ARGS -DXSIMD_ENABLE_WERROR=ON"
fi
# Cheap way of spotting uninitialized read
CXX_FLAGS="$CXX_FLAGS -ftrivial-auto-var-init=pattern"
mkdir _build
cd _build
cmake .. -DBUILD_TESTS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=$CC \
-DCMAKE_CXX_COMPILER=$CXX \
$CMAKE_EXTRA_ARGS \
-DCMAKE_CXX_FLAGS="$CXX_FLAGS" \
-G Ninja
- name: Build
run: ninja -C _build
- name: Test
run: |
cd _build
cd test
if echo '${{ matrix.sys.flags }}' | grep -q 'avx512' ; then
../../sde-external-9.48.0-2024-11-25-lin/sde64 -tgl -- ./test_xsimd_algorithm
else
./test_xsimd_algorithm
fi