From afa089e1afce3338fd1fa60fe9da0b326c66f1d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Oberhuber?= <oberhuber.tomas@gmail.com> Date: Tue, 6 Apr 2021 14:11:39 +0200 Subject: [PATCH] Improving SequentialFor example. --- Documentation/Examples/Algorithms/SequentialForExample.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Documentation/Examples/Algorithms/SequentialForExample.cpp b/Documentation/Examples/Algorithms/SequentialForExample.cpp index d127a33a97..4bf83a64ad 100644 --- a/Documentation/Examples/Algorithms/SequentialForExample.cpp +++ b/Documentation/Examples/Algorithms/SequentialForExample.cpp @@ -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 ); -- GitLab