Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
amdis-core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
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
amdis
amdis-core
Commits
be2c0161
Commit
be2c0161
authored
5 years ago
by
Praetorius, Simon
Browse files
Options
Downloads
Patches
Plain Diff
write only rank 0 in parallel
parent
e07d2372
No related branches found
No related tags found
2 merge requests
!77
WIP: Solver and Preconditioners for istl backend
,
!71
write only rank 0 in parallel
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/amdis/Output.hpp
+12
-16
12 additions, 16 deletions
src/amdis/Output.hpp
with
12 additions
and
16 deletions
src/amdis/Output.hpp
+
12
−
16
View file @
be2c0161
...
...
@@ -14,14 +14,11 @@
#include
<stdexcept>
#endif
#ifdef HAVE_MPI
#include
<mpi.h>
#endif
/// Use the formatting librart fmtlib::fmt
#include
<fmt/core.h>
#include
<fmt/ostream.h>
#include
<amdis/Environment.hpp>
#include
<amdis/common/TypeTraits.hpp>
/**
...
...
@@ -59,21 +56,20 @@ namespace AMDiS
namespace
Impl
{
template
<
class
OStream
,
class
...
Args
>
OStream
&
msg
(
OStream
&
out
,
Args
&&
...
args
)
OStream
&
msg
(
OStream
&
out
,
bool
lineBreak
,
Args
&&
...
args
)
{
#ifdef AMDIS_HAS_MPI
int
rank
=
-
1
;
int
num_ranks
=
-
1
;
MPI_Comm_rank
(
MPI_COMM_WORLD
,
&
rank
);
MPI_Comm_size
(
MPI_COMM_WORLD
,
&
num_ranks
);
if
(
num_ranks
>
1
&&
rank
==
0
)
{
#if HAVE_MPI
if
(
Environment
::
mpiSize
()
>
1
&&
Environment
::
mpiRank
()
==
0
)
{
out
<<
"[0] "
;
fmt
::
print
(
out
,
FWD
(
args
)...);
}
else
if
(
num_ranks
==
1
)
{
if
(
lineBreak
)
{
out
<<
std
::
endl
;
}
}
else
if
(
Environment
::
mpiSize
()
==
1
)
{
fmt
::
print
(
out
,
FWD
(
args
)...);
if
(
lineBreak
)
{
out
<<
std
::
endl
;
}
}
#else
fmt
::
print
(
out
,
FWD
(
args
)...);
if
(
lineBreak
)
{
out
<<
std
::
endl
;
}
#endif
return
out
;
}
...
...
@@ -91,7 +87,7 @@ namespace AMDiS
template
<
class
...
Args
>
void
msg
(
Args
&&
...
args
)
{
Impl
::
msg
(
std
::
cout
,
FWD
(
args
)...)
<<
std
::
endl
;
Impl
::
msg
(
std
::
cout
,
true
,
FWD
(
args
)...);
}
...
...
@@ -105,7 +101,7 @@ namespace AMDiS
template
<
class
...
Args
>
void
msg_
(
Args
&&
...
args
)
{
Impl
::
msg
(
std
::
cout
,
FWD
(
args
)...);
Impl
::
msg
(
std
::
cout
,
false
,
FWD
(
args
)...);
}
...
...
@@ -119,7 +115,7 @@ namespace AMDiS
void
error_exit
(
Args
&&
...
args
)
{
#ifdef AMDIS_NO_THROW
Impl
::
msg
(
std
::
cerr
<<
"ERROR: "
,
FWD
(
args
)...)
<<
std
::
endl
;
Impl
::
msg
(
std
::
cerr
<<
"ERROR: "
,
true
,
FWD
(
args
)...);
#ifndef NDEBUG
assert
(
false
);
#else
...
...
@@ -150,7 +146,7 @@ namespace AMDiS
template
<
class
...
Args
>
void
warning
(
Args
&&
...
args
)
{
Impl
::
msg
(
std
::
cout
<<
"WARNING: "
,
FWD
(
args
)...)
<<
std
::
endl
;
Impl
::
msg
(
std
::
cout
<<
"WARNING: "
,
true
,
FWD
(
args
)...);
}
...
...
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