Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Y
YACO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mpim-sw
YACO
Commits
a427a10d
Commit
a427a10d
authored
3 months ago
by
Nils-Arne Dreier
Browse files
Options
Downloads
Patches
Plain Diff
fix: add critical regions for FDB and dont parallelize over levels
parent
36b3190a
Branches
feature_openmp
Branches containing commit
No related tags found
1 merge request
!48
Feature openmp
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/data_handler/fdb_writer.cpp
+8
-3
8 additions, 3 deletions
src/data_handler/fdb_writer.cpp
src/yac/yac2_input.cpp
+3
-1
3 additions, 1 deletion
src/yac/yac2_input.cpp
with
11 additions
and
4 deletions
src/data_handler/fdb_writer.cpp
+
8
−
3
View file @
a427a10d
...
...
@@ -142,7 +142,10 @@ class GRIBMessage {
if
(
res
!=
0
)
{
throw
std
::
runtime_error
(
"GRIB: Failed to get raw message: "
+
std
::
string
(
codes_get_error_message
(
res
)));
}
fdb
.
archive
(
key
,
data
,
data_length
);
#pragma omp critical(FDB)
{
fdb
.
archive
(
key
,
data
,
data_length
);
}
}
};
...
...
@@ -347,7 +350,6 @@ void FDBWriter::Impl::handle(Collection& collection, const chrono::DateTime& tim
return
has_missing_values
?
"1"
:
"0"
;
});
#pragma omp taskloop
for
(
collection_index
=
0
;
collection_index
<
collection
.
size
();
++
collection_index
)
{
auto
&
values
=
collection
.
at
(
collection_index
);
...
...
@@ -377,7 +379,10 @@ void FDBWriter::Impl::handle(Collection& collection, const chrono::DateTime& tim
msg
.
archive
(
*
fdb_
,
key
);
}
fdb_
->
flush
();
#pragma omp critical(FDB)
{
fdb_
->
flush
();
}
}
void
FDBWriter
::
handle
(
Collection
&
collection
,
const
chrono
::
DateTime
&
timestep_begin
,
const
chrono
::
DateTime
&
timestep_end
)
...
...
This diff is collapsed.
Click to expand it.
src/yac/yac2_input.cpp
+
3
−
1
View file @
a427a10d
...
...
@@ -88,9 +88,10 @@ void Yac2Input::run()
}
chrono
::
Duration
timestep_duration
(
timeStep_
);
for
(;
timestep_end
<=
end_time
;
timestep_end
+=
timestep_duration
)
{
#pragma omp parallel
#pragma omp single
for
(;
timestep_end
<=
end_time
;
timestep_end
+=
timestep_duration
)
{
{
for
(
std
::
size_t
collectionIdx
=
0
;
collectionIdx
<
collections_
.
size
();
++
collectionIdx
)
{
std
::
vector
<
double
*>
buffers
(
collections_
[
collectionIdx
].
size
(),
nullptr
);
for
(
std
::
size_t
fieldIdx
=
0
;
fieldIdx
<
collections_
[
collectionIdx
].
size
();
++
fieldIdx
)
{
...
...
@@ -115,6 +116,7 @@ void Yac2Input::run()
}
// taskwait ensures that all data is written and the buffers can be used again
#pragma omp taskwait
}
}
}
...
...
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