diff --git a/.travis.yml b/.travis.yml index 036930082..85c84a78b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,29 +2,24 @@ language: cpp env: global: - # Ubuntu version - - LINUX_DIST=trusty - DEPS_DIR=${TRAVIS_BUILD_DIR}/deps # CMake - - CMAKE_URL=https://cmake.org/files/v3.10/cmake-3.10.0-Linux-x86_64.tar.gz + - CMAKE_URL=https://github.com/Kitware/CMake/releases/download/v3.13.2/cmake-3.13.2-Linux-x86_64.tar.gz # OpenCL - OPENCL_LIB=default - - OPENCL_HEADERS_VER="22" # Khronos OpenCL ICD - - OPENCL_REGISTRY=https://www.khronos.org/registry/cl + - OPENCL_REGISTRY=https://www.khronos.org/registry/OpenCL/ - OPENCL_ROOT=${DEPS_DIR}/opencl # POCL - - POCL_BRANCH=release_1_0 # branch/tag - - POCL_LLVM_VERSION=5.0.1 + - POCL_BRANCH=release_1_2 # branch/tag + - POCL_LLVM_VERSION=7.0.0 - POCL_ROOT=${OPENCL_ROOT}/pocl-${POCL_BRANCH}/ - POCL_LLVM_CONFIG=${DEPS_DIR}/llvm-${POCL_LLVM_VERSION}/bin/llvm-config - POCL_CXX_COMPILER=${DEPS_DIR}/llvm-${POCL_LLVM_VERSION}/bin/clang++ - POCL_C_COMPILER=${DEPS_DIR}/llvm-${POCL_LLVM_VERSION}/bin/clang - POCL_OPENCL_LIB=${POCL_ROOT}/lib/libOpenCL.so - # AMD APP SDK - - AMDAPPSDKROOT=${OPENCL_ROOT}/AMDAPPSDK # Global build options and C++ flags - - GCC_VERSION=4.8 + - 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 @@ -39,215 +34,117 @@ matrix: # POCL builds (OpenCL 1.0, 1.1, 1.2) ############################################################################ - # Trusty, OpenCL 1.0 + # Xenial, OpenCL 1.0 # CLANG - os: linux - dist: trusty - sudo: required + dist: xenial compiler: clang addons: apt: - packages: &trusty_pocl_packages - - g++-4.8 + packages: &xenial_pocl_packages + - g++-5 # POCL - libltdl-dev - libhwloc-dev - pkg-config - libedit-dev # Boost - - libboost-chrono1.55-dev - - libboost-date-time1.55-dev - - libboost-test1.55-dev - - libboost-system1.55-dev - - libboost-filesystem1.55-dev - - libboost-timer1.55-dev - - libboost-program-options1.55-dev - - libboost-thread1.55-dev + - 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: &trusty_pocl_sources + sources: &xenial_pocl_sources - ubuntu-toolchain-r-test env: - OPENCL_LIB=pocl - - OPENCL_HEADERS_VER="22" - ENV_CXX_FLAGS="-Wno-unused-local-typedef -DBOOST_COMPUTE_MAX_CL_VERSION=100" - ENV_CMAKE_OPTIONS="-DOpenCL_LIBRARY=${POCL_OPENCL_LIB} -DOpenCL_INCLUDE_DIR=${OPENCL_ROOT}/include" # GCC - os: linux - dist: trusty - sudo: required + dist: xenial compiler: gcc addons: apt: - packages: *trusty_pocl_packages - sources: *trusty_pocl_sources + packages: *xenial_pocl_packages + sources: *xenial_pocl_sources env: - OPENCL_LIB=pocl - - OPENCL_HEADERS_VER="22" - ENV_CXX_FLAGS="-Wno-unused-local-typedef -DBOOST_COMPUTE_MAX_CL_VERSION=100" - ENV_CMAKE_OPTIONS="-DOpenCL_LIBRARY=${POCL_OPENCL_LIB} -DOpenCL_INCLUDE_DIR=${OPENCL_ROOT}/include" - # Trusty, OpenCL 1.1 + # Xenial, OpenCL 1.1 # CLANG - os: linux - dist: trusty - sudo: required + dist: xenial compiler: clang addons: apt: - packages: *trusty_pocl_packages - sources: *trusty_pocl_sources + packages: *xenial_pocl_packages + sources: *xenial_pocl_sources env: - OPENCL_LIB=pocl - - OPENCL_HEADERS_VER="22" - 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" # GCC - os: linux - dist: trusty - sudo: required + dist: xenial compiler: gcc addons: apt: - packages: *trusty_pocl_packages - sources: *trusty_pocl_sources + packages: *xenial_pocl_packages + sources: *xenial_pocl_sources env: - OPENCL_LIB=pocl - - OPENCL_HEADERS_VER="22" - 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" - # Trusty, OpenCL 1.2 + # Xenial, OpenCL 1.2, New Boost Libs, C++11, Coverage # CLANG - os: linux - dist: trusty - sudo: required + dist: xenial compiler: clang addons: apt: - packages: *trusty_pocl_packages - sources: *trusty_pocl_sources - env: - - OPENCL_LIB=pocl - - OPENCL_HEADERS_VER="22" - - 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: trusty - sudo: required - compiler: gcc - addons: - apt: - packages: *trusty_pocl_packages - sources: *trusty_pocl_sources - env: - - OPENCL_LIB=pocl - - OPENCL_HEADERS_VER="22" - - 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" - - ############################################################################ - # AMD APP SDK builds (v2.9.1 -> OpenCL 1.2, v3.0 -> OpenCL 2.0) - ############################################################################ - - # Trusty, AMD APP SDK v2.9.1, OpenCL 1.2 - # CLANG - - os: linux - dist: trusty - sudo: required - compiler: clang - addons: - apt: - packages: &trusty_amdappsdk_packages - - g++-4.8 - # Boost - - libboost-chrono1.55-dev - - libboost-date-time1.55-dev - - libboost-test1.55-dev - - libboost-system1.55-dev - - libboost-filesystem1.55-dev - - libboost-timer1.55-dev - - libboost-program-options1.55-dev - - libboost-thread1.55-dev + packages: &xenial_pocl_packages_latest_boost + - g++-5 + # POCL + - libltdl-dev + - libhwloc-dev + - pkg-config + - libedit-dev # Misc - python-yaml - lcov - libopencv-dev - sources: &trusty_amdappsdk_sources + sources: &xenial_pocl_sources_latest_boost - ubuntu-toolchain-r-test env: - - OPENCL_LIB=amdappsdk - - OPENCL_HEADERS_VER="22" - - AMDAPPSDK_VERSION=291 # OpenCL 1.2 - - 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: trusty - sudo: required - compiler: gcc - addons: - apt: - packages: *trusty_amdappsdk_packages - sources: *trusty_amdappsdk_sources - env: - - OPENCL_LIB=amdappsdk - - OPENCL_HEADERS_VER="22" - - AMDAPPSDK_VERSION=291 # OpenCL 1.2 - - ENV_CXX_FLAGS="-Wno-unused-local-typedef -DBOOST_COMPUTE_MAX_CL_VERSION=102" - - ENV_CMAKE_OPTIONS="-DOpenCL_INCLUDE_DIR=${OPENCL_ROOT}/include" - # Trusty, AMD APP SDK v3.0.0, OpenCL 2.0 - # CLANG - - os: linux - dist: trusty - sudo: required - compiler: clang - cache: - ccache: true - directories: - - ${DEPS_DIR}/boost - addons: - apt: - packages: &trusty_amdappsdk_latest_boost_packages - - g++-5 - # Misc - - python-yaml - - lcov - - libopencv-dev - sources: &trusty_amdappsdk_latest_boost_sources - - ubuntu-toolchain-r-test - env: - - OPENCL_LIB=amdappsdk - - OPENCL_HEADERS_VER="22" - - AMDAPPSDK_VERSION=300 # OpenCL 2.0 - - BOOST_VERSION="1_65_1" # Boost 1.65.1 - - BOOST_URL="https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.gz" - - ENV_CXX_FLAGS="-DBOOST_COMPUTE_MAX_CL_VERSION=200" - - ENV_CMAKE_OPTIONS="-DOpenCL_INCLUDE_DIR=${OPENCL_ROOT}/include -DBOOST_COMPUTE_USE_CPP11=ON" + - 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" # GCC - os: linux - dist: trusty - sudo: required + dist: xenial compiler: gcc - cache: - ccache: true - directories: - - ${DEPS_DIR}/boost addons: apt: - packages: *trusty_amdappsdk_latest_boost_packages - sources: *trusty_amdappsdk_latest_boost_sources + packages: *xenial_pocl_packages_latest_boost + sources: *xenial_pocl_sources_latest_boost env: - - GCC_VERSION=5 - - OPENCL_LIB=amdappsdk - - OPENCL_HEADERS_VER="22" - - AMDAPPSDK_VERSION=300 # OpenCL 2.0 - - BOOST_VERSION="1_65_1" # Boost 1.65.1 - - BOOST_URL="https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.gz" - - ENV_CXX_FLAGS="-DBOOST_COMPUTE_MAX_CL_VERSION=200" - - ENV_CMAKE_OPTIONS="-DOpenCL_INCLUDE_DIR=${OPENCL_ROOT}/include -DBOOST_COMPUTE_ENABLE_COVERAGE=ON -DBOOST_COMPUTE_USE_CPP11=ON" - - COVERAGE=true + - 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" ############################################################################ # OSX @@ -268,10 +165,10 @@ cache: before_install: # Install dependencies - | - # POCL dependencies for Trusty - if [[ ${LINUX_DIST} == "trusty" && ${OPENCL_LIB} == "pocl" ]]; then + # POCL dependencies for Xenial + if [[ ${TRAVIS_OS_NAME} == "linux" && ${OPENCL_LIB} == "pocl" ]]; then if [ -z "$(ls -A ${DEPS_DIR}/llvm-${POCL_LLVM_VERSION})" ]; then - POCL_LLVM_URL=http://llvm.org/releases/${POCL_LLVM_VERSION}/clang+llvm-${POCL_LLVM_VERSION}-x86_64-linux-gnu-ubuntu-14.04.tar.xz + POCL_LLVM_URL=http://llvm.org/releases/${POCL_LLVM_VERSION}/clang+llvm-${POCL_LLVM_VERSION}-x86_64-linux-gnu-ubuntu-16.04.tar.xz mkdir -p ${DEPS_DIR}/llvm-${POCL_LLVM_VERSION} travis_retry wget --no-check-certificate --quiet -O llvm-${POCL_LLVM_VERSION}.tar.xz ${POCL_LLVM_URL} tar xf llvm-${POCL_LLVM_VERSION}.tar.xz -C ${DEPS_DIR}/llvm-${POCL_LLVM_VERSION} --strip-components 1 @@ -296,7 +193,9 @@ before_install: - export CXX_FLAGS=${CXX_FLAGS}" "${ENV_CXX_FLAGS} install: - # Download and install recent cmake + ############################################################################ + # Download and install recent CMake + ############################################################################ - | if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then CMAKE_URL=${CMAKE_URL} @@ -305,18 +204,20 @@ install: export PATH=${DEPS_DIR}/cmake/bin:${PATH} fi - # Download and install Boost + ############################################################################ + # Download and install Boost + ############################################################################ - | if [[ ${TRAVIS_OS_NAME} == "linux" && ${BOOST_VERSION} != "default" ]]; then if [ ! -f "${DEPS_DIR}/boost/${BOOST_VERSION}_cached" ]; then - # create dirs for source and install + # Create dirs for source and install mkdir -p ${DEPS_DIR}/boost${BOOST_VERSION} mkdir -p ${DEPS_DIR}/boost rm -rf ${DEPS_DIR}/boost/* - # download + # Download 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 + # Configure and install if [ "$CXX" = "g++-${GCC_VERSION}" ]; then echo "using gcc : ${GCC_VERSION} : g++-${GCC_VERSION} ;" > $HOME/user-config.jam; fi ./bootstrap.sh --prefix=${DEPS_DIR}/boost/ --with-libraries=program_options,filesystem,system,thread,test,timer,chrono ./b2 -d0 install @@ -337,7 +238,7 @@ install: mkdir -p ${OPENCL_ROOT}/include/CL pushd ${OPENCL_ROOT}/include/CL travis_retry git clone --depth 1 https://github.com/KhronosGroup/OpenCL-Headers.git - mv ./OpenCL-Headers/opencl${OPENCL_HEADERS_VER}/CL/* . + mv ./OpenCL-Headers/CL/* . travis_retry wget -w 1 -np -nd -nv -A h,hpp --no-check-certificate ${OPENCL_REGISTRY}/api/2.1/cl.hpp; popd fi @@ -360,57 +261,6 @@ install: fi fi - ############################################################################ - # fglrx does not work: https://github.com/travis-ci/travis-ci/issues/5221, - # so we build our own linkable .so file. - # Thanks to clSPARSE for providing opencl-icd build script. - ############################################################################ - - | - 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 - mv ./OpenCL-ICD-Loader/* . - mkdir -p inc/CL - pushd inc/CL - travis_retry git clone --depth 1 https://github.com/KhronosGroup/OpenCL-Headers.git - mv ./OpenCL-Headers/opencl${OPENCL_HEADERS_VER}/CL/* . - popd - mkdir -p lib - pushd lib - cmake -G "Unix Makefiles" .. - make - cp ./bin/libOpenCL.so . - popd - popd - fi - - ############################################################################ - # Install AMD APP SDK - # Thanks to JuliaGPU https://github.com/JuliaGPU/OpenCL.jl - ############################################################################ - - | - if [[ ${TRAVIS_OS_NAME} == "linux" && ${OPENCL_LIB} == "amdappsdk" ]]; then - mkdir -p ${OPENCL_ROOT} - bash .travis/amd_sdk.sh ${AMDAPPSDK_VERSION} - tar -xjf AMD-SDK.tar.bz2 - export OPENCL_VENDOR_PATH=${AMDAPPSDKROOT}/etc/OpenCL/vendors - mkdir -p ${OPENCL_VENDOR_PATH} - sh AMD-APP-SDK*.sh --tar -xf -C ${AMDAPPSDKROOT} - echo libamdocl64.so > ${OPENCL_VENDOR_PATH}/amdocl64.icd - if [[ ${AMDAPPSDK_VERSION} == "300" ]]; then - export LD_LIBRARY_PATH=${AMDAPPSDKROOT}/lib/x86_64/sdk:${LD_LIBRARY_PATH} - export CMAKE_LIBRARY_PATH=${AMDAPPSDKROOT}/lib/x86_64/sdk - cp ${AMDAPPSDKROOT}/lib/x86_64/libamdocl12cl64.so ${AMDAPPSDKROOT}/lib/x86_64/sdk/libamdocl12cl64.so - # 291 - else - export LD_LIBRARY_PATH=${AMDAPPSDKROOT}/lib/x86_64:${LD_LIBRARY_PATH} - export CMAKE_LIBRARY_PATH=${AMDAPPSDKROOT}/lib/x86_64 - fi - chmod +x ${AMDAPPSDKROOT}/bin/x86_64/clinfo - ${AMDAPPSDKROOT}/bin/x86_64/clinfo - fi - script: ############################################################################ # Build Boost.Compute tests, benchmarks and examples @@ -423,9 +273,9 @@ script: - make -j4 - | if [[ ${RUN_TESTS} == "true" ]]; then - # print OpenCL devices + # Print OpenCL devices ./example/list_devices - # run tests and examples + # Run tests and examples ctest --output-on-failure --repeat-until-fail 2 fi diff --git a/.travis/amd_sdk.sh b/.travis/amd_sdk.sh deleted file mode 100644 index af30d2329..000000000 --- a/.travis/amd_sdk.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash - -# Original script from https://github.com/gregvw/amd_sdk/ - -# Location from which get nonce and file name from -URL="https://developer.amd.com/amd-accelerated-parallel-processing-app-sdk/" -URLDOWN="https://developer.amd.com/amd-license-agreement-appsdk/" - -NONCE1_STRING='name="amd_developer_central_downloads_page_nonce"' -FILE_STRING='name="f"' -POSTID_STRING='name="post_id"' -NONCE2_STRING='name="amd_developer_central_nonce"' - -#AMD APP SDK v3.0: -if [[ $1 == "300" ]]; then - echo "AMD APP SDK v3.0" - FORM=`wget -qO - $URL | sed -n '/download-2/,/64-bit/p'` -else -#AMD APP SDK v2.9.1: - echo "AMD APP SDK v2.9.1" - FORM=`wget -qO - $URL | sed -n '/download-5/,/64-bit/p'` -fi - -# Get nonce from form -NONCE1=`echo $FORM | awk -F ${NONCE1_STRING} '{print $2}'` -NONCE1=`echo $NONCE1 | awk -F'"' '{print $2}'` -echo $NONCE1 - -# get the postid -POSTID=`echo $FORM | awk -F ${POSTID_STRING} '{print $2}'` -POSTID=`echo $POSTID | awk -F'"' '{print $2}'` -echo $POSTID - -# get file name -FILE=`echo $FORM | awk -F ${FILE_STRING} '{print $2}'` -FILE=`echo $FILE | awk -F'"' '{print $2}'` -echo $FILE - -FORM=`wget -qO - $URLDOWN --post-data "amd_developer_central_downloads_page_nonce=${NONCE1}&f=${FILE}&post_id=${POSTID}"` - -NONCE2=`echo $FORM | awk -F ${NONCE2_STRING} '{print $2}'` -NONCE2=`echo $NONCE2 | awk -F'"' '{print $2}'` -echo $NONCE2 - -wget --content-disposition --trust-server-names $URLDOWN --post-data "amd_developer_central_nonce=${NONCE2}&f=${FILE}" -O AMD-SDK.tar.bz2; diff --git a/include/boost/compute/cl.hpp b/include/boost/compute/cl.hpp index fe25ffde5..ddbb4ec20 100644 --- a/include/boost/compute/cl.hpp +++ b/include/boost/compute/cl.hpp @@ -11,23 +11,7 @@ #ifndef BOOST_COMPUTE_CL_HPP #define BOOST_COMPUTE_CL_HPP -#if defined(BOOST_COMPUTE_MAX_CL_VERSION) -# if !defined(CL_USE_DEPRECATED_OPENCL_2_1_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 202 -# define CL_USE_DEPRECATED_OPENCL_2_1_APIS -# endif -# if !defined(CL_USE_DEPRECATED_OPENCL_2_0_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 201 -# define CL_USE_DEPRECATED_OPENCL_2_0_APIS -# endif -# if !defined(CL_USE_DEPRECATED_OPENCL_1_2_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 200 -# define CL_USE_DEPRECATED_OPENCL_1_2_APIS -# endif -# if !defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 102 -# define CL_USE_DEPRECATED_OPENCL_1_1_APIS -# endif -# if !defined(CL_USE_DEPRECATED_OPENCL_1_0_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 101 -# define CL_USE_DEPRECATED_OPENCL_1_0_APIS -# endif -#endif +#include #if defined(__APPLE__) #include diff --git a/include/boost/compute/cl_ext.hpp b/include/boost/compute/cl_ext.hpp index 94cd9cc5b..0618a62e4 100644 --- a/include/boost/compute/cl_ext.hpp +++ b/include/boost/compute/cl_ext.hpp @@ -11,23 +11,7 @@ #ifndef BOOST_COMPUTE_CL_EXT_HPP #define BOOST_COMPUTE_CL_EXT_HPP -#if defined(BOOST_COMPUTE_MAX_CL_VERSION) -# if !defined(CL_USE_DEPRECATED_OPENCL_2_1_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 202 -# define CL_USE_DEPRECATED_OPENCL_2_1_APIS -# endif -# if !defined(CL_USE_DEPRECATED_OPENCL_2_0_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 201 -# define CL_USE_DEPRECATED_OPENCL_2_0_APIS -# endif -# if !defined(CL_USE_DEPRECATED_OPENCL_1_2_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 200 -# define CL_USE_DEPRECATED_OPENCL_1_2_APIS -# endif -# if !defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 102 -# define CL_USE_DEPRECATED_OPENCL_1_1_APIS -# endif -# if !defined(CL_USE_DEPRECATED_OPENCL_1_0_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 101 -# define CL_USE_DEPRECATED_OPENCL_1_0_APIS -# endif -#endif +#include "detail/cl_versions.hpp" #if defined(__APPLE__) #include diff --git a/include/boost/compute/detail/cl_versions.hpp b/include/boost/compute/detail/cl_versions.hpp new file mode 100644 index 000000000..569523a4b --- /dev/null +++ b/include/boost/compute/detail/cl_versions.hpp @@ -0,0 +1,64 @@ +//---------------------------------------------------------------------------// +// Copyright (c) 2018 Jakub Szuppe +// +// 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 +// +// See http://boostorg.github.com/compute for more information. +//---------------------------------------------------------------------------// + +#ifndef BOOST_COMPUTE_DETAIL_CL_VERSION_HPP +#define BOOST_COMPUTE_DETAIL_CL_VERSION_HPP + +#if defined(BOOST_COMPUTE_MAX_CL_VERSION) +# if !defined(CL_USE_DEPRECATED_OPENCL_2_1_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 202 +# define CL_USE_DEPRECATED_OPENCL_2_1_APIS +# endif +# if !defined(CL_USE_DEPRECATED_OPENCL_2_0_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 201 +# define CL_USE_DEPRECATED_OPENCL_2_0_APIS +# endif +# if !defined(CL_USE_DEPRECATED_OPENCL_1_2_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 200 +# define CL_USE_DEPRECATED_OPENCL_1_2_APIS +# endif +# if !defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 102 +# define CL_USE_DEPRECATED_OPENCL_1_1_APIS +# endif +# if !defined(CL_USE_DEPRECATED_OPENCL_1_0_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 101 +# define CL_USE_DEPRECATED_OPENCL_1_0_APIS +# endif +#endif + +#if defined(BOOST_COMPUTE_MAX_CL_VERSION) && !defined(CL_TARGET_OPENCL_VERSION) +# if BOOST_COMPUTE_MAX_CL_VERSION == 201 +# define CL_TARGET_OPENCL_VERSION 210 +# elif BOOST_COMPUTE_MAX_CL_VERSION == 200 +# define CL_TARGET_OPENCL_VERSION 200 +# elif BOOST_COMPUTE_MAX_CL_VERSION == 102 +# define CL_TARGET_OPENCL_VERSION 120 +# elif BOOST_COMPUTE_MAX_CL_VERSION == 101 +# define CL_TARGET_OPENCL_VERSION 110 +# elif BOOST_COMPUTE_MAX_CL_VERSION == 100 +# define CL_TARGET_OPENCL_VERSION 100 +# else +# define CL_TARGET_OPENCL_VERSION 220 +# endif +#endif + +#if defined(BOOST_COMPUTE_MAX_CL_VERSION) && defined(CL_TARGET_OPENCL_VERSION) +# if BOOST_COMPUTE_MAX_CL_VERSION == 202 && CL_TARGET_OPENCL_VERSION != 220 +# error "Boost.Compute: CL_TARGET_OPENCL_VERSION definition does not match BOOST_COMPUTE_MAX_CL_VERSION" +# elif BOOST_COMPUTE_MAX_CL_VERSION == 201 && CL_TARGET_OPENCL_VERSION != 210 +# error "Boost.Compute: CL_TARGET_OPENCL_VERSION definition does not match BOOST_COMPUTE_MAX_CL_VERSION" +# elif BOOST_COMPUTE_MAX_CL_VERSION == 200 && CL_TARGET_OPENCL_VERSION != 200 +# error "Boost.Compute: CL_TARGET_OPENCL_VERSION definition does not match BOOST_COMPUTE_MAX_CL_VERSION" +# elif BOOST_COMPUTE_MAX_CL_VERSION == 102 && CL_TARGET_OPENCL_VERSION != 120 +# error "Boost.Compute: CL_TARGET_OPENCL_VERSION definition does not match BOOST_COMPUTE_MAX_CL_VERSION" +# elif BOOST_COMPUTE_MAX_CL_VERSION == 101 && CL_TARGET_OPENCL_VERSION != 110 +# error "Boost.Compute: CL_TARGET_OPENCL_VERSION definition does not match BOOST_COMPUTE_MAX_CL_VERSION" +# elif BOOST_COMPUTE_MAX_CL_VERSION == 100 && CL_TARGET_OPENCL_VERSION != 100 +# error "Boost.Compute: CL_TARGET_OPENCL_VERSION definition does not match BOOST_COMPUTE_MAX_CL_VERSION" +# endif +#endif + +#endif // BOOST_COMPUTE_DETAIL_CL_VERSION_HPP diff --git a/include/boost/compute/detail/nvidia_compute_capability.hpp b/include/boost/compute/detail/nvidia_compute_capability.hpp index 3f859562b..b37fc9f1b 100644 --- a/include/boost/compute/detail/nvidia_compute_capability.hpp +++ b/include/boost/compute/detail/nvidia_compute_capability.hpp @@ -13,7 +13,8 @@ #include -#ifdef BOOST_COMPUTE_HAVE_HDR_CL_EXT +#ifdef BOOST_COMPUTE_HAVE_HDR_CL_EXT + #include #include #endif diff --git a/include/boost/compute/interop/opengl/cl_gl.hpp b/include/boost/compute/interop/opengl/cl_gl.hpp index de82dbd9a..34b18af62 100644 --- a/include/boost/compute/interop/opengl/cl_gl.hpp +++ b/include/boost/compute/interop/opengl/cl_gl.hpp @@ -11,6 +11,8 @@ #ifndef BOOST_COMPUTE_INTEROP_OPENGL_CL_GL_HPP #define BOOST_COMPUTE_INTEROP_OPENGL_CL_GL_HPP +#include + #if defined(__APPLE__) #include #else diff --git a/include/boost/compute/interop/opengl/cl_gl_ext.hpp b/include/boost/compute/interop/opengl/cl_gl_ext.hpp index 9458cad82..7a3d7175a 100644 --- a/include/boost/compute/interop/opengl/cl_gl_ext.hpp +++ b/include/boost/compute/interop/opengl/cl_gl_ext.hpp @@ -11,23 +11,7 @@ #ifndef BOOST_COMPUTE_INTEROP_OPENGL_CL_GL_EXT_HPP #define BOOST_COMPUTE_INTEROP_OPENGL_CL_GL_EXT_HPP -#if defined(BOOST_COMPUTE_MAX_CL_VERSION) -# if !defined(CL_USE_DEPRECATED_OPENCL_2_1_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 202 -# define CL_USE_DEPRECATED_OPENCL_2_1_APIS -# endif -# if !defined(CL_USE_DEPRECATED_OPENCL_2_0_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 201 -# define CL_USE_DEPRECATED_OPENCL_2_0_APIS -# endif -# if !defined(CL_USE_DEPRECATED_OPENCL_1_2_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 200 -# define CL_USE_DEPRECATED_OPENCL_1_2_APIS -# endif -# if !defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 102 -# define CL_USE_DEPRECATED_OPENCL_1_1_APIS -# endif -# if !defined(CL_USE_DEPRECATED_OPENCL_1_0_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 101 -# define CL_USE_DEPRECATED_OPENCL_1_0_APIS -# endif -#endif +#include #if defined(__APPLE__) #include