summaryrefslogtreecommitdiff
path: root/boost/compute/detail
diff options
context:
space:
mode:
Diffstat (limited to 'boost/compute/detail')
-rw-r--r--boost/compute/detail/buffer_value.hpp4
-rw-r--r--boost/compute/detail/duration.hpp4
-rw-r--r--boost/compute/detail/meta_kernel.hpp4
-rw-r--r--boost/compute/detail/parameter_cache.hpp14
-rw-r--r--boost/compute/detail/path.hpp2
-rw-r--r--boost/compute/detail/read_write_single_value.hpp17
6 files changed, 30 insertions, 15 deletions
diff --git a/boost/compute/detail/buffer_value.hpp b/boost/compute/detail/buffer_value.hpp
index 6a4e78fc19..478fc03252 100644
--- a/boost/compute/detail/buffer_value.hpp
+++ b/boost/compute/detail/buffer_value.hpp
@@ -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;
}
diff --git a/boost/compute/detail/duration.hpp b/boost/compute/detail/duration.hpp
index 601f12d291..98e825fb3c 100644
--- a/boost/compute/detail/duration.hpp
+++ b/boost/compute/detail/duration.hpp
@@ -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
diff --git a/boost/compute/detail/meta_kernel.hpp b/boost/compute/detail/meta_kernel.hpp
index 5e6d6e0337..13af7cc437 100644
--- a/boost/compute/detail/meta_kernel.hpp
+++ b/boost/compute/detail/meta_kernel.hpp
@@ -1036,7 +1036,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 +1072,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
diff --git a/boost/compute/detail/parameter_cache.hpp b/boost/compute/detail/parameter_cache.hpp
index 0a16cd9b0e..c609490c1e 100644
--- a/boost/compute/detail/parameter_cache.hpp
+++ b/boost/compute/detail/parameter_cache.hpp
@@ -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;
}
diff --git a/boost/compute/detail/path.hpp b/boost/compute/detail/path.hpp
index ec8760eaf9..d9c5afd182 100644
--- a/boost/compute/detail/path.hpp
+++ b/boost/compute/detail/path.hpp
@@ -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
diff --git a/boost/compute/detail/read_write_single_value.hpp b/boost/compute/detail/read_write_single_value.hpp
index fde40d946c..3e613bc8c3 100644
--- a/boost/compute/detail/read_write_single_value.hpp
+++ b/boost/compute/detail/read_write_single_value.hpp
@@ -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