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
fa0a8417
There was an error fetching the commit references. Please try again later.
Commit
fa0a8417
authored
9 years ago
by
Tomáš Oberhuber
Browse files
Options
Downloads
Patches
Plain Diff
Tests of host <-> GPU data transfer performance.
parent
d1ef48e7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/benchmarks/tnl-benchmark-simple-heat-equation.h
+36
-2
36 additions, 2 deletions
tests/benchmarks/tnl-benchmark-simple-heat-equation.h
with
36 additions
and
2 deletions
tests/benchmarks/tnl-benchmark-simple-heat-equation.h
+
36
−
2
View file @
fa0a8417
...
...
@@ -25,9 +25,18 @@
#include
<core/tnlTimer.h>
#include
<core/tnlTimerRT.h>
#include
<core/tnlCuda.h>
#include
<core/vectors/tnlStaticVector.h>
#include
<mesh/tnlGrid.h>
using
namespace
std
;
struct
Data
{
double
time
,
tau
;
tnlStaticVector
<
2
,
double
>
c1
,
c2
,
c3
,
c4
;
tnlGrid
<
2
,
double
>
grid
;
};
#ifdef HAVE_CUDA
template
<
typename
Real
,
typename
Index
>
__device__
void
computeBlockResidue
(
Real
*
du
,
...
...
@@ -340,7 +349,7 @@ bool solveHeatEquationCuda( const tnlParameterContainer& parameters )
/****
* Explicit Euler solver
*/
const
int
maxCudaGridSize
=
tnlCuda
::
getMaxGridSize
();
//
const int maxCudaGridSize = tnlCuda::getMaxGridSize();
dim3
cudaBlockSize
(
16
,
16
);
dim3
cudaGridSize
(
gridXSize
/
16
+
(
gridXSize
%
16
!=
0
),
gridYSize
/
16
+
(
gridYSize
%
16
!=
0
)
);
...
...
@@ -357,7 +366,21 @@ bool solveHeatEquationCuda( const tnlParameterContainer& parameters )
while
(
time
<
finalTime
)
{
const
Real
timeLeft
=
finalTime
-
time
;
const
Real
currentTau
=
tau
<
timeLeft
?
tau
:
timeLeft
;
const
Real
currentTau
=
tau
<
timeLeft
?
tau
:
timeLeft
;
/*Real* kernelTime = tnlCuda::passToDevice( time );
Real* kernelTau = tnlCuda::passToDevice( tau );
typedef tnlStaticVector< 2, Real > Coordinates;
Coordinates c;
Coordinates* kernelC1 = tnlCuda::passToDevice( c );
Coordinates* kernelC2 = tnlCuda::passToDevice( c );
Coordinates* kernelC3 = tnlCuda::passToDevice( c );
Coordinates* kernelC4 = tnlCuda::passToDevice( c );
typedef tnlGrid< 2, Real, tnlCuda, int > Grid;
Grid g;
Grid* kernelGrid = tnlCuda::passToDevice( g );*/
Data
d
;
Data
*
kernelD
=
tnlCuda
::
passToDevice
(
d
);
/****
* Neumann boundary conditions
...
...
@@ -410,6 +433,17 @@ bool solveHeatEquationCuda( const tnlParameterContainer& parameters )
iteration
++
;
if
(
verbose
&&
iteration
%
1000
==
0
)
cout
<<
"Iteration: "
<<
iteration
<<
"
\t
Time:"
<<
time
<<
"
\r
"
<<
flush
;
tnlCuda
::
freeFromDevice
(
kernelD
);
/*tnlCuda::freeFromDevice( kernelTau );
tnlCuda::freeFromDevice( kernelC1 );
tnlCuda::freeFromDevice( kernelC2 );
tnlCuda::freeFromDevice( kernelC3 );
tnlCuda::freeFromDevice( kernelC4 );
tnlCuda::freeFromDevice( kernelGrid );*/
}
timer
.
stop
();
if
(
verbose
)
...
...
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