-
Notifications
You must be signed in to change notification settings - Fork 338
OSX #610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OSX #610
Conversation
Not every device allows for local work group size to be greater than [1;1;1].
Tests for inplace_reduce, radix_sort and radix_sort_by_key are disabled for CPU devices on Apple platform because for CPU devices on Apple platform when local memory is used in a kernel, local work group size must be [1;1;1]. Those algorithms are designed for GPU devices, therefore we do no lose any functionality.
This commit adds asserts that check if used template type is correct (is integral, is a floating point type).
From tests on Travis-CI it seems that on Apple OpenCL platform clCreatBuffer() does not return NULL and does not set error to CL_INVALID_BUFFER_SIZE when size of the buffer memory object is greater than CL_DEVICE_MAX_MEM_ALLOC_SIZE.
: m_n(std::distance(first, last)), | ||
m_probabilities(std::distance(first, last)) | ||
: m_n((std::max)(size_t(1), static_cast<size_t>(std::distance(first, last)))), | ||
m_probabilities((std::max)(size_t(1), static_cast<size_t>(std::distance(first, last)))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we still need to handle the case where first == last
better. Looking at the documentation for std::discrete_distribution, when the input range is empty (or calling the default constructor), we should just initialize with a single probability of 1
. But this is currently not implemented, and we don't have to do it in this pull request. I'll open a separate bug for this.
Thanks for all the fixes! |
This PR resolves issues with Boost.Compute running on OSX.
Tests for
detail::inplace_reduce
,radix_sort
,radix_sort_by_key
and matrix transpose example are disabled for CPU devices on Apple platform because for CPU devices on Apple platform when local memory is used in a kernel local work group size must be [1;1;1]. Those algorithms and matrix example are designed for GPUs, so from practical perspective we do not lose any functionality.I've also fixed
boost::compute::discrete_distribution
constructor. There was a read from uninitialized memorym_probabilities[i-1]
(withi = 0
).I've found out that there's a bug in
clCreateBuffer()
on Apple platform.clCreatBuffer()
does not returnNULL
and does not set error toCL_INVALID_BUFFER_SIZE
when size of the buffer memory object is greater thanCL_DEVICE_MAX_MEM_ALLOC_SIZE
. You can see bug example here - 42949672960 is the size of allocated memory whereCL_DEVICE_MAX_MEM_ALLOC_SIZE
is only 1073741824 bytes.After this PR, Travis-CI OSX build is not allowed to fail.