Skip to content

Commit

Permalink
Merge branch 'develop' into ci-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Zialus committed Dec 29, 2018
2 parents bc98019 + 2135633 commit 1ba9a9c
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 22 deletions.
88 changes: 72 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,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 Down Expand Up @@ -96,7 +97,7 @@ 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"
# Linux, OpenCL 1.2
# Xenial, OpenCL 1.2
# CLANG
- os: linux
compiler: clang
Expand All @@ -119,10 +120,10 @@ matrix:
- ENV_CMAKE_OPTIONS="-DOpenCL_LIBRARY=${POCL_OPENCL_LIB} -DOpenCL_INCLUDE_DIR=${OPENCL_ROOT}/include"

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

# Linux, Intel OpenCL 1.2
# Xenial, Intel OpenCL 1.2
# CLANG
- os: linux
compiler: clang
Expand All @@ -143,7 +144,7 @@ matrix:
- 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
# Xenial, Intel OpenCL 2.0
# CLANG
- os: linux
compiler: clang
Expand All @@ -164,7 +165,7 @@ matrix:
- 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
# Linux, Intel OpenCL 2.1, New Boost Libs, C++11, Coverage
# CLANG
- os: linux
compiler: clang
Expand Down Expand Up @@ -202,6 +203,47 @@ matrix:
- 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
# 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
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
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 @@ -267,7 +309,7 @@ matrix:
# Download clinfo executable and add it to PATH
- mkdir bin
- curl -L 'https://ci.appveyor.com/api/projects/oblomov/clinfo/artifacts/clinfo.exe?job=platform:+x64' -o ./bin/clinfo.exe
- export PATH=./bin/:PATH
- export PATH=./bin/:$PATH

cache:
directories:
Expand All @@ -289,16 +331,12 @@ before_install:
fi
fi
- gem install coveralls-lcov

# Combine global build options with OS/compiler-dependent options
- export CMAKE_OPTIONS=${CMAKE_OPTIONS}" "${ENV_CMAKE_OPTIONS}
- export CXXFLAGS=${CXX_FLAGS}" "${ENV_CXX_FLAGS}
# Pick correct compiler on OSX
- eval "${MATRIX_EVAL}"

install:
############################################################################
# Download and install recent CMake
# Download and install recent CMake
############################################################################
- |
if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
Expand All @@ -309,7 +347,7 @@ install:
fi
############################################################################
# Download and install Boost
# Download and install Boost
############################################################################
- |
if [[ ${TRAVIS_OS_NAME} == "linux" && ${BOOST_VERSION} != "default" ]]; then
Expand Down Expand Up @@ -348,6 +386,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 @@ -359,7 +413,7 @@ 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.'
Expand All @@ -385,8 +439,10 @@ script:
# Build Boost.Compute tests, benchmarks and examples
############################################################################
- clinfo
- mkdir -p build
- cd build
- mkdir build && cd build
# Combine global build options with OS/compiler-dependent options
- export CMAKE_OPTIONS=${CMAKE_OPTIONS}" "${ENV_CMAKE_OPTIONS}
- export CXXFLAGS=${CXX_FLAGS}" "${ENV_CXX_FLAGS}
- echo ${CXXFLAGS}
- echo ${CXX}
- echo ${CCFLAGS}
Expand All @@ -397,7 +453,7 @@ script:
# https://stackoverflow.com/questions/39865367/warning-section-textcoal-nt-is-deprecate-since-updating-to-mac-osx-sierra
# Build must be run sequentially or else the grep command will not catch warnings correctly
- if [[ ${TRAVIS_OS_NAME} == "osx" && ${CC} == "gcc-5" ]]; then cmake --build . --config Debug 2>&1 | grep -v -e '^/var/folders/*' -e '^[[:space:]]*\.section' -e '^[[:space:]]*\^[[:space:]]*~*' ; fi
- if [[ ${TRAVIS_OS_NAME} != "osx" || ${CC} != "gcc-5" ]]; then cmake --build . -j 4 --config Debug ; fi
- if [[ ${TRAVIS_OS_NAME} != "osx" || ${CC} != "gcc-5" ]]; then cmake --build . -j 2 --config Debug ; fi
- |
if [[ ${RUN_TESTS} == "true" ]]; then
# Print OpenCL devices
Expand Down
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
10 changes: 8 additions & 2 deletions test/test_kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,14 @@ BOOST_AUTO_TEST_CASE(get_sub_group_info_ext)
local_work_size
);

#ifdef BOOST_COMPUTE_CL_VERSION_2_1
if(device.check_version(2, 1))
{
BOOST_CHECK(count);
}
else if(device.check_version(2, 0) && device.supports_extension("cl_khr_subgroups"))
else
#endif // BOOST_COMPUTE_CL_VERSION_2_1
if(device.check_version(2, 0) && device.supports_extension("cl_khr_subgroups"))
{
// for device with cl_khr_subgroups it should return some value
BOOST_CHECK(count);
Expand All @@ -200,11 +203,14 @@ BOOST_AUTO_TEST_CASE(get_sub_group_info_ext)
&local_work_size[0]
);

#ifdef BOOST_COMPUTE_CL_VERSION_2_1
if(device.check_version(2, 1))
{
BOOST_CHECK(count);
}
else if(device.check_version(2, 0) && device.supports_extension("cl_khr_subgroups"))
else
#endif // BOOST_COMPUTE_CL_VERSION_2_1
if(device.check_version(2, 0) && device.supports_extension("cl_khr_subgroups"))
{
// for device with cl_khr_subgroups it should return some value
BOOST_CHECK(count);
Expand Down

0 comments on commit 1ba9a9c

Please sign in to comment.