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

@@ -12,6 +12,7 @@
#define BOOST_COMPUTE_CONTAINER_DETAIL_SCALAR_HPP
#include <boost/compute/buffer.hpp>
#include <boost/compute/event.hpp>
#include <boost/compute/detail/read_write_single_value.hpp>
namespace boost {
@@ -40,9 +41,9 @@ public:
return read_single_value<T>(m_buffer, 0, queue);
}
void write(const T &value, command_queue &queue)
event write(const T &value, command_queue &queue)
{
write_single_value<T>(value, m_buffer, 0, queue);
return write_single_value<T>(value, m_buffer, 0, queue);
}
const buffer& get_buffer() const

View File

@@ -67,6 +67,7 @@ public:
valarray(const valarray<T> &other)
: m_buffer(other.m_buffer.get_context(), other.size() * sizeof(T))
{
copy(other.begin(), other.end(), begin());
}
valarray(const std::valarray<T> &valarray,

View File

@@ -293,8 +293,8 @@ public:
/// Move-assigns the data from \p other to \c *this.
vector& operator=(vector&& other)
{
if(m_size){
m_allocator.deallocate(m_data, m_size);
if(capacity() > 0){
m_allocator.deallocate(m_data, capacity());
}
m_data = std::move(other.m_data);
@@ -310,8 +310,8 @@ public:
/// Destroys the vector object.
~vector()
{
if(m_size){
m_allocator.deallocate(m_data, m_size);
if(capacity() > 0){
m_allocator.deallocate(m_data, capacity());
}
}
@@ -401,11 +401,14 @@ public:
)
);
// copy old values to the new buffer
::boost::compute::copy(m_data, m_data + m_size, new_data, queue);
if(capacity() > 0)
{
// copy old values to the new buffer
::boost::compute::copy(m_data, m_data + m_size, new_data, queue);
// free old memory
m_allocator.deallocate(m_data, m_size);
// free old memory
m_allocator.deallocate(m_data, capacity());
}
// set new data and size
m_data = new_data;
@@ -430,13 +433,39 @@ public:
/// Returns the capacity of the vector.
size_type capacity() const
{
if(m_data == pointer()) // null pointer check
{
return 0;
}
return m_data.get_buffer().size() / sizeof(T);
}
void reserve(size_type size, command_queue &queue)
{
(void) size;
(void) queue;
if(size > max_size()){
throw std::length_error("vector::reserve");
}
if(capacity() < size){
// allocate new buffer
pointer new_data =
m_allocator.allocate(
static_cast<size_type>(
static_cast<float>(size) * _growth_factor()
)
);
if(capacity() > 0)
{
// copy old values to the new buffer
::boost::compute::copy(m_data, m_data + m_size, new_data, queue);
// free old memory
m_allocator.deallocate(m_data, capacity());
}
// set new data
m_data = new_data;
}
}
void reserve(size_type size)
@@ -448,7 +477,22 @@ public:
void shrink_to_fit(command_queue &queue)
{
(void) queue;
pointer old_data = m_data;
m_data = pointer(); // null pointer
if(m_size > 0)
{
// allocate new buffer
m_data = m_allocator.allocate(m_size);
// copy old values to the new buffer
::boost::compute::copy(old_data, old_data + m_size, m_data, queue);
}
if(capacity() > 0)
{
// free old memory
m_allocator.deallocate(old_data, capacity());
}
}
void shrink_to_fit()