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
f858dbf2
There was an error fetching the commit references. Please try again later.
Commit
f858dbf2
authored
6 years ago
by
Jakub Klinkovský
Browse files
Options
Downloads
Patches
Plain Diff
Used DevicePointer instead of passToDevice/freeFromDevice
RAII is a thing :-P
parent
320b5916
No related branches found
No related tags found
1 merge request
!3
Refactoring
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/benchmarks/spmv.h
+3
-3
3 additions, 3 deletions
tests/benchmarks/spmv.h
with
3 additions
and
3 deletions
tests/benchmarks/spmv.h
+
3
−
3
View file @
f858dbf2
...
...
@@ -15,6 +15,7 @@
#include
"benchmarks.h"
#include
<TNL/Containers/List.h>
#include
<TNL/DevicePointer.h>
#include
<TNL/Matrices/CSR.h>
#include
<TNL/Matrices/Ellpack.h>
#include
<TNL/Matrices/SlicedEllpack.h>
...
...
@@ -74,7 +75,7 @@ void setCudaTestMatrix( Matrix& matrix,
#ifdef HAVE_CUDA
typedef
typename
Matrix
::
IndexType
IndexType
;
typedef
typename
Matrix
::
RealType
RealType
;
Matrix
*
kernel_matrix
=
Devices
::
Cuda
::
passToDevice
(
matrix
);
DevicePointer
<
Matrix
>
kernel_matrix
(
matrix
);
dim3
cudaBlockSize
(
256
),
cudaGridSize
(
Devices
::
Cuda
::
getMaxGridSize
()
);
const
IndexType
cudaBlocks
=
roundUpDivision
(
matrix
.
getRows
(),
cudaBlockSize
.
x
);
const
IndexType
cudaGrids
=
roundUpDivision
(
cudaBlocks
,
Devices
::
Cuda
::
getMaxGridSize
()
);
...
...
@@ -83,10 +84,9 @@ void setCudaTestMatrix( Matrix& matrix,
cudaGridSize
.
x
=
cudaBlocks
%
Devices
::
Cuda
::
getMaxGridSize
();
setCudaTestMatrixKernel
<
Matrix
>
<<<
cudaGridSize
,
cudaBlockSize
>>>
(
kernel_matrix
,
elementsPerRow
,
gridIdx
);
(
&
kernel_matrix
.
template
modifyData
<
Devices
::
Cuda
>()
,
elementsPerRow
,
gridIdx
);
TNL_CHECK_CUDA_DEVICE
;
}
Devices
::
Cuda
::
freeFromDevice
(
kernel_matrix
);
#endif
}
...
...
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