Skip to content

Commit e9208f5

Browse files
authored
Merge branch 'develop' into ci-fixes
2 parents 2adc3b2 + 0f52d92 commit e9208f5

File tree

11 files changed

+101
-66
lines changed

11 files changed

+101
-66
lines changed

.travis.yml

+15-11
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ env:
99
# OpenCL
1010
- OPENCL_LIB=default
1111
# Khronos OpenCL ICD
12-
- OPENCL_REGISTRY=https://www.khronos.org/registry/cl
12+
- OPENCL_REGISTRY=https://www.khronos.org/registry/OpenCL/
1313
- OPENCL_ROOT=${DEPS_DIR}/opencl
1414
# POCL
1515
- POCL_BRANCH=release_1_2 # branch/tag
@@ -35,7 +35,7 @@ matrix:
3535
# POCL builds (OpenCL 1.0, 1.1, 1.2)
3636
############################################################################
3737

38-
# Linux, OpenCL 1.0
38+
# Xenial, OpenCL 1.0
3939
# CLANG
4040
- os: linux
4141
compiler: clang
@@ -75,7 +75,7 @@ matrix:
7575
- OPENCL_LIB=pocl
7676
- ENV_CXX_FLAGS="-Wno-unused-local-typedef -DBOOST_COMPUTE_MAX_CL_VERSION=100"
7777
- ENV_CMAKE_OPTIONS="-DOpenCL_LIBRARY=${POCL_OPENCL_LIB} -DOpenCL_INCLUDE_DIR=${OPENCL_ROOT}/include"
78-
# Linux, OpenCL 1.1
78+
# Xenial, OpenCL 1.1
7979
# CLANG
8080
- os: linux
8181
compiler: clang
@@ -294,7 +294,9 @@ before_install:
294294
- eval "${MATRIX_EVAL}"
295295

