update boost on linux

This commit is contained in:
Bassem Girgis
2019-08-10 16:06:25 -05:00
parent 76ad52be58
commit 861b918727
5363 changed files with 483306 additions and 116507 deletions

View File

@@ -124,7 +124,9 @@ public:
const context &context = m_buffer.get_context();
command_queue queue(context, context.get_device());
detail::write_single_value<T>(value, m_buffer, m_index / sizeof(T), queue);
detail::write_single_value<T>(
value, m_buffer, m_index / sizeof(T), queue
).wait();
return *this;
}

View File

@@ -0,0 +1,64 @@
//---------------------------------------------------------------------------//
// Copyright (c) 2018 Jakub Szuppe <j.szuppe@gmail.com>
//
// 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

View File

@@ -17,7 +17,9 @@
#include <chrono>
#endif
#ifndef BOOST_COMPUTE_NO_BOOST_CHRONO
#include <boost/chrono/duration.hpp>
#endif
namespace boost {
namespace compute {
@@ -34,6 +36,7 @@ make_duration_from_nanoseconds(std::chrono::duration<Rep, Period>, size_t nanose
}
#endif // BOOST_COMPUTE_NO_HDR_CHRONO
#ifndef BOOST_COMPUTE_NO_BOOST_CHRONO
template<class Rep, class Period>
inline boost::chrono::duration<Rep, Period>
make_duration_from_nanoseconds(boost::chrono::duration<Rep, Period>, size_t nanoseconds)
@@ -42,6 +45,7 @@ make_duration_from_nanoseconds(boost::chrono::duration<Rep, Period>, size_t nano
boost::chrono::nanoseconds(nanoseconds)
);
}
#endif // BOOST_COMPUTE_NO_BOOST_CHRONO
} // end detail namespace
} // end compute namespace

View File

@@ -36,6 +36,16 @@ struct bound_info_function
{
}
template<class Info>
cl_int operator()(Info info, size_t input_size, const void *input,
size_t size, void *value, size_t *size_ret) const
{
return m_function(
m_object, m_aux_info, info,
input_size, input, size, value, size_ret
);
}
template<class Info>
cl_int operator()(Info info, size_t size, void *value, size_t *size_ret) const
{
@@ -96,6 +106,20 @@ struct get_object_info_impl
return value;
}
template<class Function, class Info>
T operator()(Function function, Info info,
const size_t input_size, const void* input) const
{
T value;
cl_int ret = function(info, input_size, input, sizeof(T), &value, 0);
if(ret != CL_SUCCESS){
BOOST_THROW_EXCEPTION(opencl_error(ret));
}
return value;
}
};
// specialization for bool
@@ -159,6 +183,8 @@ struct get_object_info_impl<std::vector<T> >
BOOST_THROW_EXCEPTION(opencl_error(ret));
}
if(size == 0) return std::vector<T>();
std::vector<T> vector(size / sizeof(T));
ret = function(info, size, &vector[0], 0);
if(ret != CL_SUCCESS){
@@ -167,6 +193,42 @@ struct get_object_info_impl<std::vector<T> >
return vector;
}
template<class Function, class Info>
std::vector<T> operator()(Function function, Info info,
const size_t input_size, const void* input) const
{
#ifdef BOOST_COMPUTE_CL_VERSION_2_1
// For CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT in clGetKernelSubGroupInfo
// we can't get param_value_size using param_value_size_ret
if(info == CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT)
{
std::vector<T> vector(3);
cl_int ret = function(
info, input_size, input,
sizeof(T) * vector.size(), &vector[0], 0
);
if(ret != CL_SUCCESS){
BOOST_THROW_EXCEPTION(opencl_error(ret));
}
return vector;
}
#endif
size_t size = 0;
cl_int ret = function(info, input_size, input, 0, 0, &size);
if(ret != CL_SUCCESS){
BOOST_THROW_EXCEPTION(opencl_error(ret));
}
std::vector<T> vector(size / sizeof(T));
ret = function(info, input_size, input, size, &vector[0], 0);
if(ret != CL_SUCCESS){
BOOST_THROW_EXCEPTION(opencl_error(ret));
}
return vector;
}
};
// returns the value (of type T) from the given clGet*Info() function call.
@@ -182,6 +244,12 @@ inline T get_object_info(Function f, Object o, Info i, AuxInfo j)
return get_object_info_impl<T>()(bind_info_function(f, o, j), i);
}
template<class T, class Function, class Object, class Info, class AuxInfo>
inline T get_object_info(Function f, Object o, Info i, AuxInfo j, const size_t k, const void * l)
{
return get_object_info_impl<T>()(bind_info_function(f, o, j), i, k, l);
}
// returns the value type for the clGet*Info() call on Object with Enum.
template<class Object, int Enum>
struct get_object_info_type;

View File

