Skip to content
Snippets Groups Projects
Commit d3975a55 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Added benchmarks for allocation and deallocation of arrays

parent 49f4459a
No related branches found
No related tags found
No related merge requests found
......@@ -91,6 +91,50 @@ benchmarkArrayOperations( Benchmark & benchmark,
"CPU->GPU", copyAssignHostCuda,
"GPU->CPU", copyAssignCudaHost );
auto setValueHost = [&]() {
hostArray.setValue( 3.0 );
};
auto setValueCuda = [&]() {
deviceArray.setValue( 3.0 );
};
benchmark.setOperation( "setValue", datasetSize );
benchmark.time( reset1,
"CPU", setValueHost,
"GPU", setValueCuda );
auto setSizeHost = [&]() {
hostArray.setSize( size );
};
auto setSizeCuda = [&]() {
deviceArray.setSize( size );
};
auto resetSize1 = [&]() {
hostArray.reset();
deviceArray.reset();
};
benchmark.setOperation( "allocation (setSize)", datasetSize );
benchmark.time( resetSize1,
"CPU", setSizeHost,
"GPU", setSizeCuda );
auto resetSizeHost = [&]() {
hostArray.reset();
};
auto resetSizeCuda = [&]() {
deviceArray.reset();
};
auto setSize1 = [&]() {
hostArray.setSize( size );
deviceArray.setSize( size );
};
benchmark.setOperation( "deallocation (reset)", datasetSize );
benchmark.time( setSize1,
"CPU", resetSizeHost,
"GPU", resetSizeCuda );
return true;
}
......
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