相关疑难解决方法(0)

性能:boost.compute vs opencl c ++包装器

以下代码分别使用boost.compute和opencl c ++包装器添加两个向量.结果显示boost.compute比opencl c ++包装器慢近20倍.我想知道我是否错过使用boost.compute或它确实很慢.平台:win7,vs2013,提升1.55,boost.compute 0.2,ATI Radeon HD 4600

代码使用c ++包装器:

#define __CL_ENABLE_EXCEPTIONS
#include <CL/cl.hpp>
#include <boost/timer/timer.hpp>
#include <boost/smart_ptr/scoped_array.hpp>
#include <fstream>
#include <numeric>
#include <algorithm>
#include <functional>

int main(){
    static char kernelSourceCode[] = "\
__kernel void vadd(__global int * a, __global int * b, __global int * c){\
    size_t i = get_global_id(0);\
    \
    c[i] = a[i] + b[i];\
    }\
";

    using type = boost::scoped_array<int>;
    size_t const BUFFER_SIZE = 1UL << 13;
    type A(new int[BUFFER_SIZE]);
    type B(new int[BUFFER_SIZE]);
    type C(new int[BUFFER_SIZE]); …
Run Code Online (Sandbox Code Playgroud)

c++ boost opencl boost-compute

9
推荐指数
1
解决办法
3748
查看次数

标签 统计

boost ×1

boost-compute ×1

c++ ×1

opencl ×1