Skip to content

Commit

Permalink
Merge pull request #807 from jszuppe/ci-fixes
Browse files Browse the repository at this point in the history
Add Intel (1.2, 2.0, 2.1) and OpenCL 2.2 builds for Travis CI
  • Loading branch information
jszuppe authored Dec 29, 2018
2 parents 0f52d92 + facbfb2 commit 2135633
Show file tree
Hide file tree
Showing 5 changed files with 218 additions and 32 deletions.
227 changes: 201 additions & 26 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ env:
# Khronos OpenCL ICD
- OPENCL_REGISTRY=https://www.khronos.org/registry/OpenCL/
- OPENCL_ROOT=${DEPS_DIR}/opencl
- OPENCL_ICD_LIB=${OPENCL_ROOT}/icd/build/lib/libOpenCL.so
# POCL
- POCL_BRANCH=release_1_2 # branch/tag
- POCL_LLVM_VERSION=7.0.0
Expand All @@ -19,7 +20,7 @@ env:
- POCL_C_COMPILER=${DEPS_DIR}/llvm-${POCL_LLVM_VERSION}/bin/clang
- POCL_OPENCL_LIB=${POCL_ROOT}/lib/libOpenCL.so
# Global build options and C++ flags
- GCC_VERSION=5
- GCC_VERSION=5
- CMAKE_OPTIONS="-DBOOST_COMPUTE_BUILD_TESTS=ON -DBOOST_COMPUTE_BUILD_EXAMPLES=ON -DBOOST_COMPUTE_BUILD_BENCHMARKS=ON -DBOOST_COMPUTE_USE_OFFLINE_CACHE=ON -DBOOST_COMPUTE_HAVE_OPENCV=ON -DBOOST_COMPUTE_THREAD_SAFE=ON"
- CXX_FLAGS="-Wall -pedantic -Werror -Wno-variadic-macros -Wno-long-long -Wno-shadow -DCI_BUILD"
# Boost
Expand Down Expand Up @@ -104,47 +105,189 @@ matrix:
- OPENCL_LIB=pocl
- ENV_CXX_FLAGS="-Wno-unused-local-typedef -DBOOST_COMPUTE_MAX_CL_VERSION=101"
- ENV_CMAKE_OPTIONS="-DOpenCL_LIBRARY=${POCL_OPENCL_LIB} -DOpenCL_INCLUDE_DIR=${OPENCL_ROOT}/include"
# Xenial, OpenCL 1.2, New Boost Libs, C++11, Coverage
# Xenial, OpenCL 1.2
# CLANG
- os: linux
dist: xenial
compiler: clang
addons:
apt:
packages: &xenial_pocl_packages_latest_boost
packages: *xenial_pocl_packages
sources: *xenial_pocl_sources
env:
- OPENCL_LIB=pocl
- ENV_CXX_FLAGS="-Wno-unused-local-typedef -DBOOST_COMPUTE_MAX_CL_VERSION=102"
- ENV_CMAKE_OPTIONS="-DOpenCL_LIBRARY=${POCL_OPENCL_LIB} -DOpenCL_INCLUDE_DIR=${OPENCL_ROOT}/include"
# GCC
- os: linux
dist: xenial
compiler: gcc
addons:
apt:
packages: *xenial_pocl_packages
sources: *xenial_pocl_sources
env:
- OPENCL_LIB=pocl
- ENV_CXX_FLAGS="-Wno-unused-local-typedef -DBOOST_COMPUTE_MAX_CL_VERSION=102"
- ENV_CMAKE_OPTIONS="-DOpenCL_LIBRARY=${POCL_OPENCL_LIB} -DOpenCL_INCLUDE_DIR=${OPENCL_ROOT}/include -DBOOST_COMPUTE_ENABLE_COVERAGE=ON"

############################################################################
# Intel OpenCL Runtime builds (1.2, 2.0, 2.1)
############################################################################

