示例#1
0
文件: rsqrt.cpp 项目: lsellens/calpp
void run()
{
    NDRange                         global;
    Event                           event;
    boost::array<boost::uint32_t,4> size;

    size.assign(2*256*64);
    global = NDRange(256,64);

    // run kernel A
    _kernel.setArg(0,size);
    _kernel.setArg(1,_input);
    _kernel.setArg(2,_output);
    _queue.enqueueNDRangeKernel( _kernel, global, &event );
    _queue.flush();

    _queue.waitForEvent(event);
}
示例#2
0
void run( int workgroup_size )
{
    NDRange     global,local;
    Event       event;

    local  = NDRange(workgroup_size);
    global = NDRange(_nr_groups*workgroup_size);

    posix_time::ptime t1 = posix_time::microsec_clock::local_time();

    _kernel.setArg(0,_output);
    _queue.enqueueNDRangeKernel( _kernel, global, local, &event );
    _queue.flush();

    _queue.waitForEvent(event);

    posix_time::ptime t2 = posix_time::microsec_clock::local_time();

    _exec_time = posix_time::time_period(t1,t2).length().total_microseconds();
}