Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tnl-dev
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
TNL
tnl-dev
Commits
cb834c84
There was an error fetching the commit references. Please try again later.
Commit
cb834c84
authored
6 years ago
by
Tomáš Oberhuber
Browse files
Options
Downloads
Patches
Plain Diff
Added GridTraverserBenchmarkHelper.
parent
1ace5365
No related branches found
No related tags found
1 merge request
!20
Traversers optimizations
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Benchmarks/Traversers/GridTraversersBenchmark_1D.h
+104
-18
104 additions, 18 deletions
src/Benchmarks/Traversers/GridTraversersBenchmark_1D.h
with
104 additions
and
18 deletions
src/Benchmarks/Traversers/GridTraversersBenchmark_1D.h
+
104
−
18
View file @
cb834c84
...
...
@@ -28,13 +28,110 @@ namespace TNL {
namespace
Benchmarks
{
namespace
Traversers
{
template
<
typename
Grid
,
typename
Device
=
typename
Grid
::
DeviceType
>
class
GridTraverserBenchmarkHelper
{};
template
<
typename
Grid
>
class
GridTraverserBenchmarkHelper
<
Grid
,
Devices
::
Host
>
{
public:
using
GridType
=
Grid
;
using
GridPointer
=
Pointers
::
SharedPointer
<
Grid
>
;
using
RealType
=
typename
GridType
::
RealType
;
using
IndexType
=
typename
GridType
::
IndexType
;
using
CoordinatesType
=
typename
Grid
::
CoordinatesType
;
using
MeshFunction
=
Functions
::
MeshFunction
<
Grid
>
;
using
MeshFunctionPointer
=
Pointers
::
SharedPointer
<
MeshFunction
>
;
using
Cell
=
typename
Grid
::
template
EntityType
<
1
,
Meshes
::
GridEntityNoStencilStorage
>;
using
Traverser
=
Meshes
::
Traverser
<
Grid
,
Cell
>
;
using
WriteOneTraverserUserDataType
=
WriteOneUserData
<
MeshFunctionPointer
>
;
using
WriteOneEntitiesProcessorType
=
WriteOneEntitiesProcessor
<
WriteOneTraverserUserDataType
>
;
static
void
noBCTraverserTest
(
const
GridPointer
&
grid
,
WriteOneTraverserUserDataType
&
userData
,
std
::
size_t
size
)
{
/*Meshes::GridTraverser< Grid >::template processEntities< Cell, WriteOneEntitiesProcessorType, WriteOneTraverserUserDataType, false >(
grid,
CoordinatesType( 0 ),
grid->getDimensions() - CoordinatesType( 1 ),
userData );*/
const
CoordinatesType
begin
(
0
);
const
CoordinatesType
end
=
CoordinatesType
(
size
)
-
CoordinatesType
(
1
);
//MeshFunction* _u = &u.template modifyData< Device >();
Cell
entity
(
*
grid
);
for
(
IndexType
x
=
begin
.
x
();
x
<=
end
.
x
();
x
++
)
{
entity
.
getCoordinates
().
x
()
=
x
;
entity
.
refresh
();
WriteOneEntitiesProcessorType
::
processEntity
(
entity
.
getMesh
(),
userData
,
entity
);
}
}
};
template
<
typename
Grid
>
class
GridTraverserBenchmarkHelper
<
Grid
,
Devices
::
Cuda
>
{
public:
using
GridType
=
Grid
;
using
GridPointer
=
Pointers
::
SharedPointer
<
Grid
>
;
using
RealType
=
typename
GridType
::
RealType
;
using
IndexType
=
typename
GridType
::
IndexType
;
using
CoordinatesType
=
typename
Grid
::
CoordinatesType
;
using
MeshFunction
=
Functions
::
MeshFunction
<
Grid
>
;
using
MeshFunctionPointer
=
Pointers
::
SharedPointer
<
MeshFunction
>
;
using
Cell
=
typename
Grid
::
template
EntityType
<
1
,
Meshes
::
GridEntityNoStencilStorage
>;
using
Traverser
=
Meshes
::
Traverser
<
Grid
,
Cell
>
;
using
WriteOneTraverserUserDataType
=
WriteOneUserData
<
MeshFunctionPointer
>
;
using
WriteOneEntitiesProcessorType
=
WriteOneEntitiesProcessor
<
WriteOneTraverserUserDataType
>
;
static
void
noBCTraverserTest
(
const
GridPointer
&
grid
,
WriteOneTraverserUserDataType
&
userData
,
std
::
size_t
size
)
{
#ifdef HAVE_CUDA
dim3
blockSize
(
256
),
blocksCount
,
gridsCount
;
Devices
::
Cuda
::
setupThreads
(
blockSize
,
blocksCount
,
gridsCount
,
size
);
dim3
gridIdx
;
for
(
gridIdx
.
x
=
0
;
gridIdx
.
x
<
gridsCount
.
x
;
gridIdx
.
x
++
)
{
dim3
gridSize
;
Devices
::
Cuda
::
setupGrid
(
blocksCount
,
gridsCount
,
gridIdx
,
gridSize
);
Meshes
::
GridTraverser1D
<
RealType
,
IndexType
,
Cell
,
WriteOneTraverserUserDataType
,
WriteOneEntitiesProcessorType
>
<<<
blocksCount
,
blockSize
>>>
(
&
grid
.
template
getData
<
Devices
::
Cuda
>(),
userData
,
CoordinatesType
(
0
),
CoordinatesType
(
size
)
-
CoordinatesType
(
1
),
gridIdx
.
x
);
}
#endif
}
};
template
<
typename
Device
,
typename
Real
,
typename
Index
>
class
GridTraversersBenchmark
<
1
,
Device
,
Real
,
Index
>
{
public:
using
Vector
=
Containers
::
Vector
<
Real
,
Device
,
Index
>
;
using
Grid
=
Meshes
::
Grid
<
1
,
Real
,
Device
,
Index
>
;
using
GridPointer
=
Pointers
::
SharedPointer
<
Grid
>
;
...
...
@@ -130,24 +227,13 @@ class GridTraversersBenchmark< 1, Device, Real, Index >
void
writeOneUsingTraverser
()
{
using
CoordinatesType
=
typename
Grid
::
CoordinatesType
;
traverser
.
template
processAllEntities
<
WriteOneTraverserUserDataType
,
WriteOneEntitiesProcessorType
>
(
grid
,
userData
);
//
traverser.template processAllEntities< WriteOneTraverserUserDataType, WriteOneEntitiesProcessorType >
//
( grid, userData );
/*Meshes::GridTraverser< Grid >::template processEntities< Cell, WriteOneEntitiesProcessorType, WriteOneTraverserUserDataType, false >(
grid,
CoordinatesType( 0 ),
grid->getDimensions() - CoordinatesType( 1 ),
userData );*/
/*const CoordinatesType begin( 0 );
const CoordinatesType end = CoordinatesType( size ) - CoordinatesType( 1 );
MeshFunction* _u = &u.template modifyData< Device >();
Cell entity( *grid );
for( Index x = begin.x(); x <= end.x(); x ++ )
{
entity.getCoordinates().x() = x;
entity.refresh();
WriteOneEntitiesProcessorType::processEntity( entity.getMesh(), userData, entity );
}*/
GridTraverserBenchmarkHelper
<
Grid
>::
noBCTraverserTest
(
grid
,
userData
,
size
);
}
void
traverseUsingPureC
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment