From 69a001819c9ac36bb3210e475d099cc2abbbf89f Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sat, 1 Jul 2017 01:46:55 +0200 Subject: [PATCH] .travis.yml: try to run tests in -mavx2 mode if the CPU supports it And modify settings so as to hae a AVX2 compatible CPU --- .travis.yml | 6 ++++-- tools/travis-ci/run.sh | 11 +++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6747fe30..282d0145 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,9 +27,11 @@ matrix: # Test compilation with AVX2 - os: linux + # "sudo: yes" and "dist: trusty" give us a worker with the AVX2 instruction set + sudo: yes + dist: trusty compiler: clang-3.8 - # skip tests since Travis doesn't have AVX2 compatible machines - env: OPJ_CI_CC=clang-3.8 OPJ_CI_CXX=clang-3.8 OPJ_CI_INSTRUCTION_SETS="-mavx2" OPJ_CI_BUILD_CONFIGURATION=Release OPJ_CI_SKIP_TESTS=1 + env: OPJ_CI_CC=clang-3.8 OPJ_CI_CXX=clang-3.8 OPJ_CI_INSTRUCTION_SETS="-mavx2" OPJ_CI_BUILD_CONFIGURATION=Release addons: apt: sources: diff --git a/tools/travis-ci/run.sh b/tools/travis-ci/run.sh index 950a0ee9..ac21dfe7 100755 --- a/tools/travis-ci/run.sh +++ b/tools/travis-ci/run.sh @@ -111,6 +111,17 @@ elif [ "${TRAVIS_OS_NAME}" == "linux" ]; then else echo "Compiler not supported: ${CC}"; exit 1 fi + if [ "${OPJ_CI_INSTRUCTION_SETS-:}" == "-mavx2" ]; then + AVX2_AVAIL=1 + cat /proc/cpuinfo | grep avx2 >/dev/null || AVX2_AVAIL=0 + if [[ "${AVX2_AVAIL}" == "1" ]]; then + echo "AVX2 available on CPU" + else + echo "AVX2 not available on CPU. Disabling tests" + cat /proc/cpuinfo | grep flags | head -n 1 + export OPJ_CI_SKIP_TESTS=1 + fi + fi elif [ "${TRAVIS_OS_NAME}" == "windows" ]; then OPJ_OS_NAME=windows if which cl > /dev/null; then