296296
install:
297-
# Download and install recent cmake
297+
############################################################################
298+
# Download and install recent CMake
299+
############################################################################
298300
- |
299301
if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
300302
CMAKE_URL=${CMAKE_URL}
@@ -303,20 +305,22 @@ install:
303305
export PATH=${DEPS_DIR}/cmake/bin:${PATH}
304306
fi
305307
306-
# Download and install Boost
308+
############################################################################
309+
# Download and install Boost
310+
############################################################################
307311
- |
308312
if [[ ${TRAVIS_OS_NAME} == "linux" && ${BOOST_VERSION} != "default" ]]; then
309313
if [ ! -f "${DEPS_DIR}/boost/${BOOST_VERSION}_cached" ]; then
310-
# create dirs for source and install
314+
# Create dirs for source and install
311315
mkdir -p ${DEPS_DIR}/boost${BOOST_VERSION}
312316
mkdir -p ${DEPS_DIR}/boost
313317
rm -rf ${DEPS_DIR}/boost/*
314-
# download
318+
# Download
315319
BOOST_BASENAME=$(echo ${BOOST_VERSION} | awk -F '_' '{print $1 "." $2 "." $3 }')
316320
BOOST_URL="https://dl.bintray.com/boostorg/release/${BOOST_BASENAME}/source/boost_${BOOST_VERSION}.tar.gz"
317321
travis_retry wget --no-check-certificate --quiet -O - ${BOOST_URL} | tar --strip-components=1 -xz -C ${DEPS_DIR}/boost${BOOST_VERSION}
318322
pushd ${DEPS_DIR}/boost${BOOST_VERSION}
319-
# configure and install
323+
# Configure and install
320324
./bootstrap.sh --prefix=${DEPS_DIR}/boost/ --with-libraries=program_options,filesystem,system,thread,test,timer,chrono
321325
./b2 -d0 install
322326
popd
@@ -382,15 +386,15 @@ script:
382386
- echo ${CMAKE_OPTIONS}
383387
- echo ${CXX_FLAGS}
384388
- if [[ ${TRAVIS_OS_NAME} != "windows" ]]; then cmake -G"${GENERATOR}" ${CMAKE_OPTIONS} -DCMAKE_CXX_FLAGS="${CXX_FLAGS}" .. ; fi
385-
- if [[ ${TRAVIS_OS_NAME} == "windows" ]]; then cmake -G"${GENERATOR} -DBOOST_COMPUTE_BUILD_TESTS=ON -DBOOST_COMPUTE_BUILD_EXAMPLES=ON -DCMAKE_CXX_FLAGS="${CXX_FLAGS}".. ; fi
389+
- if [[ ${TRAVIS_OS_NAME} == "windows" ]]; then cmake -G"${GENERATOR}" -DBOOST_COMPUTE_BUILD_TESTS=ON -DBOOST_COMPUTE_BUILD_EXAMPLES=ON -DCMAKE_CXX_FLAGS="${CXX_FLAGS}".. ; fi
386390
# https://stackoverflow.com/questions/39865367/warning-section-textcoal-nt-is-deprecate-since-updating-to-mac-osx-sierra
387391
- if [[ ${TRAVIS_OS_NAME} == "osx" ]]; then cmake --build . -j 4 --config Debug 2>&1 | grep -v -e '^/var/folders/*' -e '^[[:space:]]*\.section' -e '^[[:space:]]*\^[[:space:]]*~*' ; fi
388392
- if [[ ${TRAVIS_OS_NAME} != "osx" ]]; then cmake --build . -j 4 --config Debug ; fi
389393
- |
390394
if [[ ${RUN_TESTS} == "true" ]]; then
391-
# print OpenCL devices
395+
# Print OpenCL devices
392396
./example/list_devices
393-
# run tests and examples
397+
# Run tests and examples
394398
ctest --output-on-failure --repeat-until-fail 2
395399
fi
396400

doc/platforms_and_compilers.qbk

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ To explicitly enable variadic support for Boost.Preprocessor add
4040
* POCL (CPUs only)
4141
* Beignet (Intel GPUs only)
4242
* Apple (CPUs and GPUs)
43+
* Xilinx (FPGA)
4344

4445
[endsect]
4546

example/simple_moving_average.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ bool check_results(const std::vector<float>& values, const std::vector<float>& s
6060

6161
int semiWidth = wSize/2;
6262

63-
bool res = true;
63+
bool ret = true;
6464
for(int idx = 0 ; idx < size ; ++idx)
6565
{
6666
int start = (std::max)(idx - semiWidth,0);
@@ -76,11 +76,11 @@ bool check_results(const std::vector<float>& values, const std::vector<float>& s
7676
if(std::abs(res-smoothValues[idx]) > 1e-3)
7777
{
7878
std::cout << "idx = " << idx << " -- expected = " << res << " -- result = " << smoothValues[idx] << std::endl;
79-
res = false;
79+
ret = false;
8080
}
8181
}
8282

83-
return res;
83+
return ret;
8484
}
8585

8686
// generate a uniform law over [0,10]

include/boost/compute/algorithm/detail/merge_sort_on_gpu.hpp

+8
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,12 @@ inline size_t bitonic_block_sort(KeyIterator keys_first,
170170
k.decl<bool>("compare") << " = " <<
171171
compare(k.var<key_type>("sibling_key"),
172172
k.var<key_type>("my_key")) << ";\n" <<
173+
k.decl<bool>("equal") << " = !(compare || " <<
174+
compare(k.var<key_type>("my_key"),
175+
k.var<key_type>("sibling_key")) << ");\n" <<
173176
k.decl<bool>("swap") <<
174177
" = compare ^ (sibling_idx < lid) ^ direction;\n" <<
178+
"swap = equal ? false : swap;\n" <<
175179
"my_key = swap ? sibling_key : my_key;\n";
176180
if(sort_by_key)
177181
{
@@ -220,8 +224,12 @@ inline size_t bitonic_block_sort(KeyIterator keys_first,
220224
k.decl<bool>("compare") << " = " <<
221225
compare(k.var<key_type>("sibling_key"),
222226
k.var<key_type>("my_key")) << ";\n" <<
227+
k.decl<bool>("equal") << " = !(compare || " <<
228+
compare(k.var<key_type>("my_key"),
229+
k.var<key_type>("sibling_key")) << ");\n" <<
223230
k.decl<bool>("swap") <<
224231
" = compare ^ (sibling_idx < lid);\n" <<
232+
"swap = equal ? false : swap;\n" <<
225233
"my_key = swap ? sibling_key : my_key;\n";
226234
if(sort_by_key)
227235
{

include/boost/compute/cl.hpp

+1-17
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,7 @@
1111
#ifndef BOOST_COMPUTE_CL_HPP
1212
#define BOOST_COMPUTE_CL_HPP
1313

14-
#if defined(BOOST_COMPUTE_MAX_CL_VERSION)
15-
# if !defined(CL_USE_DEPRECATED_OPENCL_2_1_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 202
16-
# define CL_USE_DEPRECATED_OPENCL_2_1_APIS
17-
# endif
18-
# if !defined(CL_USE_DEPRECATED_OPENCL_2_0_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 201
19-
# define CL_USE_DEPRECATED_OPENCL_2_0_APIS
20-
# endif
21-
# if !defined(CL_USE_DEPRECATED_OPENCL_1_2_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 200
22-
# define CL_USE_DEPRECATED_OPENCL_1_2_APIS
23-
# endif
24-
# if !defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 102
25-
# define CL_USE_DEPRECATED_OPENCL_1_1_APIS
26-
# endif
27-
# if !defined(CL_USE_DEPRECATED_OPENCL_1_0_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 101
28-
# define CL_USE_DEPRECATED_OPENCL_1_0_APIS
29-
# endif
30-
#endif
14+
#include <boost/compute/detail/cl_versions.hpp>
3115

3216
#if defined(__APPLE__)
3317
#include <OpenCL/cl.h>

include/boost/compute/cl_ext.hpp

+1-17
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,7 @@
1111
#ifndef BOOST_COMPUTE_CL_EXT_HPP
1212
#define BOOST_COMPUTE_CL_EXT_HPP
1313

14-
#if defined(BOOST_COMPUTE_MAX_CL_VERSION)
15-
# if !defined(CL_USE_DEPRECATED_OPENCL_2_1_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 202
16-
# define CL_USE_DEPRECATED_OPENCL_2_1_APIS
17-
# endif
18-
# if !defined(CL_USE_DEPRECATED_OPENCL_2_0_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 201
19-
# define CL_USE_DEPRECATED_OPENCL_2_0_APIS
20-
# endif
21-
# if !defined(CL_USE_DEPRECATED_OPENCL_1_2_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 200
22-
# define CL_USE_DEPRECATED_OPENCL_1_2_APIS
23-
# endif
24-
# if !defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 102
25-
# define CL_USE_DEPRECATED_OPENCL_1_1_APIS
26-
# endif
27-
# if !defined(CL_USE_DEPRECATED_OPENCL_1_0_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 101
28-
# define CL_USE_DEPRECATED_OPENCL_1_0_APIS
29-
# endif
30-
#endif
14+
#include "detail/cl_versions.hpp"
3115

3216
#if defined(__APPLE__)
3317
#include <OpenCL/cl_ext.h>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
//---------------------------------------------------------------------------//
2+
// Copyright (c) 2018 Jakub Szuppe <[email protected]>
3+
//
4+
// Distributed under the Boost Software License, Version 1.0
5+
// See accompanying file LICENSE_1_0.txt or copy at
6+
// http://www.boost.org/LICENSE_1_0.txt
7+
//
8+
// See http://boostorg.github.com/compute for more information.
9+
//---------------------------------------------------------------------------//
10+
11+
#ifndef BOOST_COMPUTE_DETAIL_CL_VERSION_HPP
12+
#define BOOST_COMPUTE_DETAIL_CL_VERSION_HPP
13+
14+
#if defined(BOOST_COMPUTE_MAX_CL_VERSION)
15+
# if !defined(CL_USE_DEPRECATED_OPENCL_2_1_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 202
16+
# define CL_USE_DEPRECATED_OPENCL_2_1_APIS
17+
# endif
18+
# if !defined(CL_USE_DEPRECATED_OPENCL_2_0_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 201
19+
# define CL_USE_DEPRECATED_OPENCL_2_0_APIS
20+
# endif
21+
# if !defined(CL_USE_DEPRECATED_OPENCL_1_2_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 200
22+
# define CL_USE_DEPRECATED_OPENCL_1_2_APIS
23+
# endif
24+
# if !defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 102
25+
# define CL_USE_DEPRECATED_OPENCL_1_1_APIS
26+
# endif
27+
# if !defined(CL_USE_DEPRECATED_OPENCL_1_0_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 101
28+
# define CL_USE_DEPRECATED_OPENCL_1_0_APIS
29+
# endif
30+
#endif
31+
32+
#if defined(BOOST_COMPUTE_MAX_CL_VERSION) && !defined(CL_TARGET_OPENCL_VERSION)
33+
# if BOOST_COMPUTE_MAX_CL_VERSION == 201
34+
# define CL_TARGET_OPENCL_VERSION 210
35+
# elif BOOST_COMPUTE_MAX_CL_VERSION == 200
36+
# define CL_TARGET_OPENCL_VERSION 200
37+
# elif BOOST_COMPUTE_MAX_CL_VERSION == 102
38+
# define CL_TARGET_OPENCL_VERSION 120
39+
# elif BOOST_COMPUTE_MAX_CL_VERSION == 101
40+
# define CL_TARGET_OPENCL_VERSION 110
41+
# elif BOOST_COMPUTE_MAX_CL_VERSION == 100
42+
# define CL_TARGET_OPENCL_VERSION 100
43+
# else
44+
# define CL_TARGET_OPENCL_VERSION 220
45+
# endif
46+
#endif
47+
48+
#if defined(BOOST_COMPUTE_MAX_CL_VERSION) && defined(CL_TARGET_OPENCL_VERSION)
49+
# if BOOST_COMPUTE_MAX_CL_VERSION == 202 && CL_TARGET_OPENCL_VERSION != 220
50+
# error "Boost.Compute: CL_TARGET_OPENCL_VERSION definition does not match BOOST_COMPUTE_MAX_CL_VERSION"
51+
# elif BOOST_COMPUTE_MAX_CL_VERSION == 201 && CL_TARGET_OPENCL_VERSION != 210
52+
# error "Boost.Compute: CL_TARGET_OPENCL_VERSION definition does not match BOOST_COMPUTE_MAX_CL_VERSION"
53+
# elif BOOST_COMPUTE_MAX_CL_VERSION == 200 && CL_TARGET_OPENCL_VERSION != 200
54+
# error "Boost.Compute: CL_TARGET_OPENCL_VERSION definition does not match BOOST_COMPUTE_MAX_CL_VERSION"
55+
# elif BOOST_COMPUTE_MAX_CL_VERSION == 102 && CL_TARGET_OPENCL_VERSION != 120
56+
# error "Boost.Compute: CL_TARGET_OPENCL_VERSION definition does not match BOOST_COMPUTE_MAX_CL_VERSION"
57+
# elif BOOST_COMPUTE_MAX_CL_VERSION == 101 && CL_TARGET_OPENCL_VERSION != 110
58+
# error "Boost.Compute: CL_TARGET_OPENCL_VERSION definition does not match BOOST_COMPUTE_MAX_CL_VERSION"
59+
# elif BOOST_COMPUTE_MAX_CL_VERSION == 100 && CL_TARGET_OPENCL_VERSION != 100
60+
# error "Boost.Compute: CL_TARGET_OPENCL_VERSION definition does not match BOOST_COMPUTE_MAX_CL_VERSION"
61+
# endif
62+
#endif
63+
64+
#endif // BOOST_COMPUTE_DETAIL_CL_VERSION_HPP

include/boost/compute/detail/nvidia_compute_capability.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313

1414
#include <boost/compute/device.hpp>
1515

16-
#ifdef BOOST_COMPUTE_HAVE_HDR_CL_EXT
16+
#ifdef BOOST_COMPUTE_HAVE_HDR_CL_EXT
17+
#include <boost/compute/detail/cl_versions.hpp>
1718
#include <CL/cl_ext.h>
1819
#endif
1920

include/boost/compute/interop/opengl/cl_gl.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#ifndef BOOST_COMPUTE_INTEROP_OPENGL_CL_GL_HPP
1212
#define BOOST_COMPUTE_INTEROP_OPENGL_CL_GL_HPP
1313

14+
#include <boost/compute/detail/cl_versions.hpp>
15+
1416
#if defined(__APPLE__)
1517
#include <OpenCL/cl_gl.h>
1618
#else

include/boost/compute/interop/opengl/cl_gl_ext.hpp

+1-17
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,7 @@
1111
#ifndef BOOST_COMPUTE_INTEROP_OPENGL_CL_GL_EXT_HPP
1212
#define BOOST_COMPUTE_INTEROP_OPENGL_CL_GL_EXT_HPP
1313

14-
#if defined(BOOST_COMPUTE_MAX_CL_VERSION)
15-
# if !defined(CL_USE_DEPRECATED_OPENCL_2_1_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 202
16-
# define CL_USE_DEPRECATED_OPENCL_2_1_APIS
17-
# endif
18-
# if !defined(CL_USE_DEPRECATED_OPENCL_2_0_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 201
19-
# define CL_USE_DEPRECATED_OPENCL_2_0_APIS
20-
# endif
21-
# if !defined(CL_USE_DEPRECATED_OPENCL_1_2_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 200
22-
# define CL_USE_DEPRECATED_OPENCL_1_2_APIS
23-
# endif
24-
# if !defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 102
25-
# define CL_USE_DEPRECATED_OPENCL_1_1_APIS
26-
# endif
27-
# if !defined(CL_USE_DEPRECATED_OPENCL_1_0_APIS) && BOOST_COMPUTE_MAX_CL_VERSION < 101
28-
# define CL_USE_DEPRECATED_OPENCL_1_0_APIS
29-
# endif
30-
#endif
14+
#include <boost/compute/detail/cl_versions.hpp>
3115

3216
#if defined(__APPLE__)
3317
#include <OpenCL/cl_gl_ext.h>

test/test_sort.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ BOOST_AUTO_TEST_CASE(sort_int2)
340340
host[size/4] = int2_(20.f, 0.f);
341341
host[(size*3)/4] = int2_(9.f, 0.f);
342342
host[size-3] = int2_(-10.0f, 0.f);
343+
host[size/2+1] = int2_(-10.0f, -1.f);
343344

344345
boost::compute::vector<int2_> vector(size, context);
345346
boost::compute::copy(host.begin(), host.end(), vector.begin(), queue);
@@ -356,9 +357,11 @@ BOOST_AUTO_TEST_CASE(sort_int2)
356357
);
357358
boost::compute::copy(vector.begin(), vector.end(), host.begin(), queue);
358359
BOOST_CHECK_CLOSE(host[0][0], -10.f, 0.1);
360+
BOOST_CHECK_CLOSE(host[1][0], -10.f, 0.1);
359361
BOOST_CHECK_CLOSE(host[(size - 3)][0], 9.f, 0.1);
360362
BOOST_CHECK_CLOSE(host[(size - 2)][0], 20.f, 0.1);
361363
BOOST_CHECK_CLOSE(host[(size - 1)][0], 100.f, 0.1);
364+
BOOST_CHECK_NE(host[0], host[1]);
362365
}
363366

364367
BOOST_AUTO_TEST_SUITE_END()

0 commit comments

Comments
 (0)