Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
openfpm_pdata
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Show more breadcrumbs
Sbalzarini Lab
Software
Parallel Computing
OpenFPM
openfpm_pdata
Commits
ef72e544
Commit
ef72e544
authored
3 years ago
by
Pietro Incardona
Browse files
Options
Downloads
Patches
Plain Diff
Separate read and write
parent
75d61202
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#4034
passed
3 years ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
example/Performance/memBW/main.cu
+63
-16
63 additions, 16 deletions
example/Performance/memBW/main.cu
with
63 additions
and
16 deletions
example/Performance/memBW/main.cu
+
63
−
16
View file @
ef72e544
...
...
@@ -5,7 +5,7 @@
//! Memory bandwidth with small calculations
template
<
typename
vector_type
,
typename
vector_type2
>
inline
__global__
void
translate_fill_prop
(
vector_type
vd_out
,
vector_type2
vd_in
)
inline
__global__
void
translate_fill_prop
_write
(
vector_type
vd_out
,
vector_type2
vd_in
)
{
auto
p
=
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
;
...
...
@@ -27,12 +27,34 @@ inline __global__ void translate_fill_prop(vector_type vd_out, vector_type2 vd_i
}
template
<
typename
vector_type
,
typename
vector_type2
>
inline
__global__
void
translate_fill_prop_read
(
vector_type
vd_out
,
vector_type2
vd_in
)
{
auto
p
=
blockIdx
.
x
*
blockDim
.
x
+
threadIdx
.
x
;
float
a
=
vd_out
.
template
get
<
0
>(
p
);
float
b
=
vd_out
.
template
get
<
1
>(
p
)[
0
];
float
c
=
vd_out
.
template
get
<
1
>(
p
)[
1
];
float
d
=
vd_out
.
template
get
<
2
>(
p
)[
0
][
0
];
float
e
=
vd_out
.
template
get
<
2
>(
p
)[
0
][
1
];
float
f
=
vd_out
.
template
get
<
2
>(
p
)[
1
][
0
];
float
g
=
vd_out
.
template
get
<
2
>(
p
)[
1
][
1
];
float
h
=
vd_in
.
template
get
<
0
>(
p
)[
0
];
float
i
=
vd_in
.
template
get
<
0
>(
p
)[
1
];
vd_in
.
template
get
<
0
>(
p
)[
0
]
+=
a
+
b
+
c
+
d
;
vd_in
.
template
get
<
0
>(
p
)[
1
]
+=
e
+
f
+
g
+
h
+
i
;
}
int
main
(
int
argc
,
char
*
argv
[])
{
init_wrappers
();
openfpm
::
vector_gpu
<
aggregate
<
double
,
double
[
2
],
double
[
2
][
2
]
>>
out
;
openfpm
::
vector_gpu
<
aggregate
<
double
[
2
]
>>
in
;
openfpm
::
vector_gpu
<
aggregate
<
float
,
float
[
2
],
float
[
2
][
2
]
>>
out
;
openfpm
::
vector_gpu
<
aggregate
<
float
[
2
]
>>
in
;
int
nele
=
16777216
;
...
...
@@ -52,29 +74,54 @@ int main(int argc, char *argv[])
for
(
int
i
=
0
;
i
<
101
;
i
++
)
{
cudaDeviceSynchronize
();
timer
t
;
t
.
start
();
cudaDeviceSynchronize
();
timer
t
;
t
.
start
();
CUDA_LAUNCH
(
translate_fill_prop_write
,
ite
,
out
.
toKernel
(),
in
.
toKernel
());
CUDA_LAUNCH
(
translate_fill_prop
,
ite
,
out
.
toKernel
(),
in
.
toKernel
()
);
cudaDeviceSynchronize
(
);
t
.
stop
();
if
(
i
>=
1
)
{
res
.
get
(
i
-
1
)
=
nele
*
4
*
13
/
t
.
getwct
()
*
1e-9
;}
std
::
cout
<<
"Time: "
<<
t
.
getwct
()
<<
std
::
endl
;
std
::
cout
<<
"BW: "
<<
nele
*
4
*
13
/
t
.
getwct
()
*
1e-9
<<
" GB/s"
<<
std
::
endl
;
}
double
mean_write
=
0.0
;
double
dev_write
=
0.0
;
standard_deviation
(
res
,
mean_write
,
dev_write
);
for
(
int
i
=
0
;
i
<
101
;
i
++
)
{
cudaDeviceSynchronize
();
timer
t
;
t
.
start
();
CUDA_LAUNCH
(
translate_fill_prop_read
,
ite
,
out
.
toKernel
(),
in
.
toKernel
());
cudaDeviceSynchronize
();
t
.
stop
();
t
.
stop
();
if
(
i
>=
1
)
{
res
.
get
(
i
-
1
)
=
nele
*
8
*
1
1
/
t
.
getwct
()
*
1e-9
;}
if
(
i
>=
1
)
{
res
.
get
(
i
-
1
)
=
nele
*
4
*
1
3
/
t
.
getwct
()
*
1e-9
;}
std
::
cout
<<
"Time: "
<<
t
.
getwct
()
<<
std
::
endl
;
std
::
cout
<<
"BW: "
<<
nele
*
8
*
1
1
/
t
.
getwct
()
*
1e-9
<<
" GB/s"
<<
std
::
endl
;
std
::
cout
<<
"Time: "
<<
t
.
getwct
()
<<
std
::
endl
;
std
::
cout
<<
"BW: "
<<
nele
*
4
*
1
3
/
t
.
getwct
()
*
1e-9
<<
" GB/s"
<<
std
::
endl
;
}
double
mean
=
0.0
;
double
dev
=
0.0
;
standard_deviation
(
res
,
mean
,
dev
);
double
mean
_read
=
0.0
;
double
dev
_read
=
0.0
;
standard_deviation
(
res
,
mean
_read
,
dev_read
);
std
::
cout
<<
"Average: "
<<
mean
<<
" deviation: "
<<
dev
<<
std
::
endl
;
std
::
cout
<<
"Average READ: "
<<
mean_read
<<
" deviation: "
<<
dev_read
<<
std
::
endl
;
std
::
cout
<<
"Average WRITE: "
<<
mean_write
<<
" deviation: "
<<
dev_write
<<
std
::
endl
;
}
#else
...
...
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