# Linux, Intel OpenCL 1.2
# CLANG
- os: linux
dist: xenial
compiler: clang
addons:
apt:
packages: &xenial_intel_packages
- g++-5
# POCL
- libltdl-dev
- libhwloc-dev
- pkg-config
- libedit-dev
# Boost
- libboost-chrono1.58-dev
- libboost-date-time1.58-dev
- libboost-test1.58-dev
- libboost-system1.58-dev
- libboost-filesystem1.58-dev
- libboost-timer1.58-dev
- libboost-program-options1.58-dev
- libboost-thread1.58-dev
# Misc
- python-yaml
- lcov
- libopencv-dev
sources: &xenial_pocl_sources_latest_boost
sources: &xenial_intel_sources
- ubuntu-toolchain-r-test
env:
- OPENCL_LIB=pocl
- BOOST_VERSION="1_67_0"
- BOOST_URL="https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.gz"
- ENV_CXX_FLAGS="-Wno-unused-local-typedef -DBOOST_COMPUTE_MAX_CL_VERSION=102"
- ENV_CMAKE_OPTIONS="-DOpenCL_LIBRARY=${POCL_OPENCL_LIB} -DOpenCL_INCLUDE_DIR=${OPENCL_ROOT}/include -DBOOST_COMPUTE_USE_CPP11=ON"
- OPENCL_LIB=intel
- ENV_CXX_FLAGS="-Wno-unused-local-typedef -DBOOST_COMPUTE_MAX_CL_VERSION=102"
- ENV_CMAKE_OPTIONS="-DOpenCL_INCLUDE_DIR=${OPENCL_ROOT}/include"
# GCC
- os: linux
dist: xenial
compiler: gcc
addons:
apt:
packages: *xenial_pocl_packages_latest_boost
sources: *xenial_pocl_sources_latest_boost
packages: *xenial_intel_packages
sources: *xenial_intel_sources
env:
- OPENCL_LIB=pocl
- COVERAGE=true
- BOOST_VERSION="1_67_0"
- BOOST_URL="https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.gz"
- ENV_CXX_FLAGS="-Wno-unused-local-typedef -DBOOST_COMPUTE_MAX_CL_VERSION=102"
- ENV_CMAKE_OPTIONS="-DOpenCL_LIBRARY=${POCL_OPENCL_LIB} -DOpenCL_INCLUDE_DIR=${OPENCL_ROOT}/include -DBOOST_COMPUTE_ENABLE_COVERAGE=ON -DBOOST_COMPUTE_USE_CPP11=ON"
- OPENCL_LIB=intel
- ENV_CXX_FLAGS="-Wno-unused-local-typedef -DBOOST_COMPUTE_MAX_CL_VERSION=102"
- ENV_CMAKE_OPTIONS="-DOpenCL_INCLUDE_DIR=${OPENCL_ROOT}/include"
# Linux, Intel OpenCL 2.0
# CLANG
- os: linux
dist: xenial
compiler: clang
addons:
apt:
packages: *xenial_intel_packages
sources: *xenial_intel_sources
env:
- OPENCL_LIB=intel
- ENV_CXX_FLAGS="-Wno-unused-local-typedef -DBOOST_COMPUTE_MAX_CL_VERSION=200"
- ENV_CMAKE_OPTIONS="-DOpenCL_INCLUDE_DIR=${OPENCL_ROOT}/include"
# GCC
- os: linux
dist: xenial
compiler: gcc
addons:
apt:
packages: *xenial_intel_packages
sources: *xenial_intel_sources
env:
- OPENCL_LIB=intel
- ENV_CXX_FLAGS="-Wno-unused-local-typedef -DBOOST_COMPUTE_MAX_CL_VERSION=200"
- ENV_CMAKE_OPTIONS="-DOpenCL_INCLUDE_DIR=${OPENCL_ROOT}/include"
# Linux, Intel OpenCL 2.1, New Boost Libs, C++11, Coverage
# CLANG
- os: linux
dist: xenial
compiler: clang
cache:
ccache: true
directories:
- ${DEPS_DIR}/boost
addons:
apt:
packages: &xenial_intel_latest_boost_packages
- g++-5
# Misc
- python-yaml
- lcov
- libopencv-dev
sources: &xenial_intel_latest_boost_sources
- ubuntu-toolchain-r-test
env:
- OPENCL_LIB=intel
- BOOST_VERSION="1_67_0"
- ENV_CXX_FLAGS="-Wno-unused-local-typedef -DBOOST_COMPUTE_MAX_CL_VERSION=201"
- ENV_CMAKE_OPTIONS="-DOpenCL_INCLUDE_DIR=${OPENCL_ROOT}/include -DBOOST_COMPUTE_USE_CPP11=ON"
# GCC
- os: linux
dist: xenial
compiler: gcc
cache:
ccache: true
directories:
- ${DEPS_DIR}/boost
addons:
apt:
packages: *xenial_intel_latest_boost_packages
sources: *xenial_intel_latest_boost_sources
env:
- OPENCL_LIB=intel
- BOOST_VERSION="1_67_0"
- COVERAGE=true
- ENV_CXX_FLAGS="-Wno-unused-local-typedef -DBOOST_COMPUTE_MAX_CL_VERSION=201"
- ENV_CMAKE_OPTIONS="-DOpenCL_INCLUDE_DIR=${OPENCL_ROOT}/include -DBOOST_COMPUTE_ENABLE_COVERAGE=ON -DBOOST_COMPUTE_USE_CPP11=ON"
- COVERAGE=true

