Skip to content
Snippets Groups Projects
Commit afa089e1 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber Committed by Jakub Klinkovský
Browse files

Improving SequentialFor example.

parent 3916fab8
No related branches found
No related tags found
1 merge request!105TO/matrices-adaptive-csr
......@@ -10,11 +10,12 @@ using namespace TNL::Containers;
template< typename Device >
void printVector()
{
const int size( 36 );
const int size( 60 );
TNL::Containers::Vector< float, Device > v( size, 1.0 );
auto view = v.getView();
auto print = [=] __cuda_callable__ ( int i ) mutable {
printf( "v[ %d ] = %f \n", i, view[ i ] ); // we use printf because of compatibility with GPU kernels
if( i % 5 == 0 )
printf( "v[ %d ] = %f \n", i, view[ i ] ); // we use printf because of compatibility with GPU kernels
};
std::cout << "Printing vector using parallel for: " << std::endl;
Algorithms::ParallelFor< Device >::exec( 0, v.getSize(), print );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment