HSA-Libraries / Bolt

Bolt is a C++ template library optimized for GPUs. Bolt provides high-performance library implementations for common algorithms such as scan, reduce, transform, and sort.
Other
373 stars 65 forks source link

CountingIterator with bolt::cl::copy #227

Open jpola opened 9 years ago

jpola commented 9 years ago

Hello,

I'm testing new functionality of Bolt 1.3 library on GPU.

I've followed example from follwong page: http://developer.amd.com/community/blog/2013/04/26/details-of-the-bolt-beta/

I found iterator functionality very attractive but the example from the mentioned webpage seems not to work correctly, at least under linux OS:

#include "bolt/cl/device_vector.h"
#include "bolt/cl/iterator/counting_iterator.h"
#include "bolt/cl/copy.h"

int main( int argc, char* argv[] )
{
    bolt::cl::device_vector< int > devV( 100 );
    bolt::cl::copy( bolt::cl::make_counting_iterator< int >( 10 ),
                    bolt::cl::make_counting_iterator< int >( 10 + devV.size( ) ),
                    devV.begin( ) );
}

The input vector is not changed at all. I've executed it using bolt::cl::transform instead of bolt::cl::copy and it is working correctly.