############################################################################
# OpenCL 2.2 Only Build
############################################################################

# Linux, OpenCL 2.2, Tests not run, C++11
# CLANG
- os: linux
dist: xenial
compiler: clang
addons:
apt:
packages: &xenial_packages
- g++-5
# Boost
- libboost-chrono1.58-dev
- libboost-date-time1.58-dev
- libboost-test1.58-dev
- libboost-system1.58-dev
- libboost-filesystem1.58-dev
- libboost-timer1.58-dev
- libboost-program-options1.58-dev
- libboost-thread1.58-dev
# Misc
- libopencv-dev
sources: &xenial_sources
- ubuntu-toolchain-r-test
env:
- OPENCL_LIB=khronos-icd
- RUN_TESTS=false
- ENV_CXX_FLAGS="-Wno-unused-local-typedef -DBOOST_COMPUTE_MAX_CL_VERSION=202"
- ENV_CMAKE_OPTIONS="-DOpenCL_LIBRARY=${OPENCL_ICD_LIB} -DOpenCL_INCLUDE_DIR=${OPENCL_ROOT}/include -DBOOST_COMPUTE_USE_CPP11=ON"
# GCC
- os: linux
dist: xenial
compiler: gcc
addons:
apt:
packages: *xenial_packages
sources: *xenial_sources
env:
- OPENCL_LIB=khronos-icd
- RUN_TESTS=false
- ENV_CXX_FLAGS="-Wno-unused-local-typedef -DBOOST_COMPUTE_MAX_CL_VERSION=202"
- ENV_CMAKE_OPTIONS="-DOpenCL_LIBRARY=${OPENCL_ICD_LIB} -DOpenCL_INCLUDE_DIR=${OPENCL_ROOT}/include -DBOOST_COMPUTE_USE_CPP11=ON"

############################################################################
# OSX
Expand Down Expand Up @@ -194,7 +337,7 @@ before_install:

