Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sreekanth Arikatla
VTK-m
Commits
a4106506
Commit
a4106506
authored
Dec 20, 2017
by
Matt Larsen
Browse files
trying to create a benchmark for ray tracing
parent
fab26344
Changes
3
Hide whitespace changes
Inline
Side-by-side
vtkm/benchmarking/BenchmarkRayTracing.cxx
0 → 100644
View file @
a4106506
//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//
// Copyright 2017 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
// Copyright 2017 UT-Battelle, LLC.
// Copyright 2017 Los Alamos National Security.
//
// Under the terms of Contract DE-NA0003525 with NTESS,
// the U.S. Government retains certain rights in this software.
//
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
// Laboratory (LANL), the U.S. Government retains certain rights in
// this software.
//============================================================================
#include
<vtkm/benchmarking/Benchmarker.h>
#include
<vtkm/TypeTraits.h>
#include
<vtkm/cont/ArrayHandle.h>
#include
<vtkm/cont/DeviceAdapterAlgorithm.h>
#include
<vtkm/cont/Timer.h>
#include
<vtkm/cont/testing/MakeTestDataSet.h>
#include
<vtkm/rendering/Camera.h>
#include
<vtkm/rendering/raytracing/RayTracer.h>
#include
<vtkm/exec/FunctorBase.h>
#include
<sstream>
#include
<string>
#include
<vector>
using
namespace
vtkm
::
benchmarking
;
namespace
vtkm
{
namespace
benchmarking
{
template
<
typename
Precision
>
struct
BenchRayTracing
{
vtkm
::
rendering
::
raytracing
::
RayTracer
Tracer
;
vtkm
::
rendering
::
raytracing
::
Camera
RayCamera
;
// Setup anything that doesn't need to change per run in the constructor
VTKM_CONT
BenchRayTracing
()
{
vtkm
::
cont
::
testing
::
MakeTestDataSet
maker
;
vtkm
::
cont
::
DataSet
data
=
maker
.
Make3DUniformDataSet2
();
vtkm
::
rendering
::
Camera
camera
;
vtkm
::
Bounds
bounds
=
data
.
GetCoordinateSystem
().
GetBounds
();
camera
.
ResetToBounds
(
bounds
);
}
// The overloaded call operator will run the operations being timed and
// return the execution time
VTKM_CONT
vtkm
::
Float64
operator
()()
{
return
0.05
;
}
// The benchmark must also provide a method describing itself, this is
// used when printing out run time statistics
VTKM_CONT
std
::
string
Description
()
const
{
return
"A ray tracing benchmark"
;
}
};
// Now use the VTKM_MAKE_BENCHMARK macro to generate a maker functor for
// your benchmark. This lets us generate the benchmark functor for each type
// we want to test
VTKM_MAKE_BENCHMARK
(
RayTracing
,
BenchRayTracing
);
}
}
// end namespace vtkm::benchmarking
int
main
(
int
,
char
*
[])
{
using
Device
=
VTKM_DEFAULT_DEVICE_ADAPTER_TAG
;
//using Benchmarks = vtkm::benchmarking::BenchRayTracing<Device>;
using
TestTypes
=
vtkm
::
ListTagBase
<
vtkm
::
Float32
>
;
VTKM_RUN_BENCHMARK
(
RayTracing
,
vtkm
::
ListTagBase
<
vtkm
::
Float32
>
());
//bool result = Benchmarks::Run();
//return result ? EXIT_SUCCESS : EXIT_FAILURE;
}
vtkm/benchmarking/CMakeLists.txt
View file @
a4106506
...
...
@@ -30,6 +30,10 @@ set(benchmark_headers
Benchmarker.h
)
if
(
VTKm_ENABLE_RENDERING
)
list
(
APPEND benchmark_srcs BenchmarkRayTracing.cxx
)
endif
()
vtkm_save_benchmarks
(
${
benchmark_srcs
}
HEADERS
${
benchmark_headers
}
)
...
...
vtkm/cont/testing/MakeTestDataSet.h
View file @
a4106506
...
...
@@ -53,6 +53,7 @@ public:
// 3D uniform datasets.
vtkm
::
cont
::
DataSet
Make3DUniformDataSet0
();
vtkm
::
cont
::
DataSet
Make3DUniformDataSet1
();
vtkm
::
cont
::
DataSet
Make3DUniformDataSet2
();
vtkm
::
cont
::
DataSet
Make3DRegularDataSet0
();
vtkm
::
cont
::
DataSet
Make3DRegularDataSet1
();
...
...
@@ -245,6 +246,31 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DUniformDataSet1()
return
dataSet
;
}
inline
vtkm
::
cont
::
DataSet
MakeTestDataSet
::
Make3DUniformDataSet2
()
{
const
vtkm
::
Id
base_size
=
128
;
vtkm
::
cont
::
DataSetBuilderUniform
dsb
;
vtkm
::
Id3
dimensions
(
base_size
,
base_size
,
base_size
);
vtkm
::
cont
::
DataSet
dataSet
=
dsb
.
Create
(
dimensions
);
vtkm
::
cont
::
DataSetFieldAdd
dsf
;
const
vtkm
::
Id
nVerts
=
base_size
*
base_size
*
base_size
;
vtkm
::
Float32
*
pointvar
=
new
vtkm
::
Float32
[
nVerts
];
for
(
vtkm
::
Int32
z
=
0
;
z
<
base_size
;
++
z
)
for
(
vtkm
::
Int32
y
=
0
;
y
<
base_size
;
++
y
)
for
(
vtkm
::
Int32
x
=
0
;
x
<
base_size
;
++
x
)
{
vtkm
::
Int32
index
=
z
*
base_size
*
base_size
+
y
*
base_size
+
x
;
}
dsf
.
AddPointField
(
dataSet
,
"pointvar"
,
pointvar
,
nVerts
);
delete
[]
pointvar
;
return
dataSet
;
}
inline
vtkm
::
cont
::
DataSet
MakeTestDataSet
::
Make2DRectilinearDataSet0
()
{
vtkm
::
cont
::
DataSetBuilderRectilinear
dsb
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment