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

Fixed typo in vector operations benchmark comment.

parent 7ce8d125
No related branches found
No related tags found
1 merge request!20Traversers optimizations
......@@ -64,7 +64,7 @@ benchmarkVectorOperations( Benchmark & benchmark,
deviceVector.setValue( 1.0 );
#endif
// A relatively harmless call to keep the compiler from realizing we
// don't actually do any useful work with the result of the reduciton.
// don't actually do any useful work with the result of the reduction.
srand48(resultHost);
resultHost = resultDevice = 0.0;
};
......
/***************************************************************************
WriteOne.h - description
-------------------
begin : Dec 19, 2018
copyright : (C) 2018 by oberhuber
email : tomas.oberhuber@fjfi.cvut.cz
***************************************************************************/
/* See Copyright Notice in tnl/Copyright */
// Implemented by: Tomas Oberhuber
#pragma once
#include <TNL/ParallelFor.h>
#include <TNL/Devices/Host.h>
#include <TNL/Devices/Cuda.h>
#include <TNL/Containers/Vector.h>
namespace TNL {
namespace Benchmarks {
template< int Dimenions,
typename Device,
typename Real,
typename Index >
class WriteOne{};
template< typename Device,
typename Real,
typename Index >
class WriteOne< 1, Device, Real, Index >
{
public:
using Vector = Containers::Vector< Real, Device, Index >;
static void run( std::size_t size )
{
Vector v( size );
auto writeOne = []( Index i, Real* data )
{
data[ i ] = 1.0;
};
ParallelFor< Devices::Host >::exec( ( std::size_t ) 0, size, writeOne, v.getData() );
}
};
template< typename Device,
typename Real,
typename Index >
class WriteOne< 2, Device, Real, Index >
{
public:
using Vector = Containers::Vector< Real, Device, Index >;
static void run( std::size_t size )
{
}
};
template< typename Device,
typename Real,
typename Index >
class WriteOne< 3, Device, Real, Index >
{
public:
using Vector = Containers::Vector< Real, Device, Index >;
static void run( std::size_t size )
{
}
};
} // namespace Benchmarks
} // namespace TNL
/***************************************************************************
grid-traversing.h - description
-------------------
begin : Dec 19, 2018
copyright : (C) 2018 by oberhuber
email : tomas.oberhuber@fjfi.cvut.cz
***************************************************************************/
/* See Copyright Notice in tnl/Copyright */
// Implemented by: Tomas Oberhuber
#pragma once
#include "../Benchmarks.h"
#include "WriteOne.h"
#include <TNL/Containers/Vector.h>
namespace TNL {
namespace Benchmarks {
template< int Dimension,
typename Real = double,
typename Index = int >
class benchmarkTraversingFullGrid
{
public:
static void run ( Benchmark& benchmark, std::size_t size )
{
auto reset = [&]()
{};
auto testHost = [&] ()
{
WriteOne< Dimension, Devices::Host, Real, Index >::run( size );
};
auto testCuda = [&] ()
{
WriteOne< Dimension, Devices::Cuda, Real, Index >::run( size );
};
benchmark.setOperation( "writeOne", size * sizeof( Real ) );
benchmark.time( reset, "CPU", testHost );
#ifdef HAVE_CUDA
benchmark.time( reset, "GPU", testCuda );
#endif
}
};
} // namespace Benchmarks
} // namespace TNL
\ No newline at end of file
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