install:
############################################################################
# Download and install recent CMake
# Download and install recent CMake
############################################################################
- |
if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
Expand All @@ -205,7 +348,7 @@ install:
fi
############################################################################
# Download and install Boost
# Download and install Boost
############################################################################
- |
if [[ ${TRAVIS_OS_NAME} == "linux" && ${BOOST_VERSION} != "default" ]]; then
Expand All @@ -215,6 +358,8 @@ install:
mkdir -p ${DEPS_DIR}/boost
rm -rf ${DEPS_DIR}/boost/*
# Download
BOOST_BASENAME=$(echo ${BOOST_VERSION} | awk -F '_' '{print $1 "." $2 "." $3 }')
BOOST_URL="https://dl.bintray.com/boostorg/release/${BOOST_BASENAME}/source/boost_${BOOST_VERSION}.tar.gz"
travis_retry wget --no-check-certificate --quiet -O - ${BOOST_URL} | tar --strip-components=1 -xz -C ${DEPS_DIR}/boost${BOOST_VERSION}
pushd ${DEPS_DIR}/boost${BOOST_VERSION}
# Configure and install
Expand Down Expand Up @@ -243,6 +388,22 @@ install:
popd
fi
############################################################################
# Only ICD
############################################################################
- |
if [[ ${TRAVIS_OS_NAME} == "linux" && ${OPENCL_LIB} == "khronos-icd" ]]; then
mkdir -p ${OPENCL_ROOT}
pushd ${OPENCL_ROOT}
travis_retry git clone --depth 1 https://github.com/KhronosGroup/OpenCL-ICD-Loader.git icd
pushd icd
mkdir -p inc/CL
cp ${OPENCL_ROOT}/include/CL/* ./inc/CL/
make -j2
popd
popd
fi
############################################################################
# Build and install POCL https://github.com/pocl/pocl
############################################################################
Expand All @@ -254,13 +415,27 @@ install:
mkdir build
cd build
cmake -DDIRECT_LINKAGE=ON -DENABLE_ICD=OFF -DCMAKE_C_COMPILER=${POCL_C_COMPILER} -DCMAKE_CXX_COMPILER=${POCL_CXX_COMPILER} -DWITH_LLVM_CONFIG=${POCL_LLVM_CONFIG} -DCMAKE_INSTALL_PREFIX=${POCL_ROOT}/ ..
make install
make -j2 install
cd ../..
else
echo 'Using cached POCL lib.'
fi
fi
############################################################################
# Install Intel OpenCL Runtime
############################################################################
- |
if [[ ${TRAVIS_OS_NAME} == "linux" && ${OPENCL_LIB} == "intel" ]]; then
# https://software.intel.com/en-us/articles/opencl-drivers#cpu-section
PACKAGE_URL=http://registrationcenter-download.intel.com/akdlm/irc_nas/vcp/13793/l_opencl_p_18.1.0.013.tgz
PACKAGE_NAME=l_opencl_p_18.1.0.013
wget -q ${PACKAGE_URL} -O /tmp/opencl_runtime.tgz
tar -xzf /tmp/opencl_runtime.tgz -C /tmp
sed 's/decline/accept/g' -i /tmp/${PACKAGE_NAME}/silent.cfg
sudo /tmp/${PACKAGE_NAME}/install.sh -s /tmp/${PACKAGE_NAME}/silent.cfg
fi
script:
############################################################################
# Build Boost.Compute tests, benchmarks and examples
Expand All @@ -285,4 +460,4 @@ after_success:
lcov --directory test --base-directory ../include/boost/compute/ --capture --output-file coverage.info
lcov --remove coverage.info '/usr*' '*/test/*' '*/deps/*' -o coverage.info
cd .. && coveralls-lcov build/coverage.info
fi
fi
5 changes: 5 additions & 0 deletions include/boost/compute/kernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <boost/compute/program.hpp>
#include <boost/compute/platform.hpp>
#include <boost/compute/type_traits/is_fundamental.hpp>
#include <boost/compute/detail/diagnostic.hpp>
#include <boost/compute/detail/get_object_info.hpp>
#include <boost/compute/detail/assert_cl_success.hpp>

Expand Down Expand Up @@ -256,12 +257,14 @@ class kernel
return boost::optional<T>();
}

BOOST_COMPUTE_DISABLE_DEPRECATED_DECLARATIONS();
clGetKernelSubGroupInfoKHR_fn clGetKernelSubGroupInfoKHR_fptr =
reinterpret_cast<clGetKernelSubGroupInfoKHR_fn>(
reinterpret_cast<size_t>(
device.platform().get_extension_function_address("clGetKernelSubGroupInfoKHR")
)
);
BOOST_COMPUTE_ENABLE_DEPRECATED_DECLARATIONS();

return detail::get_object_info<T>(
clGetKernelSubGroupInfoKHR_fptr, m_kernel, info, device.id(), input_size, input
Expand Down Expand Up @@ -299,12 +302,14 @@ class kernel
return boost::optional<T>();
}

BOOST_COMPUTE_DISABLE_DEPRECATED_DECLARATIONS();
clGetKernelSubGroupInfoKHR_fn clGetKernelSubGroupInfoKHR_fptr =
reinterpret_cast<clGetKernelSubGroupInfoKHR_fn>(
reinterpret_cast<size_t>(
device.platform().get_extension_function_address("clGetKernelSubGroupInfoKHR")
)
);
BOOST_COMPUTE_ENABLE_DEPRECATED_DECLARATIONS();

return detail::get_object_info<T>(
clGetKernelSubGroupInfoKHR_fptr, m_kernel, info, device.id(), input_size, input
Expand Down
4 changes: 2 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ endif()
add_definitions(-DBOOST_COMPUTE_DEBUG_KERNEL_COMPILATION)

# enable code coverage generation (only with GCC for now)
if(${BOOST_COMPUTE_ENABLE_COVERAGE} AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if(${BOOST_COMPUTE_ENABLE_COVERAGE} AND ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
add_definitions(-fprofile-arcs -ftest-coverage)
endif()

Expand All @@ -62,7 +62,7 @@ function(add_compute_test TEST_NAME TEST_SOURCE)
)

# link with coverage library
if(${BOOST_COMPUTE_ENABLE_COVERAGE} AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if(${BOOST_COMPUTE_ENABLE_COVERAGE} AND ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
target_link_libraries(${TEST_TARGET} -fprofile-arcs -ftest-coverage)
endif()

Expand Down
4 changes: 2 additions & 2 deletions test/extra/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ---------------------------------------------------------------------------
# Copyright (c) 2015 Kyle Lutz <[email protected]>
#
#
# Distributed under the Boost Software License, Version 1.0
# See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt
Expand All @@ -20,7 +20,7 @@ target_link_libraries(test_multiple_objects
${Boost_LIBRARIES}
)
# link with coverage library
if(${BOOST_COMPUTE_ENABLE_COVERAGE} AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if(${BOOST_COMPUTE_ENABLE_COVERAGE} AND ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
target_link_libraries(test_multiple_objects -fprofile-arcs -ftest-coverage)
endif()
add_test("misc.multiple_objects" test_multiple_objects)
Expand Down
Loading

0 comments on commit 2135633

Please sign in to comment.