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
ce8a681c
There was an error fetching the commit references. Please try again later.
Commit
ce8a681c
authored
4 years ago
by
Tomáš Oberhuber
Browse files
Options
Downloads
Patches
Plain Diff
Refactoring CSRAdaptiveKernelView.
parent
0785c1da
No related branches found
No related tags found
1 merge request
!89
To/matrices adaptive csr
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/TNL/Algorithms/Segments/CSRAdaptiveKernelView.hpp
+10
-2
10 additions, 2 deletions
src/TNL/Algorithms/Segments/CSRAdaptiveKernelView.hpp
with
10 additions
and
2 deletions
src/TNL/Algorithms/Segments/CSRAdaptiveKernelView.hpp
+
10
−
2
View file @
ce8a681c
...
@@ -46,6 +46,7 @@ segmentsReductionCSRAdaptiveKernel( BlocksView blocks,
...
@@ -46,6 +46,7 @@ segmentsReductionCSRAdaptiveKernel( BlocksView blocks,
Real
zero
,
Real
zero
,
Args
...
args
)
Args
...
args
)
{
{
using
BlockType
=
details
::
CSRAdaptiveKernelBlockDescriptor
<
Index
>
;
constexpr
int
CudaBlockSize
=
details
::
CSRAdaptiveKernelParameters
<
sizeof
(
Real
)
>::
CudaBlockSize
();
constexpr
int
CudaBlockSize
=
details
::
CSRAdaptiveKernelParameters
<
sizeof
(
Real
)
>::
CudaBlockSize
();
constexpr
int
WarpSize
=
Cuda
::
getWarpSize
();
constexpr
int
WarpSize
=
Cuda
::
getWarpSize
();
constexpr
int
WarpsCount
=
details
::
CSRAdaptiveKernelParameters
<
sizeof
(
Real
)
>::
WarpsCount
();
constexpr
int
WarpsCount
=
details
::
CSRAdaptiveKernelParameters
<
sizeof
(
Real
)
>::
WarpsCount
();
...
@@ -53,6 +54,8 @@ segmentsReductionCSRAdaptiveKernel( BlocksView blocks,
...
@@ -53,6 +54,8 @@ segmentsReductionCSRAdaptiveKernel( BlocksView blocks,
__shared__
Real
streamShared
[
WarpsCount
][
StreamedSharedElementsPerWarp
];
__shared__
Real
streamShared
[
WarpsCount
][
StreamedSharedElementsPerWarp
];
__shared__
Real
multivectorShared
[
CudaBlockSize
/
WarpSize
];
__shared__
Real
multivectorShared
[
CudaBlockSize
/
WarpSize
];
__shared__
BlockType
sharedBlocks
[
WarpsCount
];
const
Index
index
=
(
(
gridIdx
*
TNL
::
Cuda
::
getMaxGridSize
()
+
blockIdx
.
x
)
*
blockDim
.
x
)
+
threadIdx
.
x
;
const
Index
index
=
(
(
gridIdx
*
TNL
::
Cuda
::
getMaxGridSize
()
+
blockIdx
.
x
)
*
blockDim
.
x
)
+
threadIdx
.
x
;
const
Index
blockIdx
=
index
/
WarpSize
;
const
Index
blockIdx
=
index
/
WarpSize
;
if
(
blockIdx
>=
blocks
.
getSize
()
-
1
)
if
(
blockIdx
>=
blocks
.
getSize
()
-
1
)
...
@@ -63,14 +66,19 @@ segmentsReductionCSRAdaptiveKernel( BlocksView blocks,
...
@@ -63,14 +66,19 @@ segmentsReductionCSRAdaptiveKernel( BlocksView blocks,
Real
result
=
zero
;
Real
result
=
zero
;
bool
compute
(
true
);
bool
compute
(
true
);
const
Index
laneIdx
=
threadIdx
.
x
&
31
;
// & is cheaper than %
const
Index
laneIdx
=
threadIdx
.
x
&
31
;
// & is cheaper than %
const
details
::
CSRAdaptiveKernelBlockDescriptor
<
Index
>
block
=
blocks
[
blockIdx
];
const
Index
warpIdx
=
threadIdx
.
x
/
32
;
/*if( laneIdx == 0 )
sharedBlocks[ warpIdx ] = blocks[ blockIdx ];
__syncthreads();
const auto& block = sharedBlocks[ warpIdx ];*/
const
BlockType
block
=
blocks
[
blockIdx
];
const
Index
&
firstSegmentIdx
=
block
.
getFirstSegment
();
const
Index
&
firstSegmentIdx
=
block
.
getFirstSegment
();
const
Index
begin
=
offsets
[
firstSegmentIdx
];
const
Index
begin
=
offsets
[
firstSegmentIdx
];
const
auto
blockType
=
block
.
getType
();
const
auto
blockType
=
block
.
getType
();
if
(
blockType
==
details
::
Type
::
STREAM
)
// Stream kernel - many short segments per warp
if
(
blockType
==
details
::
Type
::
STREAM
)
// Stream kernel - many short segments per warp
{
{
const
Index
warpIdx
=
threadIdx
.
x
/
32
;
const
Index
end
=
begin
+
block
.
getSize
();
const
Index
end
=
begin
+
block
.
getSize
();
// Stream data to shared memory
// Stream data to shared memory
...
...
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