Header Reference
TInputIteratorfirst element in the input range InputIteratorlast element in the input range Tinitial value BinaryFunctionbinary reduction function command_queue &system::default_queue()command queue to perform the operationTInputIteratorInputIteratorTcommand_queue &system::default_queue()Returns the result of applying function to the elements in the range [first, last) and init.If no function is specified, plus will be used. In specific situations the call to accumulate() can be automatically optimized to a call to the more efficient reduce() algorithm. This occurs when the binary reduction function is recognized as associative (such as the plus<int> function).Note that because floating-point addition is not associative, calling accumulate() with plus<float> results in a less efficient serial reduction algorithm being executed. If a slight loss in precision is acceptable, the more efficient parallel reduce() algorithm should be used instead.For example: // with vec = boost::compute::vector<int> accumulate(vec.begin(), vec.end(), 0, plus<int>()); // fast reduce(vec.begin(), vec.end(), &result, plus<int>()); // fast // with vec = boost::compute::vector<float> accumulate(vec.begin(), vec.end(), 0, plus<float>()); // slow reduce(vec.begin(), vec.end(), &result, plus<float>()); // fast Space complexity: \Omega(1) Space complexity when optimized to reduce(): \Omega(n)See Also:reduce() the accumulated result value
OutputIteratorInputIteratorfirst element in the input range InputIteratorlast element in the input range OutputIteratorfirst element in the output range BinaryFunctionbinary difference function command_queue &system::default_queue()command queue to perform the operationOutputIteratorInputIteratorInputIteratorOutputIteratorcommand_queue &system::default_queue()Stores the difference of each pair of consecutive values in the range [first, last) to the range beginning at result. If op is not provided, minus<T> is used. Space complexity: \Omega(1) Space complexity when result == first: \Omega(n)See Also:adjacent_find() OutputIterator to the end of the result range
InputIteratorInputIteratorfirst element in the range to search InputIteratorlast element in the range to search Comparebinary comparison function command_queue &system::default_queue()command queue to perform the operationInputIteratorInputIteratorInputIteratorcommand_queue &system::default_queue()Searches the range [first, last) for two identical adjacent elements and returns an iterator pointing to the first. Space complexity: \Omega(1)See Also:find(), adjacent_difference() InputIteratorm to the first element which compares equal to the following element. If none are equal, returns last.
boolInputIteratorInputIteratorUnaryPredicatecommand_queue &system::default_queue()Returns true if predicate returns true for all of the elements in the range [first, last).Space complexity: \Omega(1)See Also:any_of(), none_of()
boolInputIteratorInputIteratorUnaryPredicatecommand_queue &system::default_queue()Returns true if predicate returns true for any of the elements in the range [first, last).For example, to test if a vector contains any negative values: Space complexity: \Omega(1)See Also:all_of(), none_of()
boolInputIteratorInputIteratorconst T &command_queue &system::default_queue()Returns true if value is in the sorted range [first, last).Space complexity: \Omega(1)
OutputIteratorInputIteratorfirst element in the range to copy InputIteratorlast element in the range to copy OutputIteratorfirst element in the result range command_queue &system::default_queue()command queue to perform the operationconst wait_list &wait_list()Copies the values in the range [first, last) to the range beginning at result.The generic copy() function can be used for a variety of data transfer tasks and provides a standard interface to the following OpenCL functions: clEnqueueReadBuffer() clEnqueueWriteBuffer() clEnqueueCopyBuffer() Unlike the aforementioned OpenCL functions, copy() will also work with non-contiguous data-structures (e.g. std::list<T>) as well as with "fancy" iterators (e.g. transform_iterator). For example, to copy an array of int values on the host to a vector on the device: // array on the host int data[] = { 1, 2, 3, 4 }; // vector on the device boost::compute::vector<int> vec(4, context); // copy values to the device vector boost::compute::copy(data, data + 4, vec.begin(), queue); The copy algorithm can also be used with standard containers such as std::vector<T>: std::vector<int> host_vector = ... boost::compute::vector<int> device_vector = ... // copy from the host to the device boost::compute::copy( host_vector.begin(), host_vector.end(), device_vector.begin(), queue ); // copy from the device to the host boost::compute::copy( device_vector.begin(), device_vector.end(), host_vector.begin(), queue ); Space complexity: \Omega(1)See Also:copy_n(), copy_if(), copy_async() OutputIterator to the end of the result range future< OutputIterator >InputIteratorInputIteratorOutputIteratorcommand_queue &system::default_queue()const wait_list &wait_list()Copies the values in the range [first, last) to the range beginning at result. The copy is performed asynchronously.See Also:copy()
OutputIteratorInputIteratorInputIteratorOutputIteratorPredicatecommand_queue &system::default_queue()Copies each element in the range [first, last) for which predicate returns true to the range beginning at result.Space complexity: \Omega(2n)
OutputIteratorInputIteratorSizeOutputIteratorcommand_queue &system::default_queue()const wait_list &wait_list()Copies count elements from first to result.For example, to copy four values from the host to the device: // values on the host and vector on the device float values[4] = { 1.f, 2.f, 3.f, 4.f }; boost::compute::vector<float> vec(4, context); // copy from the host to the device boost::compute::copy_n(values, 4, vec.begin(), queue); Space complexity: \Omega(1)See Also:copy()
size_tInputIteratorInputIteratorconst T &command_queue &system::default_queue()Returns the number of occurrences of value in the range [first, last).Space complexity on CPUs: \Omega(1) Space complexity on GPUs: \Omega(n)See Also:count_if()
size_tInputIteratorInputIteratorPredicatecommand_queue &system::default_queue()Returns the number of elements in the range [first, last) for which predicate returns true.Space complexity on CPUs: \Omega(1) Space complexity on GPUs: \Omega(n)
boolInputIterator1InputIterator1InputIterator2command_queue &system::default_queue()boolInputIterator1InputIterator1InputIterator2InputIterator2command_queue &system::default_queue()Returns true if the range [first1, last1) and the range beginning at first2 are equal.Space complexity: \Omega(1)
std::pair< InputIterator, InputIterator >InputIteratorInputIteratorconst T &command_queue &system::default_queue()Returns a pair of iterators containing the range of values equal to value in the sorted range [first, last).Space complexity: \Omega(1)
OutputIteratorInputIteratorfirst element in the range to scan InputIteratorlast element in the range to scan OutputIteratorfirst element in the result range Tvalue used to initialize the scan sequence BinaryOperatorassociative binary operator command_queue &system::default_queue()command queue to perform the operationOutputIteratorInputIteratorInputIteratorOutputIteratorTcommand_queue &system::default_queue()OutputIteratorInputIteratorInputIteratorOutputIteratorcommand_queue &system::default_queue()Performs an exclusive scan of the elements in the range [first, last) and stores the results in the range beginning at result.Each element in the output is assigned to the sum of all the previous values in the input. The default operation is to add the elements up. But different associative operation can be specified as binary_op instead (e.g., multiplication, maximum, minimum). Also value used to initialized the scan sequence can be specified. Space complexity on GPUs: \Omega(n) Space complexity on GPUs when first == result: \Omega(2n) Space complexity on CPUs: \Omega(1)See Also:inclusive_scan() OutputIterator to the end of the result range
voidBufferIteratorfirst element in the range to fill BufferIteratorlast element in the range to fill const T &value to copy to each element command_queue &system::default_queue()command queue to perform the operationFills the range [first, last) with value. For example, to fill a vector on the device with sevens: // vector on the device boost::compute::vector<int> vec(10, context); // fill vector with sevens boost::compute::fill(vec.begin(), vec.end(), 7, queue); Space complexity: \Omega(1)See Also:boost::compute::fill_n() future< void >BufferIteratorBufferIteratorconst T &command_queue &system::default_queue()
voidBufferIteratorSizeconst T &command_queue &system::default_queue()Fills the range [first, first + count) with value.Space complexity: \Omega(1)See Also:fill()
InputIteratorInputIteratorInputIteratorconst T &command_queue &system::default_queue()Returns an iterator pointing to the first element in the range [first, last) that equals value.Space complexity: \Omega(1)
TextIteratorTextIteratorIterator pointing to start of text TextIteratorIterator pointing to end of text PatternIteratorIterator pointing to start of pattern PatternIteratorIterator pointing to end of pattern command_queue &system::default_queue()Queue on which to executeSubstring matching algorithm. Searches for the last match of the pattern [p_first, p_last) in text [t_first, t_last). Space complexity: \Omega(n) Iterator pointing to beginning of last occurence
InputIteratorInputIteratorInputIteratorUnaryPredicatecommand_queue &system::default_queue()Returns an iterator pointing to the first element in the range [first, last) for which predicate returns true.Space complexity: \Omega(1)
InputIteratorInputIteratorInputIteratorUnaryPredicatecommand_queue &system::default_queue()Returns an iterator pointing to the first element in the range [first, last) for which predicate returns false.Space complexity: \Omega(1)See Also:find_if()
UnaryFunctionInputIteratorInputIteratorUnaryFunctioncommand_queue &system::default_queue()Calls function on each element in the range [first, last).Space complexity: \Omega(1)See Also:transform()
UnaryFunctionInputIteratorSizeUnaryFunctioncommand_queue &system::default_queue()Calls function on each element in the range [first, first + count).Space complexity: \Omega(1)See Also:for_each()
voidMapIteratorMapIteratorInputIteratorOutputIteratorcommand_queue &system::default_queue()Copies the elements using the indices from the range [first, last) to the range beginning at result using the input values from the range beginning at input.Space complexity: \Omega(1)See Also:scatter()
voidOutputIteratorOutputIteratorGeneratorcommand_queue &system::default_queue()Stores the result of generator for each element in the range [first, last).Space complexity: \Omega(1)
voidOutputIteratorSizeGeneratorcommand_queue &system::default_queue()Stores the result of generator for each element in the range [first, first + count).Space complexity: \Omega(1)
boolInputIterator1Iterator pointing to start of first set InputIterator1Iterator pointing to end of first set InputIterator2Iterator pointing to start of second set InputIterator2Iterator pointing to end of second set command_queue &system::default_queue()Queue on which to executeIncludes algorithm. Finds if the sorted range [first1, last1) includes the sorted range [first2, last2). In other words, it checks if [first1, last1) is a superset of [first2, last2). Space complexity: \Omega(distance(first1, last1) + distance(first2, last2)) True, if [first1, last1) includes [first2, last2). False otherwise.
OutputIteratorInputIteratorfirst element in the range to scan InputIteratorlast element in the range to scan OutputIteratorfirst element in the result range BinaryOperatorassociative binary operator command_queue &system::default_queue()command queue to perform the operationOutputIteratorInputIteratorInputIteratorOutputIteratorcommand_queue &system::default_queue()Performs an inclusive scan of the elements in the range [first, last) and stores the results in the range beginning at result.Each element in the output is assigned to the sum of the current value in the input with the sum of every previous value in the input. The default operation is to add the elements up. But different associative operation can be specified as binary_op instead (e.g., multiplication, maximum, minimum). Space complexity on GPUs: \Omega(n) Space complexity on GPUs when first == result: \Omega(2n) Space complexity on CPUs: \Omega(1)See Also:exclusive_scan() OutputIterator to the end of the result range
TInputIterator1InputIterator1InputIterator2Tcommand_queue &system::default_queue()TInputIterator1InputIterator1InputIterator2TBinaryAccumulateFunctionBinaryTransformFunctioncommand_queue &system::default_queue()Returns the inner product of the elements in the range [first1, last1) with the elements in the range beginning at first2.Space complexity: \Omega(1) Space complexity when binary operator is recognized as associative: \Omega(n)
voidIteratorIteratorIteratorcommand_queue &system::default_queue()Merges the sorted values in the range [first, middle) with the sorted values in the range [middle, last) in-place.Space complexity: \Omega(n)
voidBufferIteratorBufferIteratorconst T &command_queue &system::default_queue()Fills the range [first, last) with sequential values starting at value.For example, the following code: Will fill vec with the values (0, 1, 2, ...).Space complexity: \Omega(1)
boolInputIteratorInputIteratorUnaryPredicatecommand_queue &system::default_queue()Returns true if the values in the range [first, last) are partitioned according to predicate.Space complexity: \Omega(1)
boolInputIterator1Iterator pointing to start of first range InputIterator1Iterator pointing to end of first range InputIterator2Iterator pointing to start of second range InputIterator2Iterator pointing to end of second range command_queue &system::default_queue()Queue on which to executePermutation checking algorithm. Checks if the range [first1, last1) can be permuted into the range [first2, last2) Space complexity: \Omega(distance(first1, last1) + distance(first2, last2)) True, if it can be permuted. False, otherwise.
boolInputIteratorfirst element in the range to check InputIteratorlast element in the range to check Comparecomparison function (by default less) command_queue &system::default_queue()command queue to perform the operationboolInputIteratorInputIteratorcommand_queue &system::default_queue()Returns true if the values in the range [first, last) are in sorted order. Space complexity: \Omega(1)See Also:sort() true if the range [first, last) is sorted
boolInputIterator1InputIterator1InputIterator2InputIterator2command_queue &system::default_queue()Checks if the first range [first1, last1) is lexicographically less than the second range [first2, last2).Space complexity: \Omega(max(distance(first1, last1), distance(first2, last2)))
InputIteratorInputIteratorInputIteratorconst T &command_queue &system::default_queue()Returns an iterator pointing to the first element in the sorted range [first, last) that is not less than value.Space complexity: \Omega(1)See Also:upper_bound()
InputIteratorInputIteratorfirst element in the input range InputIteratorlast element in the input range Comparecomparison function object which returns true if the first argument is less than (i.e. is ordered before) the second. command_queue &system::default_queue()command queue to perform the operationInputIteratorInputIteratorInputIteratorcommand_queue &system::default_queue()Returns an iterator pointing to the element in the range [first, last) with the maximum value. For example, to find int2 value with maximum first component in given vector: // comparison function object BOOST_COMPUTE_FUNCTION(bool, compare_first, (const int2_ &a, const int2_ &b), { return a.x < b.x; }); // create vector boost::compute::vector<uint2_> data = ... boost::compute::vector<uint2_>::iterator max = boost::compute::max_element(data.begin(), data.end(), compare_first, queue); Space complexity on CPUs: \Omega(1) Space complexity on GPUs: \Omega(N)See Also:min_element()
OutputIteratorInputIterator1first element in the first range to merge InputIterator1last element in the first range to merge InputIterator2first element in the second range to merge InputIterator2last element in the second range to merge OutputIteratorfirst element in the result range Comparecomparison function (by default less) command_queue &system::default_queue()command queue to perform the operationOutputIteratorInputIterator1InputIterator1InputIterator2InputIterator2OutputIteratorcommand_queue &system::default_queue()Merges the sorted values in the range [first1, last1) with the sorted values in the range [first2, last2) and stores the result in the range beginning at result. Values are compared using the comp function. If no comparision function is given, less is used. Space complexity: \Omega(distance(first1, last1) + distance(first2, last2))See Also:inplace_merge() OutputIterator to the end of the result range
InputIteratorInputIteratorfirst element in the input range InputIteratorlast element in the input range Comparecomparison function object which returns true if the first argument is less than (i.e. is ordered before) the second. command_queue &system::default_queue()command queue to perform the operationInputIteratorInputIteratorInputIteratorcommand_queue &system::default_queue()Returns an iterator pointing to the element in range [first, last) with the minimum value. For example, to find int2 value with minimum first component in given vector: // comparison function object BOOST_COMPUTE_FUNCTION(bool, compare_first, (const int2_ &a, const int2_ &b), { return a.x < b.x; }); // create vector boost::compute::vector<uint2_> data = ... boost::compute::vector<uint2_>::iterator min = boost::compute::min_element(data.begin(), data.end(), compare_first, queue); Space complexity on CPUs: \Omega(1) Space complexity on GPUs: \Omega(N)See Also:max_element()
std::pair< InputIterator, InputIterator >InputIteratorfirst element in the input range InputIteratorlast element in the input range Comparecomparison function object which returns true if the first argument is less than (i.e. is ordered before) the second. command_queue &system::default_queue()command queue to perform the operationstd::pair< InputIterator, InputIterator >InputIteratorInputIteratorcommand_queue &system::default_queue()Returns a pair of iterators with the first pointing to the minimum element and the second pointing to the maximum element in the range [first, last). Space complexity on CPUs: \Omega(1) Space complexity on GPUs: \Omega(N)See Also:max_element(), min_element()
std::pair< InputIterator1, InputIterator2 >InputIterator1InputIterator1InputIterator2command_queue &system::default_queue()std::pair< InputIterator1, InputIterator2 >InputIterator1InputIterator1InputIterator2InputIterator2command_queue &system::default_queue()Returns a pair of iterators pointing to the first position where the range [first1, last1) and the range starting at first2 differ.Space complexity: \Omega(1)
boolInputIteratorIterator pointing to start of range InputIteratorIterator pointing to end of range command_queue &system::default_queue()Queue on which to executePermutation generating algorithm. Transforms the range [first, last) into the next permutation from the set of all permutations arranged in lexicographic order Space complexity: \Omega(1) Boolean value signifying if the last permutation was crossed and the range was reset
boolInputIteratorInputIteratorUnaryPredicatecommand_queue &system::default_queue()Returns true if predicate returns true for none of the elements in the range [first, last).Space complexity: \Omega(1)See Also:all_of(), any_of()
voidIteratorIteratorIteratorComparecommand_queue &system::default_queue()voidIteratorIteratorIteratorcommand_queue &system::default_queue()Rearranges the elements in the range [first, last) such that the nth element would be in that position in a sorted sequence.Space complexity: \Omega(3n)
OutputIteratorInputIteratorInputIteratorOutputIteratorcommand_queue &system::default_queue()Calculates the cumulative sum of the elements in the range [first, last) and writes the resulting values to the range beginning at result.Space complexity on GPUs: \Omega(n) Space complexity on GPUs when first == result: \Omega(2n) Space complexity on CPUs: \Omega(1)
IteratorIteratorIteratorUnaryPredicatecommand_queue &system::default_queue()Partitions the elements in the range [first, last) according to predicate. Order of the elements need not be preserved.Space complexity: \Omega(3n)See Also:is_partitioned() and stable_partition()
std::pair< OutputIterator1, OutputIterator2 >InputIteratorInputIteratorOutputIterator1OutputIterator2UnaryPredicatecommand_queue &system::default_queue()Copies all of the elements in the range [first, last) for which predicate returns true to the range beginning at first_true and all of the elements for which predicate returns false to the range beginning at first_false.Space complexity: \Omega(2n)See Also:partition()
InputIteratorInputIteratorIterator pointing to start of range InputIteratorIterator pointing to end of range UnaryPredicateUnary predicate to be applied on each element command_queue &system::default_queue()Queue on which to executePartition point algorithm. Finds the end of true values in the partitioned range [first, last) Space complexity: \Omega(1)See Also:partition() and stable_partition() Iterator pointing to end of true values
boolInputIteratorIterator pointing to start of range InputIteratorIterator pointing to end of range command_queue &system::default_queue()Queue on which to executePermutation generating algorithm. Transforms the range [first, last) into the previous permutation from the set of all permutations arranged in lexicographic order Space complexity: \Omega(1) Boolean value signifying if the first permutation was crossed and the range was reset
voidIteratorIteratorcommand_queue &system::default_queue()Randomly shuffles the elements in the range [first, last).Space complexity: \Omega(2n)See Also:scatter()
voidInputIteratorfirst element in the input range InputIteratorlast element in the input range OutputIteratoriterator pointing to the output BinaryFunctionbinary reduction function command_queue &system::default_queue()command queue to perform the operationvoidInputIteratorInputIteratorOutputIteratorcommand_queue &system::default_queue()Returns the result of applying function to the elements in the range [first, last).If no function is specified, plus will be used. The reduce() algorithm assumes that the binary reduction function is associative. When used with non-associative functions the result may be non-deterministic and vary in precision. Notably this affects the plus<float>() function as floating-point addition is not associative and may produce slightly different results than a serial algorithm.This algorithm supports both host and device iterators for the result argument. This allows for values to be reduced and copied to the host all with a single function call.For example, to calculate the sum of the values in a device vector and copy the result to a value on the host: Note that while the the reduce() algorithm is conceptually identical to the accumulate() algorithm, its implementation is substantially more efficient on parallel hardware. For more information, see the documentation on the accumulate() algorithm.Space complexity on GPUs: \Omega(n) Space complexity on CPUs: \Omega(1)See Also:accumulate()
std::pair< OutputKeyIterator, OutputValueIterator >InputKeyIteratorthe first key InputKeyIteratorthe last key InputValueIteratorthe first input value OutputKeyIteratoriterator pointing to the key output OutputValueIteratoriterator pointing to the reduced value output BinaryFunctionbinary reduction function BinaryPredicatebinary predicate which returns true only if two keys are equal command_queue &system::default_queue()command queue to perform the operationstd::pair< OutputKeyIterator, OutputValueIterator >InputKeyIteratorInputKeyIteratorInputValueIteratorOutputKeyIteratorOutputValueIteratorBinaryFunctioncommand_queue &system::default_queue()std::pair< OutputKeyIterator, OutputValueIterator >InputKeyIteratorInputKeyIteratorInputValueIteratorOutputKeyIteratorOutputValueIteratorcommand_queue &system::default_queue()The reduce_by_key() algorithm performs reduction for each contiguous subsequence of values determinate by equivalent keys.Returns a pair of iterators at the end of the ranges [keys_result, keys_result_last) and [values_result, values_result_last).If no function is specified, plus will be used. If no predicate is specified, equal_to will be used. The reduce_by_key() algorithm assumes that the binary reduction function is associative. When used with non-associative functions the result may be non-deterministic and vary in precision. Notably this affects the plus<float>() function as floating-point addition is not associative and may produce slightly different results than a serial algorithm.For example, to calculate the sum of the values for each key: Space complexity on GPUs: \Omega(2n) Space complexity on CPUs: \Omega(1)See Also:reduce()
IteratorIteratorIteratorconst T &command_queue &system::default_queue()Removes each element equal to value in the range [first, last).Space complexity: \Omega(3n)See Also:remove_if()
IteratorIteratorIteratorPredicatecommand_queue &system::default_queue()Removes each element for which predicate returns true in the range [first, last).Space complexity: \Omega(3n)See Also:remove()
voidIteratorIteratorconst T &const T &command_queue &system::default_queue()Replaces each instance of old_value in the range [first, last) with new_value.Space complexity: \Omega(1)
OutputIteratorInputIteratorInputIteratorOutputIteratorconst T &const T &command_queue &system::default_queue()Copies the value in the range [first, last) to the range beginning at result while replacing each instance of old_value with new_value.Space complexity: \Omega(1)See Also:replace()
voidIteratorIteratorcommand_queue &system::default_queue()Reverses the elements in the range [first, last).Space complexity: \Omega(1)See Also:reverse_copy()
OutputIteratorInputIteratorInputIteratorOutputIteratorcommand_queue &system::default_queue()Copies the elements in the range [first, last) in reversed order to the range beginning at result.Space complexity: \Omega(1)See Also:reverse()
voidInputIteratorInputIteratorInputIteratorcommand_queue &system::default_queue()Performs left rotation such that element at n_first comes to the beginning.Space complexity: \Omega(distance(first, last))See Also:rotate_copy()
voidInputIteratorInputIteratorInputIteratorOutputIteratorcommand_queue &system::default_queue()Performs left rotation such that element at n_first comes to the beginning and the output is stored in range starting at result.Space complexity: \Omega(1)See Also:rotate()
voidInputIteratorInputIteratorMapIteratorOutputIteratorcommand_queue &system::default_queue()Copies the elements from the range [first, last) to the range beginning at result using the output indices from the range beginning at map.Space complexity: \Omega(1)See Also:gather()
voidInputIteratorInputIteratorMapIteratorStencilIteratorOutputIteratorPredicatecommand_queue &system::default_queue()Copies the elements from the range [first, last) to the range beginning at result using the output indices from the range beginning at map if stencil is resolved to true. By default the predicate is an identitySpace complexity: \Omega(1) voidInputIteratorInputIteratorMapIteratorStencilIteratorOutputIteratorcommand_queue &system::default_queue()
TextIteratorTextIteratorIterator pointing to start of text TextIteratorIterator pointing to end of text PatternIteratorIterator pointing to start of pattern PatternIteratorIterator pointing to end of pattern command_queue &system::default_queue()Queue on which to executeSubstring matching algorithm. Searches for the first match of the pattern [p_first, p_last) in text [t_first, t_last). Space complexity: \Omega(distance(t_first, t_last)) Iterator pointing to beginning of first occurrence
TextIteratorTextIteratorIterator pointing to start of text TextIteratorIterator pointing to end of text size_tNumber of times value repeats ValueTypeValue which repeats command_queue &system::default_queue()Queue on which to executeSubstring matching algorithm. Searches for the first occurrence of n consecutive occurrences of value in text [t_first, t_last). Space complexity: \Omega(distance(t_first, t_last)) Iterator pointing to beginning of first occurrence
OutputIteratorInputIterator1Iterator pointing to start of first set InputIterator1Iterator pointing to end of first set InputIterator2Iterator pointing to start of second set InputIterator2Iterator pointing to end of second set OutputIteratorIterator pointing to start of range in which the difference will be stored command_queue &system::default_queue()Queue on which to executeSet difference algorithm. Finds the difference of the sorted range [first2, last2) from the sorted range [first1, last1) and stores it in range starting at result Space complexity: \Omega(2(distance(first1, last1) + distance(first2, last2))) Iterator pointing to end of difference
OutputIteratorInputIterator1Iterator pointing to start of first set InputIterator1Iterator pointing to end of first set InputIterator2Iterator pointing to start of second set InputIterator2Iterator pointing to end of second set OutputIteratorIterator pointing to start of range in which the intersection will be stored command_queue &system::default_queue()Queue on which to executeSet intersection algorithm. Finds the intersection of the sorted range [first1, last1) with the sorted range [first2, last2) and stores it in range starting at result Space complexity: \Omega(2(distance(first1, last1) + distance(first2, last2))) Iterator pointing to end of intersection
OutputIteratorInputIterator1Iterator pointing to start of first set InputIterator1Iterator pointing to end of first set InputIterator2Iterator pointing to start of second set InputIterator2Iterator pointing to end of second set OutputIteratorIterator pointing to start of range in which the symmetric difference will be stored command_queue &system::default_queue()Queue on which to executeSet symmetric difference algorithm. Finds the symmetric difference of the sorted range [first2, last2) from the sorted range [first1, last1) and stores it in range starting at result Space complexity: \Omega(2(distance(first1, last1) + distance(first2, last2))) Iterator pointing to end of symmetric difference
OutputIteratorInputIterator1Iterator pointing to start of first set InputIterator1Iterator pointing to end of first set InputIterator2Iterator pointing to start of second set InputIterator2Iterator pointing to end of second set OutputIteratorIterator pointing to start of range in which the union will be stored command_queue &system::default_queue()Queue on which to executeSet union algorithm. Finds the union of the sorted range [first1, last1) with the sorted range [first2, last2) and stores it in range starting at result Space complexity: \Omega(2(distance(first1, last1) + distance(first2, last2))) Iterator pointing to end of union
voidIteratorfirst element in the range to sort Iteratorlast element in the range to sort Comparecomparison function (by default less) command_queue &system::default_queue()command queue to perform the operationvoidIteratorIteratorcommand_queue &system::default_queue()Sorts the values in the range [first, last) according to compare. For example, to sort a vector on the device: // create vector on the device with data float data[] = { 2.f, 4.f, 1.f, 3.f }; boost::compute::vector<float> vec(data, data + 4, queue); // sort the vector on the device boost::compute::sort(vec.begin(), vec.end(), queue); The sort() algorithm can also be directly used with host iterators. This example will automatically transfer the data to the device, sort it, and then transfer the data back to the host: std::vector<int> data = { 9, 3, 2, 5, 1, 4, 6, 7 }; boost::compute::sort(data.begin(), data.end(), queue); Space complexity: \Omega(n)See Also:is_sorted()
voidKeyIteratorKeyIteratorValueIteratorComparecommand_queue &system::default_queue()voidKeyIteratorKeyIteratorValueIteratorcommand_queue &system::default_queue()Performs a key-value sort using the keys in the range [keys_first, keys_last) on the values in the range [values_first, values_first + (keys_last - keys_first)) using compare.If no compare function is specified, less is used.Space complexity: \Omega(2n)See Also:sort()
IteratorIteratorIterator pointing to start of range IteratorIterator pointing to end of range UnaryPredicateUnary predicate to be applied on each element command_queue &system::default_queue()Queue on which to executePartitioning algorithm. Partitions the elements in the range [first, last) according to predicate. The order of the elements is preserved. Space complexity: \Omega(3n)See Also:is_partitioned() and partition() Iterator pointing to end of true values
voidIteratorIteratorComparecommand_queue &system::default_queue()voidIteratorIteratorcommand_queue &system::default_queue()Sorts the values in the range [first, last) according to compare. The relative order of identical values is preserved.Space complexity: \Omega(n)See Also:sort(), is_sorted()
voidKeyIteratorKeyIteratorValueIteratorComparecommand_queue &system::default_queue()voidKeyIteratorKeyIteratorValueIteratorcommand_queue &system::default_queue()Performs a key-value stable sort using the keys in the range [keys_first, keys_last) on the values in the range [values_first, values_first + (keys_last - keys_first)) using compare.If no compare function is specified, less is used.Space complexity: \Omega(2n)See Also:sort()
Iterator2Iterator1Iterator1Iterator2command_queue &system::default_queue()Swaps the elements in the range [first1, last1) with the elements in the range beginning at first2.Space complexity: \Omega(distance(first1, last1))
OutputIteratorInputIteratorInputIteratorOutputIteratorUnaryOperatorcommand_queue &system::default_queue()OutputIteratorInputIterator1InputIterator1InputIterator2OutputIteratorBinaryOperatorcommand_queue &system::default_queue()Transforms the elements in the range [first, last) using operator op and stores the results in the range beginning at result.For example, to calculate the absolute value for each element in a vector: Space complexity: \Omega(1)See Also:copy()
OutputIteratorInputIteratorInputIteratorOutputIteratorUnaryFunctionPredicatecommand_queue &system::default_queue()Copies each element in the range [first, last) for which predicate returns true to the range beginning at result.Space complexity: O(2n)
voidInputIteratorInputIteratorOutputIteratorUnaryTransformFunctionBinaryReduceFunctioncommand_queue &system::default_queue()voidInputIterator1InputIterator1InputIterator2OutputIteratorBinaryTransformFunctionBinaryReduceFunctioncommand_queue &system::default_queue()Transforms each value in the range [first, last) with the unary transform_function and then reduces each transformed value with reduce_function.For example, to calculate the sum of the absolute values of a vector of integers: Space complexity on GPUs: \Omega(n) Space complexity on CPUs: \Omega(1)See Also:reduce(), inner_product()
InputIteratorInputIteratorfirst element in the input range InputIteratorlast element in the input range BinaryPredicatebinary operator used to check for uniqueness command_queue &system::default_queue()command queue to perform the operationInputIteratorInputIteratorInputIteratorcommand_queue &system::default_queue()Removes all consecutive duplicate elements (determined by op) from the range [first, last). If op is not provided, the equality operator is used. Space complexity: \Omega(4n)See Also:unique_copy() InputIterator to the new logical end of the range
OutputIteratorInputIteratorfirst element in the input range InputIteratorlast element in the input range OutputIteratorfirst element in the result range BinaryPredicatebinary operator used to check for uniqueness command_queue &system::default_queue()command queue to perform the operationOutputIteratorInputIteratorInputIteratorOutputIteratorcommand_queue &system::default_queue()Makes a copy of the range [first, last) and removes all consecutive duplicate elements (determined by op) from the copy. If op is not provided, the equality operator is used. Space complexity: \Omega(4n)See Also:unique() OutputIterator to the end of the result range
InputIteratorInputIteratorInputIteratorconst T &command_queue &system::default_queue()Returns an iterator pointing to the first element in the sorted range [first, last) that is not less than or equal to value.Space complexity: \Omega(1)
The buffer_allocator class allocates memory with buffer objects. See Also:buffer T unspecified unspecified std::size_t std::ptrdiff_t pointersize_type voidpointersize_type size_type context const context & const buffer_allocator< T > & buffer_allocator< T > &const buffer_allocator< T > & buffer_allocator< T > && buffer_allocator< T > &buffer_allocator< T > && voidcl_mem_flags
boost::compute::buffer_allocator< T > const context & const pinned_allocator< T > & pinned_allocator< T > &const pinned_allocator< T > &
Holds the result of an asynchronous computation. See Also:event, wait_list TReturns the result of the computation. This will block until the result is ready. boolReturns true if the future is valid. voidBlocks until the computation is complete. eventReturns the underlying event object. future &FunctionInvokes a generic callback function once the future is ready.The function specified by callback must be invokable with zero arguments.See the documentation for clSetEventCallback() for more information. This method is only available if the OpenCL version is 1.1 or later. const T &const event & const future< T > & future &const future< T > &
voidEvents &&...Blocks until all events have completed. Events can either be event objects or future<T> objects.See Also:event, wait_list
noncopyableA guard object for synchronizing an operation on the device. The wait_guard class stores a waitable object representing an operation on a compute device (e.g. event, future<T>) and calls its wait() method when the guard object goes out of scope.This is useful for ensuring that an OpenCL operation completes before leaving the current scope and cleaning up any resources.For example: // enqueue a compute kernel for execution event e = queue.enqueue_nd_range_kernel(...); // call e.wait() upon exiting the current scope wait_guard<event> guard(e); wait_list, wait_for_all() const Waitable &Creates a new wait_guard object for waitable. Destroys the wait_guard object. The default implementation will call wait() on the stored waitable object.
A fixed-size container. The array container is very similar to the vector container except its size is fixed at compile-time rather than being dynamically resizable at run-time.For example, to create a fixed-size array with eight values on the device: boost::compute::array<int, 8> values(context); The Boost.Compute array class provides a STL-like API and is modeled after the std::array class from the C++ standard library.See Also:vector<T> = N T std::size_t ptrdiff_t unspecified unspecified T * const T * buffer_iterator< T > buffer_iterator< T > std::reverse_iterator< iterator > std::reverse_iterator< const_iterator > iterator const_iterator const_iterator iterator const_iterator const_iterator reverse_iterator const_reverse_iterator const_reverse_iterator reverse_iterator const_reverse_iterator const_reverse_iterator size_type bool size_type referencesize_type const_referencesize_type referencesize_type const_referencesize_type reference const_reference reference const_reference voidconst value_type &const command_queue & voidarray< T, N > &const command_queue & voidconst value_type & voidarray< T, N > & const buffer & const context &system::default_context() const array< T, N > & const boost::array< T, N > &const context &system::default_context() const array< T, N > &const command_queue & array< T, N > &const array< T, N > & array< T, N > &const boost::array< T, N > & command_queue
A template for a dynamically-sized character sequence. The basic_string class provides a generic template for a dynamically- sized character sequence. This is most commonly used through the string typedef (for basic_string<char>).For example, to create a string on the device with its contents copied from a C-string on the host: boost::compute::string str("hello, world!"); See Also:vector<T> Traits Traits::char_type size_t ::boost::compute::vector< CharT >::reference ::boost::compute::vector< CharT >::const_reference ::boost::compute::vector< CharT >::iterator ::boost::compute::vector< CharT >::const_iterator ::boost::compute::vector< CharT >::reverse_iterator ::boost::compute::vector< CharT >::const_reverse_iterator const size_type referencesize_type const_referencesize_type referencesize_type const_referencesize_type reference const_reference reference const_reference iterator const_iterator const_iterator iterator const_iterator const_iterator reverse_iterator const_reverse_iterator const_reverse_iterator reverse_iterator const_reverse_iterator const_reverse_iterator bool size_type size_type size_type voidsize_type size_type void void voidbasic_string< CharT, Traits > & basic_string< CharT, Traits >size_type0size_typenpos size_typeCharTsize_type0Finds the first character ch. size_typebasic_string &size_type0Finds the first substring equal to str. size_typeconst char *size_type0Finds the first substring equal to the character string pointed to by s. The length of the string is determined by the first null character.For example, the following code will return 5 as position. size_typeCharT const basic_string &size_typesize_typenpos const char *size_type const char * InputIteratorInputIterator const basic_string< CharT, Traits > & basic_string< CharT, Traits > &const basic_string< CharT, Traits > & std::ostream &std::ostream &boost::compute::basic_string< CharT, Traits >const &
The dynamic_bitset class contains a resizable bit array. For example, to create a dynamic-bitset with space for 1000 bits on the device: boost::compute::dynamic_bitset<> bits(1000, queue); The Boost.Compute dynamic_bitset class provides a STL-like API and is modeled after the boost::dynamic_bitset class from Boost.See Also:vector<T> Block Alloc vector< Block, Alloc > container_type::size_type size_typebits_per_blocksizeof(block_type) *CHAR_BIT size_typenposstatic_cast< size_type >(-1) size_typeReturns the size of the dynamic bitset. size_typeReturns the number of blocks to store the bits in the dynamic bitset. size_typeReturns the maximum possible size for the dynamic bitset. boolReturns true if the dynamic bitset is empty (i.e. size() == 0). size_typecommand_queue &Returns the number of set bits (i.e. '1') in the bitset. voidsize_typecommand_queue &Resizes the bitset to contain num_bits. If the new size is greater than the current size the new bits are set to zero. voidsize_typecommand_queue &Sets the bit at position n to true. voidsize_typeboolcommand_queue &Sets the bit at position n to value. boolsize_typecommand_queue &Returns true if the bit at position n is set (i.e. '1'). voidsize_typecommand_queue &Flips the value of the bit at position n. boolcommand_queue &Returns true if any bit in the bitset is set (i.e. '1'). boolcommand_queue &Returns true if all of the bits in the bitset are set to zero. voidcommand_queue &Sets all of the bits in the bitset to zero. voidsize_typecommand_queue &Sets the bit at position n to zero. voidEmpties the bitset (e.g. resize(0)). allocator_typeReturns the allocator used to allocate storage for the bitset. size_typecommand_queue &Creates a new dynamic bitset with storage for size bits. Initializes all bits to zero. const dynamic_bitset &Creates a new dynamic bitset as a copy of other. dynamic_bitset &const dynamic_bitset &Copies the data from other to *this. Destroys the dynamic bitset.
Key T ::boost::compute::vector< std::pair< Key, T > > vector_type::value_type vector_type::size_type vector_type::difference_type vector_type::reference vector_type::const_reference vector_type::pointer vector_type::const_pointer vector_type::iterator vector_type::const_iterator vector_type::reverse_iterator vector_type::const_reverse_iterator iterator const_iterator const_iterator iterator const_iterator const_iterator reverse_iterator const_reverse_iterator const_reverse_iterator reverse_iterator const_reverse_iterator const_reverse_iterator size_type size_type bool size_type voidsize_typecommand_queue & voidsize_type void void std::pair< iterator, bool >const value_type &command_queue & std::pair< iterator, bool >const value_type & iteratorconst const_iterator &command_queue & iteratorconst const_iterator & iteratorconst const_iterator &const const_iterator &command_queue & iteratorconst const_iterator &const const_iterator & size_typeconst key_type &command_queue & iteratorconst key_type &command_queue & iteratorconst key_type & const_iteratorconst key_type &command_queue & const_iteratorconst key_type & size_typeconst key_type &command_queue & size_typeconst key_type & iteratorconst key_type &command_queue & iteratorconst key_type & const_iteratorconst key_type &command_queue & const_iteratorconst key_type & iteratorconst key_type &command_queue & iteratorconst key_type & const_iteratorconst key_type &command_queue & const_iteratorconst key_type & const mapped_typeconst key_type & unspecifiedconst key_type & const context &system::default_context() const flat_map< Key, T > & flat_map< Key, T > &const flat_map< Key, T > &
T vector< T >::value_type vector< T >::size_type vector< T >::difference_type vector< T >::reference vector< T >::const_reference vector< T >::pointer vector< T >::const_pointer vector< T >::iterator vector< T >::const_iterator vector< T >::reverse_iterator vector< T >::const_reverse_iterator iterator const_iterator const_iterator iterator const_iterator const_iterator reverse_iterator const_reverse_iterator const_reverse_iterator reverse_iterator const_reverse_iterator const_reverse_iterator size_type size_type bool size_type voidsize_typecommand_queue & voidsize_type void void std::pair< iterator, bool >const value_type &command_queue & std::pair< iterator, bool >const value_type & iteratorconst const_iterator &command_queue & iteratorconst const_iterator & iteratorconst const_iterator &const const_iterator &command_queue & iteratorconst const_iterator &const const_iterator & size_typeconst key_type &command_queue & size_typeconst key_type & iteratorconst key_type &command_queue & iteratorconst key_type & const_iteratorconst key_type &command_queue & const_iteratorconst key_type & size_typeconst key_type &command_queue & size_typeconst key_type & iteratorconst key_type &command_queue & iteratorconst key_type & const_iteratorconst key_type &command_queue & const_iteratorconst key_type & iteratorconst key_type &command_queue & iteratorconst key_type & const_iteratorconst key_type &command_queue & const_iteratorconst key_type & const context &system::default_context() const flat_set< T > & flat_set< T > &const flat_set< T > &
A mapped view of host memory. The mapped_view class simplifies mapping host-memory to a compute device. This allows for host-allocated memory to be used with the Boost.Compute algorithms.The following example shows how to map a simple C-array containing data on the host to the device and run the reduce() algorithm to calculate the sum: See Also:buffer T size_t ptrdiff_t buffer_iterator< T > buffer_iterator< T > iteratorReturns an iterator to the first element in the mapped_view. const_iteratorReturns a const_iterator to the first element in the mapped_view. const_iteratorReturns a const_iterator to the first element in the mapped_view. iteratorReturns an iterator to one past the last element in the mapped_view. const_iteratorReturns a const_iterator to one past the last element in the mapped_view. const_iteratorReturns a const_iterator to one past the last element in the mapped_view. size_typeReturns the number of elements in the mapped_view. T *Returns the host data pointer. const T *Returns the host data pointer. voidsize_typeResizes the mapped_view to size elements. boolReturns true if the mapped_view is empty. const buffer &Returns the mapped buffer. voidcl_map_flagscommand_queue &Maps the buffer into the host address space.See the documentation for clEnqueueMapBuffer() for more information. voidcommand_queue &Maps the buffer into the host address space for reading and writing.Equivalent to: map(CL_MAP_READ | CL_MAP_WRITE, queue); voidcommand_queue &Unmaps the buffer from the host address space.See the documentation for clEnqueueUnmapMemObject() for more information. Creates a null mapped_view object. T *size_typeconst context &system::default_context()Creates a mapped_view for host_ptr with n elements. After constructing a mapped_view the data is available for use by a compute device. Use the unmap() method to make the updated data available to the host. const T *size_typeconst context &system::default_context()Creates a read-only mapped_view for host_ptr with n elements. After constructing a mapped_view the data is available for use by a compute device. Use the unmap() method to make the updated data available to the host. const mapped_view< T > &Creates a copy of other. mapped_view< T > &const mapped_view< T > &Copies the mapped buffer from other. Destroys the mapped_view object.
vector< T > container_type::size_type container_type::value_type bool size_type value_type voidconst T & void const stack< T > & stack< T > &const stack< T > &
basic_string< char_ >
valarray< T > &const T & valarray< T > &const T & valarray< T > &const T & valarray< T > valarray< T > valarray< T > valarray< char >In OpenCL there cannot be memory buffer with bool type, for this reason return type is valarray<char> instead of valarray<bool>. 1 means true, 0 means false. valarray< T > &const T & valarray< T > &const T & valarray< T > &const T & valarray< T > &const T & valarray< T > &const T & valarray< T > &const T & valarray< T > &const T & valarray< T > &const valarray< T > & valarray< T > &const valarray< T > & valarray< T > &const valarray< T > & valarray< T > &const valarray< T > & valarray< T > &const valarray< T > & valarray< T > &const valarray< T > & valarray< T > &const valarray< T > & valarray< T > &const valarray< T > & valarray< T > &const valarray< T > & valarray< T > &const valarray< T > & size_t voidsize_tTT() unspecifiedsize_t unspecifiedsize_t T() T() T valarray< T >UnaryFunction const buffer & const context &system::default_context() size_tconst context &system::default_context() const T &size_tconst context &system::default_context() const T *size_tconst context &system::default_context() const valarray< T > & const std::valarray< T > &const context &system::default_context() valarray< T > &const valarray< T > & valarray< T > &const std::valarray< T > & buffer_iterator< T > buffer_iterator< T >
A resizable array of values. The vector<T> class stores a dynamic array of values. Internally, the data is stored in an OpenCL buffer object.The vector class is the prefered container for storing and accessing data on a compute device. In most cases it should be used instead of directly dealing with buffer objects. If the undelying buffer is needed, it can be accessed with the get_buffer() method.The internal storage is allocated in a specific OpenCL context which is passed as an argument to the constructor when the vector is created.For example, to create a vector on the device containing space for ten int values: boost::compute::vector<int> vec(10, context); Allocation and data transfer can also be performed in a single step: // values on the host int data[] = { 1, 2, 3, 4 }; // create a vector of size four and copy the values from data boost::compute::vector<int> vec(data, data + 4, queue); The Boost.Compute vector class provides a STL-like API and is modeled after the std::vector class from the C++ standard library. It can be used with any of the STL-like algorithms provided by Boost.Compute including copy(), transform(), and sort() (among many others).For example: // a vector on a compute device boost::compute::vector<float> vec = ... // copy data to the vector from a host std:vector boost::compute::copy(host_vec.begin(), host_vec.end(), vec.begin(), queue); // copy data from the vector to a host std::vector boost::compute::copy(vec.begin(), vec.end(), host_vec.begin(), queue); // sort the values in the vector boost::compute::sort(vec.begin(), vec.end(), queue); // calculate the sum of the values in the vector (also see reduce()) float sum = boost::compute::accumulate(vec.begin(), vec.end(), 0, queue); // reverse the values in the vector boost::compute::reverse(vec.begin(), vec.end(), queue); // fill the vector with ones boost::compute::fill(vec.begin(), vec.end(), 1, queue); See Also:array<T, N>, buffer T Alloc allocator_type::size_type allocator_type::difference_type unspecified unspecified allocator_type::pointer allocator_type::const_pointer buffer_iterator< T > buffer_iterator< T > std::reverse_iterator< iterator > std::reverse_iterator< const_iterator > iterator const_iterator const_iterator iterator const_iterator const_iterator reverse_iterator const_reverse_iterator const_reverse_iterator reverse_iterator const_reverse_iterator const_reverse_iterator size_typeReturns the number of elements in the vector. size_type voidsize_typecommand_queue &Resizes the vector to size. voidsize_typeThis is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. boolReturns true if the vector is empty. size_typeReturns the capacity of the vector. voidsize_typecommand_queue & voidsize_type voidcommand_queue & void referencesize_type const_referencesize_type referencesize_type const_referencesize_type reference const_reference reference const_reference voidInputIteratorInputIteratorcommand_queue & voidInputIteratorInputIterator voidsize_typeconst T &command_queue & voidsize_typeconst T & voidconst T &command_queue &Inserts value at the end of the vector (resizing if neccessary).Note that calling push_back() to insert data values one at a time is inefficient as there is a non-trivial overhead in performing a data transfer to the device. It is usually better to store a set of values on the host (for example, in a std::vector) and then transfer them in bulk using the insert() method or the copy() algorithm. voidconst T &This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. voidcommand_queue & void iteratoriteratorconst T &command_queue & iteratoriteratorconst T & voiditeratorsize_typeconst T &command_queue & voiditeratorsize_typeconst T & voiditeratorInputIteratorInputIteratorcommand_queue &Inserts the values in the range [first, last) into the vector at position using queue. voiditeratorInputIteratorInputIteratorThis is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. iteratoriteratorcommand_queue & iteratoriterator iteratoriteratoriteratorcommand_queue & iteratoriteratoriterator voidvector &Swaps the contents of *this with other. voidRemoves all elements from the vector. allocator_type const buffer &Returns the underlying buffer. const context &system::default_context()Creates an empty vector in context. size_typeconst context &system::default_context()Creates a vector with space for count elements in context.Note that unlike std::vector's constructor, this will not initialize the values in the container. Either call the vector constructor which takes a value to initialize with or use the fill() algorithm to set the initial values.For example: // create a vector on the device with space for ten ints boost::compute::vector<int> vec(10, context); size_typeconst T &command_queue &system::default_queue()Creates a vector with space for count elements and sets each equal to value.For example: // creates a vector with four values set to nine (e.g. [9, 9, 9, 9]). boost::compute::vector<int> vec(4, 9, queue); InputIteratorInputIteratorcommand_queue &system::default_queue()Creates a vector with space for the values in the range [first, last) and copies them into the vector with queue.For example: // values on the host int data[] = { 1, 2, 3, 4 }; // create a vector of size four and copy the values from data boost::compute::vector<int> vec(data, data + 4, queue); const vector &command_queue &system::default_queue()Creates a new vector and copies the values from other. const vector< T, OtherAlloc > &command_queue &system::default_queue()Creates a new vector and copies the values from other. const std::vector< T, OtherAlloc > &command_queue &system::default_queue()Creates a new vector and copies the values from vector. std::initializer_list< T >command_queue &system::default_queue() vector &const vector & vector &const vector< T, OtherAlloc > & vector &const std::vector< T, OtherAlloc > & vector &&Move-constructs a new vector from other. vector &vector &&Move-assigns the data from other to *this. Destroys the vector object.
exceptionA run-time OpenCL context error. The context_error exception is thrown when the OpenCL context encounters an error condition. Boost.Compute is notified of these error conditions by registering an error handler when creating context objects (via the pfn_notify argument to the clCreateContext() function).This exception is different than the opencl_error exception which is thrown as a result of error caused when calling a single OpenCL API function.See Also:opencl_error const char *Returns a string with a description of the error. const context *Returns a pointer to the context object which generated the error notification. const void *Returns a pointer to the private info memory block. size_tReturns the size of the private info memory block. const context *const char *const void *size_tCreates a new context error exception object. Destroys the context error object.
exceptionException thrown when no OpenCL device is found. This exception is thrown when no valid OpenCL device can be found.See Also:opencl_error const char *Returns a string containing a human-readable error message. Creates a new no_device_found exception object. Destroys the no_device_found exception object.
exceptionA run-time OpenCL error. The opencl_error class represents an error returned from an OpenCL function.See Also:context_error cl_intReturns the numeric error code. std::stringReturns a string description of the error. const char *Returns a C-string description of the error. cl_intCreates a new opencl_error exception object for error. Destroys the opencl_error object. std::stringcl_intStatic function which converts the numeric OpenCL error code error to a human-readable string.For example: std::cout << opencl_error::to_string(CL_INVALID_KERNEL_ARGS) << std::endl; Will print "Invalid Kernel Arguments".If the error code is unknown (e.g. not a valid OpenCL error), a string containing "Unknown OpenCL Error" along with the error number will be returned.
boost::compute::opencl_errorA failure when building OpenCL program. Instances of this class are thrown when OpenCL program build fails. Extends opencl_error by saving a program build log so it can be used for testing, debugging, or logging purposes.See Also:opencl_error std::stringRetrieve the log of a failed program build. cl_intconst std::string &Creates a new program_build_failure exception object for error and build_log. Destroys the program_build_failure object.
exceptionException thrown when attempting to use an unsupported OpenCL extension. This exception is thrown when the user attempts to use an OpenCL extension which is not supported on the platform and/or device.An example of this is attempting to use CL-GL sharing on a non-GPU device.See Also:opencl_error std::stringReturns the name of the unsupported extension. const char *Returns a string containing a human-readable error message containing the name of the unsupported exception. const char *Creates a new unsupported extension error exception object indicating that extension is not supported by the OpenCL platform or device. Destroys the unsupported extension error object.
The as function converts its argument to type T (similar to reinterpret_cast<T>).See Also:convert<T> T
function< T(T *, T)> function< T(T *, T)> function< T(T *, T, T)> function< T(T *)> function< T(T *)> function< T(T *, T)> function< T(T *, T)> function< T(T *, T)> function< T(T *, T)> function< T(T *, T)> function< T(T *, T)>
false_typeMeta-function returning true if T is a placeholder type. placeholder< 0 > const placeholder< 1 > const unspecifiedFArgs...Returns a function wrapper which invokes f with args when called.For example, to generate a unary function object which returns true when its argument is less than 7: using boost::compute::less; using boost::compute::placeholders::_1; auto less_than_seven = boost::compute::bind(less<int>(), _1, 7);
The convert function converts its argument to type T (similar to static_cast<T>).See Also:as<T> T
Returns the named field from a value.The template-type T specifies the field's value type. Note that the value type must match the actual type of the field otherwise runtime compilation or logic errors may occur.For example, to access the second field in a std::pair<int, float> object: field<float>("second"); This can also be used with vector types to access individual components as well as perform swizzle operations.For example, to access the first and third components of an int vector type (e.g. int4): field<int2_>("xz"); See Also:get<N> Result type. T const std::string &Creates a new field functor with field.
Returns the N'th element of an aggregate type (e.g. scalarN, pair, tuple, etc.).See Also:field<T> unspecifiedconst Arg &
The hash function returns a hash value for the input value.The return type is ulong_ (the OpenCL unsigned long type).
Identity function which simply returns its input.For example, to directly copy values using the transform() algorithm: transform(input.begin(), input.end(), output.begin(), identity<int>(), queue); See Also:as<T>, convert<T> Identity function result type. T Creates a new identity function.
boost::compute::binary_function< void, void, int >The binnary_negate function adaptor negates a binary function.See Also:not2() Predicate boost::compute::unary_function< T, int >The logical_not function negates its argument and returns it.See Also:not1(), not2() boost::compute::unary_function< void, int >The unary_negate function adaptor negates a unary function.See Also:not1() Predicate unary_negate< Predicate >const Predicate &the unary function to wrapReturns a unary_negate adaptor around predicate. a unary_negate wrapper around predicate binary_negate< Predicate >const Predicate &the binary function to wrapReturns a binary_negate adaptor around predicate. a binary_negate wrapper around predicate
function< T(T)>Returns the number of non-zero bits in x.See the documentation for popcount() for more information.
boost::compute::image_objectAn OpenCL 1D image object. This method is only available if the OpenCL version is 1.2 or later. See Also:image_format, image2d extents< 1 >Returns the size (width) of the image. extents< 1 >Returns the origin of the image (0). Tcl_image_infoReturns information about the image.See the documentation for clGetImageInfo() for more information. unspecifiedThis is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. image1dcommand_queue &Creates a new image with a copy of the data in *this. Uses queue to perform the copy operation. Creates a null image1d object. const context &size_tconst image_format &cl_mem_flagsread_writevoid *0Creates a new image1d object.See the documentation for clCreateImage() for more information. const image1d &Creates a new image1d as a copy of other. image1d &const image1d &Copies the image1d from other. image1d &&Move-constructs a new image object from other. image1d &image1d &&Move-assigns the image from other to *this. Destroys the image1d object. std::vector< image_format >const context &cl_mem_flagsread_writeReturns the supported image formats for the context.See the documentation for clGetSupportedImageFormats() for more information. boolconst image_format &const context &cl_mem_flagsread_writeReturns true if format is a supported 1D image format for context.
boost::compute::image_objectAn OpenCL 2D image object. For example, to create a 640x480 8-bit RGBA image: See Also:image_format, image3d extents< 2 >Returns the size (width, height) of the image. extents< 2 >Returns the origin of the image (0, 0). Tcl_image_infoReturns information about the image.See the documentation for clGetImageInfo() for more information. unspecifiedThis is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. image2dcommand_queue &Creates a new image with a copy of the data in *this. Uses queue to perform the copy operation. Creates a null image2d object. const context &size_tsize_tconst image_format &cl_mem_flagsread_writevoid *0size_t0Creates a new image2d object.See the documentation for clCreateImage() for more information. const image2d &Creates a new image2d as a copy of other. image2d &const image2d &Copies the image2d from other. image2d &&Move-constructs a new image object from other. image2d &image2d &&Move-assigns the image from other to *this. Destroys the image2d object. std::vector< image_format >const context &cl_mem_flagsread_writeReturns the supported image formats for the context.See the documentation for clGetSupportedImageFormats() for more information. boolconst image_format &const context &cl_mem_flagsread_writeReturns true if format is a supported 2D image format for context.
boost::compute::image_objectAn OpenCL 3D image object. See Also:image_format, image2d extents< 3 >Returns the size (width, height, depth) of the image. extents< 3 >Returns the origin of the image (0, 0, 0). Tcl_image_infoReturns information about the image.See the documentation for clGetImageInfo() for more information. unspecifiedThis is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. image3dcommand_queue &Creates a new image with a copy of the data in *this. Uses queue to perform the copy operation. Creates a null image3d object. const context &size_tsize_tsize_tconst image_format &cl_mem_flagsread_writevoid *0size_t0size_t0Creates a new image3d object.See the documentation for clCreateImage() for more information. const image3d &Creates a new image3d as a copy of other. image3d &const image3d &Copies the image3d from other. image3d &&Move-constructs a new image object from other. image3d &image3d &&Move-assigns the image from other to *this. Destroys the image3d object. std::vector< image_format >const context &cl_mem_flagsread_writeReturns the supported 3D image formats for the context.See the documentation for clGetSupportedImageFormats() for more information. boolconst image_format &const context &cl_mem_flagsread_writeReturns true if format is a supported 3D image format for context.
A OpenCL image format. For example, to create a format for a 8-bit RGBA image: boost::compute::image_format rgba8(CL_RGBA, CL_UNSIGNED_INT8); After being constructed, image_format objects are usually passed to the constructor of the various image classes (e.g. image2d, image3d) to create an image object on a compute device.Image formats supported by a context can be queried with the static get_supported_formats() in each image class. For example: std::vector<image_format> formats = image2d::get_supported_formats(ctx); See Also:image2d = CL_R= CL_A= CL_INTENSITY= CL_LUMINANCE= CL_RG= CL_RA= CL_RGB= CL_RGBA= CL_ARGB= CL_BGRA = CL_SNORM_INT8= CL_SNORM_INT16= CL_UNORM_INT8= CL_UNORM_INT16= CL_UNORM_SHORT_565= CL_UNORM_SHORT_555= CL_UNORM_INT_101010= CL_SIGNED_INT8= CL_SIGNED_INT16= CL_SIGNED_INT32= CL_UNSIGNED_INT8= CL_UNSIGNED_INT16= CL_UNSIGNED_INT32= CL_HALF_FLOAT= CL_FLOAT const cl_image_format *Returns a pointer to the cl_image_format object. boolconst image_format &Returns true if *this is the same as other. boolconst image_format &Returns true if *this is not the same as other. cl_channel_ordercl_channel_typeCreates a new image format object with order and type. const cl_image_format &Creates a new image format object from format. const image_format &Creates a new image format object as a copy of other. image_format &const image_format &Copies the format from other to *this. Destroys the image format object.
memory_objectBase-class for image objects. The image_object class is the base-class for image objects on compute devices.See Also:image1d, image2d, image3d Tcl_mem_infoReturns information about the image object.See the documentation for clGetImageInfo() for more information. image_formatReturns the format for the image. size_tReturns the width of the image. size_tReturns the height of the image.For 1D images, this function will return 1. size_tReturns the depth of the image.For 1D and 2D images, this function will return 1. cl_membooltrue const image_object & image_object &const image_object & image_object && Destroys the image object. std::vector< image_format >const context &cl_mem_object_typecl_mem_flagsread_writeReturns the supported image formats for the type in context.See the documentation for clGetSupportedImageFormats() for more information. boolconst image_format &const context &cl_mem_object_typecl_mem_flagsread_writeReturns true if format is a supported image format for type in context with flags.
An OpenCL image sampler object. See Also:image2d, image_format = CL_ADDRESS_NONE= CL_ADDRESS_CLAMP_TO_EDGE= CL_ADDRESS_CLAMP= CL_ADDRESS_REPEAT = CL_FILTER_NEAREST= CL_FILTER_LINEAR cl_sampler &Returns the underlying cl_sampler object. contextReturns the context for the image sampler object. Tcl_sampler_infoReturns information about the sampler.See the documentation for clGetSamplerInfo() for more information. unspecifiedThis is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. boolconst image_sampler &Returns true if the sampler is the same at other. boolconst image_sampler &Returns true if the sampler is different from other. cl_sampler const context &boolcl_addressing_modecl_filter_mode cl_samplerbooltrue const image_sampler &Creates a new image sampler object as a copy of other. image_sampler &const image_sampler &Copies the image sampler object from other to *this. image_sampler && image_sampler &image_sampler && Destroys the image sampler object.
eventconst uint_const cl_mem *command_queue &const wait_list &wait_list()Enqueues a command to acquire the specified OpenGL memory objects.See the documentation for clEnqueueAcquireGLObjects() for more information. eventconst uint_const cl_mem *command_queue &const wait_list &wait_list()Enqueues a command to release the specified OpenGL memory objects.See the documentation for clEnqueueReleaseGLObjects() for more information. eventconst opengl_buffer &command_queue &const wait_list &wait_list()Enqueues a command to acquire the specified OpenGL buffer.See the documentation for clEnqueueAcquireGLObjects() for more information. eventconst opengl_buffer &command_queue &const wait_list &wait_list()Enqueues a command to release the specified OpenGL buffer.See the documentation for clEnqueueReleaseGLObjects() for more information.
contextCreates a shared OpenCL/OpenGL context for the currently active OpenGL context.Once created, the shared context can be used to create OpenCL memory objects which can interact with OpenGL memory objects (e.g. VBOs). unsupported_extension_error if no CL-GL sharing capable devices are found.
bufferA OpenCL buffer for accessing an OpenGL memory object. GLuintReturns the OpenGL memory object ID.See the documentation for clGetGLObjectInfo() for more information. cl_gl_object_typeReturns the OpenGL memory object type.See the documentation for clGetGLObjectInfo() for more information. Creates a null OpenGL buffer object. cl_membooltrueCreates a new OpenGL buffer object for mem. const context &GLuintcl_mem_flagsread_writeCreates a new OpenGL buffer object in context for bufobj with flags.See the documentation for clCreateFromGLBuffer() for more information. const opengl_buffer &Creates a new OpenGL buffer object as a copy of other. opengl_buffer &const opengl_buffer &Copies the OpenGL buffer object from other. Destroys the OpenGL buffer object.
boost::compute::image_objectA OpenCL buffer for accessing an OpenGL renderbuffer object. extents< 2 >Returns the size (width, height) of the renderbuffer. extents< 2 >Returns the origin of the renderbuffer (0, 0). GLuintReturns the OpenGL memory object ID.See the documentation for clGetGLObjectInfo() for more information. cl_gl_object_typeReturns the OpenGL memory object type.See the documentation for clGetGLObjectInfo() for more information. Creates a null OpenGL renderbuffer object. cl_membooltrueCreates a new OpenGL renderbuffer object for mem. const context &GLuintcl_mem_flagsread_writeCreates a new OpenGL renderbuffer object in context for renderbuffer with flags.See the documentation for clCreateFromGLRenderbuffer() for more information. const opengl_renderbuffer &Creates a new OpenGL renderbuffer object as a copy of other. opengl_renderbuffer &const opengl_renderbuffer &Copies the OpenGL renderbuffer object from other. Destroys the OpenGL buffer object.
boost::compute::image_objectA OpenCL image2d for accessing an OpenGL texture object. extents< 2 >Returns the size (width, height) of the texture. extents< 2 >Returns the origin of the texture (0, 0). Tcl_gl_texture_infoReturns information about the texture.See the documentation for clGetGLTextureInfo() for more information. Creates a null OpenGL texture object. cl_membooltrueCreates a new OpenGL texture object for mem. const context &GLenumGLintGLuintcl_mem_flagsread_writeCreates a new OpenGL texture object in context for texture with flags.See the documentation for clCreateFromGLTexture() for more information. const opengl_texture &Creates a new OpenGL texture object as a copy of other. opengl_texture &const opengl_texture &Copies the OpenGL texture object from other. Destroys the texture object.
An iterator for values in a buffer. The buffer_iterator class iterates over values in a memory buffer on a compute device. It is the most commonly used iterator in Boost.Compute and is used by the vector<T> and array<T, N> container classes.Buffer iterators store a reference to a memory buffer along with an index into that memory buffer.The buffer_iterator class allows for arbitrary OpenCL memory objects (including those created outside of Boost.Compute) to be used with the Boost.Compute algorithms (such as transform() and sort()). For example, to reverse the contents of an OpenCL memory buffer containing a set of integers: See Also:buffer, make_buffer_iterator() unspecified super_type::reference super_type::difference_type const buffer & size_t Tcommand_queue & voidconst T &command_queue & const buffer &size_t const buffer_iterator< T > & buffer_iterator< T > &const buffer_iterator< T > & buffer_iterator< T >const buffer &the buffer object size_t0the index in the bufferCreates a new buffer_iterator for buffer at index. a buffer_iterator for buffer at index
An iterator for a buffer in the constant memory space. The constant_buffer_iterator class provides an iterator for values in a buffer in the constant memory space.For iterating over values in the global memory space (the most common case), use the buffer_iterator class.See Also:buffer_iterator unspecified super_type::reference super_type::difference_type const buffer & size_t Tcommand_queue & voidconst T &command_queue & unspecifiedconst Expr & const buffer &size_t const constant_buffer_iterator< T > & constant_buffer_iterator< T > &const constant_buffer_iterator< T > & reference boolconst constant_buffer_iterator< T > & void void voiddifference_type difference_typeconst constant_buffer_iterator< T > & constant_buffer_iterator< T >const buffer &the buffer object size_t0the index in the bufferCreates a new constant_buffer_iterator for buffer at index. a constant_buffer_iterator for buffer at index
An iterator with a constant value. The constant_iterator class provides an iterator which returns a constant value when dereferenced.For example, this could be used to implement the fill() algorithm in terms of the copy() algorithm by copying from a range of constant iterators: See Also:make_constant_iterator() unspecified super_type::reference super_type::difference_type size_t const T &size_t0 const constant_iterator< T > & constant_iterator< T > &const constant_iterator< T > & constant_iterator< T >const T &the constant value size_t0the iterators indexReturns a new constant_iterator with value at index. a constant_iterator with value
The counting_iterator class implements a counting iterator. A counting iterator returns an internal value (initialized with init) which is incremented each time the iterator is incremented.For example, this could be used to implement the iota() algorithm in terms of the copy() algorithm by copying from a range of counting iterators: See Also:make_counting_iterator() unspecified super_type::reference super_type::difference_type size_t unspecifiedconst Expr & const T & const counting_iterator< T > & counting_iterator< T > &const counting_iterator< T > & reference boolconst counting_iterator< T > & void void voiddifference_type difference_typeconst counting_iterator< T > & counting_iterator< T >const T &the initial valueReturns a new counting_iterator starting at init. For example, to create a counting iterator which returns unsigned integers and increments from one: auto iter = make_counting_iterator<uint_>(1); a counting_iterator with init.
typeAn iterator which discards all values written to it. See Also:make_discard_iterator(), constant_iterator unspecified super_type::reference super_type::difference_type size_t0 const discard_iterator & discard_iterator &const discard_iterator & discard_iteratortrue_typeinternal_ (is_device_iterator specialization for discard_iterator) discard_iteratorsize_t0the index of the iteratorReturns a new discard_iterator with index. a discard_iterator at index
Iterator which returns the result of a function when dereferenced. For example: See Also:make_function_input_iterator() unspecified super_type::reference super_type::difference_type Function size_t unspecifiedconst Expr & const Function &size_t0 const function_input_iterator< Function > & function_input_iterator< Function > &const function_input_iterator< Function > & reference boolconst function_input_iterator< Function > & void void voiddifference_type difference_typeconst function_input_iterator< Function > & function_input_iterator< Function >const Function &function to execute when dereferenced size_t0index of the iteratorReturns a function_input_iterator with function. a function_input_iterator with function
The permutation_iterator class provides a permuation iterator. A permutation iterator iterates over a value range and an index range. When dereferenced, it returns the value from the value range using the current index from the index range.For example, to reverse a range using the copy() algorithm and a permutation sequence: See Also:make_permutation_iterator() unspecified super_type::value_type super_type::reference super_type::base_type super_type::difference_type IndexIterator size_t const buffer & unspecifiedconst IndexExpr & ElementIteratorIndexIterator const permutation_iterator< ElementIterator, IndexIterator > & permutation_iterator< ElementIterator, IndexIterator > &const permutation_iterator< ElementIterator, IndexIterator > & reference permutation_iterator< ElementIterator, IndexIterator >ElementIteratorthe element range iterator IndexIteratorthe index range iteratorReturns a permutation_iterator for e using indices from i. a permutation_iterator for e using i
An iterator adaptor with adjustable iteration step. The strided iterator adaptor skips over multiple elements each time it is incremented or decremented.See Also:buffer_iterator, make_strided_iterator(), make_strided_iterator_end() unspecified super_type::value_type super_type::reference super_type::base_type super_type::difference_type size_t const buffer & unspecifiedconst IndexExpression & Iteratordifference_type const strided_iterator< Iterator > & strided_iterator< Iterator > &const strided_iterator< Iterator > & reference boolconst strided_iterator< Iterator > & void void voidtypename super_type::difference_type difference_typeconst strided_iterator< Iterator > & strided_iterator< Iterator >Iteratorthe underlying iterator typename std::iterator_traits< Iterator >::difference_typethe iteration step for strided_iteratorReturns a strided_iterator for iterator with stride. For example, to create an iterator which iterates over every other element in a vector<int>: auto strided_iterator = make_strided_iterator(vec.begin(), 2); a strided_iterator for iterator with stride. strided_iterator< Iterator >Iteratorthe iterator referring to the first element accessible through strided_iterator for first with stride Iteratorthe iterator referring to the last element that may be accessible through strided_iterator for first with stride typename std::iterator_traits< Iterator >::difference_typethe iteration stepReturns a strided_iterator which refers to element that would follow the last element accessible through strided_iterator for first iterator with stride.Parameter stride must be greater than zero. It can be helpful when iterating over strided_iterator: // vec.size() may not be divisible by 3 auto strided_iterator_begin = make_strided_iterator(vec.begin(), 3); auto strided_iterator_end = make_strided_iterator_end(vec.begin(), vec.end(), 3); // copy every 3rd element to result boost::compute::copy( strided_iterator_begin, strided_iterator_end, result.begin(), queue ); a strided_iterator referring to element that would follow the last element accessible through strided_iterator for first iterator with stride.
A transform iterator adaptor. The transform_iterator adaptor applies a unary function to each element produced from the underlying iterator when dereferenced.For example, to copy from an input range to an output range while taking the absolute value of each element: See Also:buffer_iterator, make_transform_iterator() unspecified super_type::value_type super_type::reference super_type::base_type super_type::difference_type UnaryFunction size_t const buffer & unspecifiedconst IndexExpression & InputIteratorUnaryFunction const transform_iterator< InputIterator, UnaryFunction > & transform_iterator< InputIterator, UnaryFunction > &const transform_iterator< InputIterator, UnaryFunction > & reference transform_iterator< InputIterator, UnaryFunction >InputIteratorthe underlying iterator UnaryFunctionthe unary transform functionReturns a transform_iterator for iterator with transform. For example, to create an iterator which returns the square-root of each value in a vector<int>: auto sqrt_iterator = make_transform_iterator(vec.begin(), sqrt<int>()); a transform_iterator for iterator with transform
A zip iterator adaptor. The zip_iterator class combines values from multiple input iterators. When dereferenced it returns a tuple containing each value at the current position in each input range.See Also:make_zip_iterator() unspecified super_type::value_type super_type::reference super_type::difference_type IteratorTuple const IteratorTuple & unspecifiedconst IndexExpression & IteratorTuple const zip_iterator< IteratorTuple > & zip_iterator< IteratorTuple > &const zip_iterator< IteratorTuple > & reference boolconst zip_iterator< IteratorTuple > & void void voiddifference_type difference_typeconst zip_iterator< IteratorTuple > & zip_iterator< IteratorTuple >IteratorTuplea tuple of input iterators to zip togetherCreates a zip_iterator for iterators. For example, to zip together iterators from three vectors (a, b, and c): auto zipped = boost::compute::make_zip_iterator( boost::make_tuple(a.begin(), b.begin(), c.begin()) ); a zip_iterator for iterators
Represents a local memory buffer on the device. The local_buffer class represents a block of local memory on a compute device.This class is most commonly used to set local memory arguments for compute kernels: // set argument to a local buffer with storage for 32 float's kernel.set_arg(0, local_buffer<float>(32)); See Also:buffer, kernel size_tReturns the number of elements in the local buffer. const size_tCreates a local buffer object for size elements. const local_buffer &Creates a local buffer object as a copy of other. local_buffer &const local_buffer &Copies other to *this. Destroys the local memory object.
T std::ptrdiff_t T * T & std::random_access_iterator_tag void * svm_ptr< T >difference_type difference_typesvm_ptr< T > const context & boolconst svm_ptr< T > & boolconst svm_ptr< T > & void *const context & const svm_ptr< T > & svm_ptr< T > &const svm_ptr< T > &
Produces random boolean values according to the following discrete probability function with parameter p : P(true/p) = p and P(false/p) = (1 - p) The following example shows how to setup a bernoulli distribution to produce random boolean values with parameter p = 0.25 RealTypeReturns the value of the parameter p. voidOutputIteratorOutputIteratorGenerator &command_queue &Generates bernoulli distributed booleans and stores them in the range [first, last). RealType0.5fCreates a new bernoulli distribution. Destroys the bernoulli_distribution object. boost::is_floating_point< RealType >::value"Template argument must be a floating point type"
mt19937
Produces random integers on the interval [0, n), where probability of each integer is given by the weight of the ith integer divided by the sum of all weights. The following example shows how to setup a discrete distribution to produce 0 and 1 with equal probabilityIntType ::std::vector< double >Returns the probabilities. result_type minReturns the minimum potentially generated value. result_type maxReturns the maximum potentially generated value. voidOutputIteratorOutputIteratorGenerator &command_queue &Generates uniformly distributed integers and stores them to the range [first, last). Creates a new discrete distribution with a single weight p = { 1 }. This distribution produces only zeroes. InputIteratorInputIteratorCreates a new discrete distribution with weights given by the range [first, last). Destroys the discrete_distribution object. boost::is_integral< IntType >::value"Template argument must be integral"
'Quick and Dirty' linear congruential engine Quick and dirty linear congruential engine to generate low quality random numbers very quickly. For uses in which good quality of random numbers is required(Monte-Carlo Simulations), use other engines like Mersenne Twister instead. T const T const T const size_t voidresult_typeseed value for the random-number generator command_queue &command queue to perform the operationSeeds the random number generator with value. If no seed value is provided, default_seed is used. voidcommand_queue &This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. voidOutputIteratorOutputIteratorcommand_queue &Generates random numbers and stores them to the range [first, last). voidOutputIteratorOutputIteratorFunctioncommand_queue &Generates random numbers, transforms them with op, and then stores them to the range [first, last). voidsize_tcommand_queue &Generates z random numbers and discards them. command_queue &result_typedefault_seedCreates a new linear_congruential_engine and seeds it with value. const linear_congruential_engine< T > &Creates a new linear_congruential_engine object as a copy of other. linear_congruential_engine< T > &const linear_congruential_engine< T > &Copies other to *this. Destroys the linear_congruential_engine object.
Mersenne twister pseudorandom number generator. T const T const T const T voidresult_typeseed value for the random-number generator command_queue &command queue to perform the operationSeeds the random number generator with value. If no seed value is provided, default_seed is used. voidcommand_queue &This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. voidOutputIteratorOutputIteratorcommand_queue &Generates random numbers and stores them to the range [first, last). voidOutputIteratorOutputIteratorFunctioncommand_queue &Generates random numbers, transforms them with op, and then stores them to the range [first, last). voidsize_tcommand_queue &Generates z random numbers and discards them. command_queue &result_typedefault_seedCreates a new mersenne_twister_engine and seeds it with value. const mersenne_twister_engine< T > &Creates a new mersenne_twister_engine object as a copy of other. mersenne_twister_engine< T > &const mersenne_twister_engine< T > &Copies other to *this. Destroys the mersenne_twister_engine object. mersenne_twister_engine< uint_ >
Produces random, normally-distributed floating-point numbers. The following example shows how to setup a normal distribution to produce random float values centered at 5: See Also:default_random_engine, uniform_real_distribution RealType result_typeReturns the mean value of the distribution. result_typeReturns the standard-deviation of the distribution. result_type minReturns the minimum value of the distribution. result_type maxReturns the maximum value of the distribution. voidOutputIteratorOutputIteratorGenerator &command_queue &Generates normally-distributed floating-point numbers and stores them to the range [first, last). RealType0.fRealType1.fCreates a new normal distribution producing numbers with the given mean and stddev. Destroys the normal distribution object. boost::is_floating_point< RealType >::value"Template argument must be a floating point type"
Threefry pseudorandom number generator. T const ulong_ voidulong_seed value for the random-number generator command_queue &command queue to perform the operationSeeds the random number generator with value. If no seed value is provided, default_seed is used. voidcommand_queue &This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. voidOutputIteratorOutputIteratorcommand_queue &Generates random numbers and stores them to the range [first, last). voidOutputIteratorOutputIteratorFunctioncommand_queue &Generates random numbers, transforms them with op, and then stores them to the range [first, last). voidsize_tcommand_queue &Generates z random numbers and discards them. command_queue &ulong_default_seedCreates a new threefry_engine and seeds it with value. const threefry_engine< T > &Creates a new threefry_engine object as a copy of other. threefry_engine< T > &const threefry_engine< T > &Copies other to *this. Destroys the threefry_engine object. void
Produces uniformily distributed random integers. The following example shows how to setup a uniform int distribution to produce random integers 0 and 1.IntType result_typeReturns the minimum value of the distribution. result_typeReturns the maximum value of the distribution. voidOutputIteratorOutputIteratorGenerator &command_queue &Generates uniformily distributed integers and stores them to the range [first, last). IntType0IntType(std::numeric_limits< IntType >::max)()Creates a new uniform distribution producing numbers in the range [a, b]. Destroys the uniform_int_distribution object. boost::is_integral< IntType >::value"Template argument must be integral"
Produces uniformly distributed random floating-point numbers. The following example shows how to setup a uniform real distribution to produce random float values between 1 and 100. See Also:default_random_engine, normal_distribution RealType result_typeReturns the minimum value of the distribution. result_typeReturns the maximum value of the distribution. voidOutputIteratorOutputIteratorGenerator &command_queue &Generates uniformly distributed floating-point numbers and stores them to the range [first, last). RealType0.fRealType1.fCreates a new uniform distribution producing numbers in the range [a, b). Requires a < b Destroys the uniform_real_distribution object. boost::is_floating_point< RealType >::value"Template argument must be a floating point type"
false_typeMeta-function returning true if Iterator is a device-iterator.By default, this function returns false. Device iterator types (such as buffer_iterator) should specialize this trait and return true.For example: is_device_iterator<buffer_iterator<int>>::value == true is_device_iterator<std::vector<int>::iterator>::value == false
false_typeMeta-function returning true if T is a fundamental (i.e. built-in) type.For example, is_fundamental<float>::value == true is_fundamental<std::pair<int, float>>::value == false
boost::mpl::bool_< vector_size< T >::value !=1 >Meta-function returning true if T is a vector type.For example, is_vector_type<int>::value == false is_vector_type<float4_>::value == true See Also:make_vector_type, vector_size
Meta-function which returns a vector type for Scalar with Size.For example, make_vector_type<int, 2>::type == int2_ make_vector_type<float, 4>::type == float4_ See Also:is_vector_type
Returns the result of Function when called with Args.For example, // int + int = int result_of<plus(int, int)>::type == int ::boost::tr1_result_of< Signature >::type
Meta-function returning the scalar type for a vector type.For example, scalar_type<float4_>::type == float
std::stringReturns the OpenCL type definition for T. See Also:type_name<T>() a string containing the type definition for T
const char *Returns the OpenCL type name for the type T as a string. For example: type_name<float>() == "float" type_name<float4_>() == "float4" See Also:type_definition<T>() a string containing the type name for T Registers the OpenCL type for the C++ type to name.For example, the following will allow Eigen's Vector2f type to be used with Boost.Compute algorithms and containers as the built-in float2 type. BOOST_COMPUTE_TYPE_NAME(Eigen::Vector2f, float2) This macro should be invoked in the global namespace.See Also:type_name()
Meta-function returning the size (number of components) of a vector type T. For scalar types this function returns 1.For example, vector_size<float>::value == 1 vector_size<float4_>::value == 4
extents< sizeof...(Args)>Args...The variadic dim() function provides a concise syntax for creating extents objects.For example, extents<2> region = dim(640, 480); // region == (640, 480) See Also:extents<N>
The extents class contains an array of n-dimensional extents.See Also:dim() size_t boost::array< size_t, N > array_type::iterator array_type::const_iterator const size_type size_typeReturns the size (i.e. dimensionality) of the extents array. size_typeReturns the linear size of the extents. This is equivalent to the product of each extent in each dimension. size_t *Returns a pointer to the extents data array.This is useful for passing the extents data to OpenCL APIs which expect an array of size_t. const size_t *This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. iterator const_iterator const_iterator iterator const_iterator const_iterator size_t &size_tReturns a reference to the extent at index. const size_t &size_tThis is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. boolconst extents &Returns true if the extents in *this are the same as other. boolconst extents &Returns true if the extents in *this are not the same as other. Creates an extents object with each component set to zero.For example: extents<3> exts(); // (0, 0, 0) size_tCreates an extents object with each component set to value.For example: extents<3> exts(1); // (1, 1, 1) std::initializer_list< size_t >Creates an extents object with values.
result_of< Function(Args...)>::typeconst Function &command_queue &const Args &...Invokes function with args on queue.For example, to invoke the builtin abs() function: int result = invoke(abs<int>(), queue, -10); // returns 10
noncopyableThe program_cache class stores program objects in a LRU cache.This class can be used to help mitigate the overhead of OpenCL's run-time kernel compilation model. Commonly used programs can be stored persistently in the cache and only compiled once on their first use.Program objects are stored and retreived based on a user-defined cache key along with the options used to build the program (if any).For example, to insert a program into the cache: cache.insert("foo", foo_program); And to retreive the program later: boost::optional<program> p = cache.get("foo"); if(p){ // program found in cache } See Also:program size_tReturns the number of program objects currently stored in the cache. size_tReturns the total capacity of the cache. voidClears the program cache. boost::optional< program >const std::string &Returns the program object with key. Returns a null optional if no program with key exists in the cache. boost::optional< program >const std::string &const std::string &Returns the program object with key and options. Returns a null optional if no program with key and options exists in the cache. voidconst std::string &const program &Inserts program into the cache with key. voidconst std::string &const std::string &const program &Inserts program into the cache with key and options. programconst std::string &const std::string &const std::string &const context &Loads the program with key from the cache if it exists. Otherwise builds a new program with source and options, stores it in the cache, and returns it.This is a convenience function to simplify the common pattern of attempting to load a program from the cache and, if not present, building the program from source and storing it in the cache.Equivalent to: boost::optional<program> p = get(key, options); if(!p){ p = program::create_with_source(source, context); p->build(options); insert(key, options, *p); } return *p; size_tCreates a new program cache with space for capacity number of program objects. Destroys the program cache. boost::shared_ptr< program_cache >const context &Returns the global program cache for context.This global cache is used internally by Boost.Compute to store compiled program objects used by its algorithms. All Boost.Compute programs are stored with a cache key beginning with "__boost". User programs should avoid using the same prefix in order to prevent collisions.
Stringizes OpenCL source code.For example, to create a simple kernel which squares each input value: const char source[] = BOOST_COMPUTE_STRINGIZE_SOURCE( __kernel void square(const float *input, float *output) { const uint i = get_global_id(0); const float x = input[i]; output[i] = x * x; } ); // create and build square program program square_program = program::build_with_source(source, context); // create square kernel kernel square_kernel(square_program, "square");
Stores a list of events. The wait_list class stores a set of event objects and can be used to specify dependencies for OpenCL operations or to wait on the host until all of the events have completed.This class also provides convenience functions for interacting with OpenCL APIs which typically accept event dependencies as a cl_event* pointer and a cl_uint size. For example: wait_list events = ...; clEnqueueNDRangeKernel(..., events.get_event_ptr(), events.size(), ...); See Also:event, future<T> std::vector< event >::iterator std::vector< event >::const_iterator boolReturns true if the wait-list is empty. uint_Returns the number of events in the wait-list. voidRemoves all of the events from the wait-list. const cl_event *Returns a cl_event pointer to the first event in the wait-list. Returns 0 if the wait-list is empty.This can be used to pass the wait-list to OpenCL functions which expect a cl_event pointer to refer to a list of events. voidsize_tReserves a minimum length of storage for the wait list object. voidconst event &Inserts event into the wait-list. voidconst future< T > &Inserts the event from future into the wait-list. voidBlocks until all of the events in the wait-list have completed.Does nothing if the wait-list is empty. const event &size_tReturns a reference to the event at specified location pos. event &size_tReturns a reference to the event at specified location pos. iteratorReturns an iterator to the first element of the wait-list. const_iteratorReturns an iterator to the first element of the wait-list. const_iteratorReturns an iterator to the first element of the wait-list. iteratorReturns an iterator to the element following the last element of the wait-list. const_iteratorReturns an iterator to the element following the last element of the wait-list. const_iteratorReturns an iterator to the element following the last element of the wait-list. Creates an empty wait-list. const event &Creates a wait-list containing event. const wait_list &Creates a new wait-list as a copy of other. std::initializer_list< event >Creates a wait-list from events. wait_list &const wait_list &Copies the events in the wait-list from other. wait_list &&Move-constructs a new wait list object from other. wait_list &wait_list &&Move-assigns the wait list from other to *this. Destroys the wait-list.