Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
demo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
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
Show more breadcrumbs
Georgiana Mania
demo
Commits
2ee992ae
Commit
2ee992ae
authored
1 month ago
by
Panos Adamidis
Browse files
Options
Downloads
Patches
Plain Diff
Adding scenario scenario 1cmacro
parent
43d76091
No related branches found
Branches containing commit
Tags
v1.3
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
main.cpp
+33
-0
33 additions, 0 deletions
main.cpp
with
33 additions
and
0 deletions
main.cpp
+
33
−
0
View file @
2ee992ae
...
...
@@ -119,6 +119,35 @@ void scenario_1c(double* array, int nblocks, int nlev, int nproma) {
}
void
scenario_1cmacro
(
double
*
array
,
int
nblocks
,
int
nlev
,
int
nproma
)
{
std
::
cout
<<
"scenario 1cmacro: +ACC CPU:LayoutLeft GPU:LayoutLeft; as ICON pointer view(array, ncells, nlev); d_view(jc, jk) ----- "
<<
std
::
endl
;
using
space_t
=
Kokkos
::
DefaultExecutionSpace
::
memory_space
;
int
ncells
=
nblocks
*
nproma
;
#if defined(DEMO_DEVICE)
Kokkos
::
View
<
double
**
,
Kokkos
::
LayoutLeft
>
d_view
(
array
,
ncells
,
nlev
);
#else
Kokkos
::
View
<
double
**
,
Kokkos
::
LayoutLeft
,
Kokkos
::
MemoryUnmanaged
>
d_view
(
array
,
ncells
,
nlev
);
#endif
timer
.
reset
();
Kokkos
::
parallel_for
(
""
,
Kokkos
::
RangePolicy
<>
(
0
,
ncells
),
KOKKOS_LAMBDA
(
const
int
jc
)
{
for
(
int
jk
=
0
;
jk
<
nlev
;
++
jk
)
{
int
p
=
jk
*
ncells
+
jc
;
check_bounds_2d
(
jc
,
jk
,
d_view
.
extent
(
0
),
d_view
.
extent
(
1
));
d_view
(
jc
,
jk
)
=
p
;
}
});
Kokkos
::
fence
();
printf
(
"Time = %f ms
\n\n
"
,
timer
.
seconds
()
*
1000
);
}
void
scenario_2
(
double
*
array
,
int
nblocks
,
int
nlev
,
int
nproma
,
bool
print
=
true
)
{
if
(
print
)
std
::
cout
<<
"scenario 2: Right layout; view(array, nproma, nlev, nblocks); d_view(jc, jk, jb) ----- "
<<
std
::
endl
;
...
...
@@ -605,6 +634,10 @@ int main() {
std
::
function
<
void
(
double
*
,
int
,
int
,
int
)
>
s_1c
=
scenario_1c
;
openacc_calls
(
array
,
nblocks
,
nlev
,
nproma
,
s_1c
);
memset
(
array
,
0.0
,
sizeof
(
array
));
std
::
function
<
void
(
double
*
,
int
,
int
,
int
)
>
s_1cmacro
=
scenario_1cmacro
;
openacc_calls
(
array
,
nblocks
,
nlev
,
nproma
,
s_1cmacro
);
memset
(
array
,
0.0
,
sizeof
(
array
));
std
::
function
<
void
(
double
*
,
int
,
int
,
int
)
>
s_7b
=
scenario_7b
;
openacc_calls
(
array
,
nblocks
,
nlev
,
nproma
,
s_7b
);
...
...
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