@@ -665,7 +665,8 @@ public:
event exec_1d(command_queue &queue,
size_t global_work_offset,
size_t global_work_size)
size_t global_work_size,
const wait_list &events = wait_list())
{
const context &context = queue.get_context();
@@ -675,14 +676,16 @@ public:
kernel,
global_work_offset,
global_work_size,
0
0,
events
);
}
event exec_1d(command_queue &queue,
size_t global_work_offset,
size_t global_work_size,
size_t local_work_size)
size_t local_work_size,
const wait_list &events = wait_list())
{
const context &context = queue.get_context();
@@ -692,7 +695,8 @@ public:
kernel,
global_work_offset,
global_work_size,
local_work_size
local_work_size,
events
);
}
@@ -1036,7 +1040,7 @@ inline meta_kernel& operator<<(meta_kernel &kernel,
}
// SVM requires OpenCL 2.0
#if defined(CL_VERSION_2_0) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED)
#if defined(BOOST_COMPUTE_CL_VERSION_2_0) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED)
template<class T, class IndexExpr>
inline meta_kernel& operator<<(meta_kernel &kernel,
const svm_ptr_index_expr<T, IndexExpr> &expr)
@@ -1072,7 +1076,7 @@ inline meta_kernel& operator<<(meta_kernel &kernel,
BOOST_STATIC_ASSERT(N < 16);
if(N < 10){
return kernel << expr.m_arg << ".s" << uint_(N);
return kernel << expr.m_arg << ".s" << int_(N);
}
else if(N < 16){
#ifdef _MSC_VER

View File

@@ -13,7 +13,8 @@
#include <boost/compute/device.hpp>
#ifdef BOOST_COMPUTE_HAVE_HDR_CL_EXT
#ifdef BOOST_COMPUTE_HAVE_HDR_CL_EXT
#include <boost/compute/detail/cl_versions.hpp>
#include <CL/cl_ext.h>
#endif

View File

@@ -24,6 +24,7 @@
#include <boost/compute/version.hpp>
#ifdef BOOST_COMPUTE_USE_OFFLINE_CACHE
#include <cstdio>
#include <boost/algorithm/string/trim.hpp>
#include <boost/compute/detail/path.hpp>
#include <boost/property_tree/ptree.hpp>
@@ -117,9 +118,16 @@ private:
static std::string version_string()
{
char buf[32];
std::snprintf(buf, sizeof(buf), "%d.%d.%d", BOOST_COMPUTE_VERSION_MAJOR,
BOOST_COMPUTE_VERSION_MINOR,
BOOST_COMPUTE_VERSION_PATCH);
// snprintf is in Visual Studio since Visual Studio 2015 (_MSC_VER == 1900)
#if defined (_MSC_VER) && _MSC_VER < 1900
#define DETAIL_SNPRINTF sprintf_s
#else
#define DETAIL_SNPRINTF std::snprintf
#endif
DETAIL_SNPRINTF(buf, sizeof(buf), "%d.%d.%d", BOOST_COMPUTE_VERSION_MAJOR,
BOOST_COMPUTE_VERSION_MINOR,
BOOST_COMPUTE_VERSION_PATCH);
#undef DETAIL_SNPRINTF
return buf;
}

View File

@@ -30,7 +30,7 @@ static const std::string& path_delim()
// Path to appdata folder.
inline const std::string& appdata_path()
{
#ifdef WIN32
#ifdef _WIN32
static const std::string appdata = detail::getenv("APPDATA")
+ path_delim() + "boost_compute";
#else

View File

@@ -14,6 +14,7 @@
#include <boost/throw_exception.hpp>
#include <boost/compute/buffer.hpp>
#include <boost/compute/event.hpp>
#include <boost/compute/exception.hpp>
#include <boost/compute/command_queue.hpp>
@@ -47,18 +48,18 @@ inline T read_single_value(const buffer &buffer, command_queue &queue)
// writes a single value at index to the buffer
template<class T>
inline void write_single_value(const T &value,
const buffer &buffer,
size_t index,
command_queue &queue)
inline event write_single_value(const T &value,
const buffer &buffer,
size_t index,
command_queue &queue)
{
BOOST_ASSERT(index < buffer.size() / sizeof(T));
BOOST_ASSERT(buffer.get_context() == queue.get_context());
queue.enqueue_write_buffer(buffer,
index * sizeof(T),
sizeof(T),
&value);
return queue.enqueue_write_buffer(buffer,
index * sizeof(T),
sizeof(T),
&value);
}
// writes value to the first location in buffer

View File

@@ -13,7 +13,12 @@
#include <sstream>
#include <iomanip>
#include <boost/uuid/sha1.hpp>
#include <boost/version.hpp>
#if BOOST_VERSION >= 106600
# include <boost/uuid/detail/sha1.hpp>
#else
# include <boost/uuid/sha1.hpp>
#endif
namespace boost {
namespace compute {