Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
code
pugs
Commits
c335b776
Commit
c335b776
authored
1 year ago
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Replace std::source_location by SourceLocation
parent
31fefbeb
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!176
Add HDF5 support
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/mesh/ParallelChecker.hpp
+13
-15
13 additions, 15 deletions
src/mesh/ParallelChecker.hpp
with
13 additions
and
15 deletions
src/mesh/ParallelChecker.hpp
+
13
−
15
View file @
c335b776
...
...
@@ -6,7 +6,7 @@
#include
<utils/HDF5.hpp>
#include
<utils/Messenger.hpp>
#include
<
experimental/s
ource
_l
ocation>
#include
<
utils/S
ource
L
ocation
.hpp
>
#include
<fstream>
#include
<utils/Demangle.hpp>
...
...
@@ -18,7 +18,7 @@ namespace parallel
template
<
typename
DataType
,
ItemType
item_type
,
typename
ConnectivityPtr
>
void
check
(
const
ItemValue
<
DataType
,
item_type
,
ConnectivityPtr
>&
item_value
,
const
std
::
string
&
name
,
const
std
::
experimental
::
s
ource
_l
ocation
&
source_location
=
std
::
experimental
::
s
ource
_l
ocation
::
current
()
);
const
S
ource
L
ocation
&
source_location
=
S
ource
L
ocation
{}
);
class
ParallelChecker
{
...
...
@@ -32,13 +32,13 @@ class ParallelChecker
ParallelChecker
()
=
default
;
void
_printHeader
(
const
std
::
string
&
name
,
const
std
::
experimental
::
s
ource
_l
ocation
&
source_location
)
const
_printHeader
(
const
std
::
string
&
name
,
const
S
ource
L
ocation
&
source_location
)
const
{
std
::
cout
<<
rang
::
fg
::
cyan
<<
" | "
<<
rang
::
fgB
::
cyan
<<
"parallel checker"
<<
rang
::
fg
::
cyan
<<
" for
\"
"
<<
rang
::
fgB
::
magenta
<<
name
<<
rang
::
fg
::
cyan
<<
"
\"
tag "
<<
rang
::
fgB
::
blue
<<
m_tag
<<
rang
::
fg
::
reset
<<
'\n'
;
std
::
cout
<<
rang
::
fg
::
cyan
<<
" | from "
<<
rang
::
fgB
::
blue
<<
source_location
.
file
_
name
()
<<
rang
::
fg
::
reset
<<
':'
<<
rang
::
style
::
bold
<<
source_location
.
line
()
<<
rang
::
style
::
reset
<<
'\n'
;
std
::
cout
<<
rang
::
fg
::
cyan
<<
" | from "
<<
rang
::
fgB
::
blue
<<
source_location
.
filename
()
<<
rang
::
fg
::
reset
<<
':'
<<
rang
::
style
::
bold
<<
source_location
.
line
()
<<
rang
::
style
::
reset
<<
'\n'
;
}
public
:
...
...
@@ -52,16 +52,14 @@ class ParallelChecker
}
template
<
typename
DataType
,
ItemType
item_type
,
typename
ConnectivityPtr
>
friend
void
check
(
const
ItemValue
<
DataType
,
item_type
,
ConnectivityPtr
>&
,
const
std
::
string
&
,
const
std
::
experimental
::
source_location
&
);
friend
void
check
(
const
ItemValue
<
DataType
,
item_type
,
ConnectivityPtr
>&
,
const
std
::
string
&
,
const
SourceLocation
&
);
private
:
template
<
typename
DataType
,
ItemType
item_type
,
typename
ConnectivityPtr
>
void
write
(
const
ItemValue
<
DataType
,
item_type
,
ConnectivityPtr
>&
item_value
,
const
std
::
string
&
name
,
const
std
::
experimental
::
s
ource
_l
ocation
&
source_location
)
const
S
ource
L
ocation
&
source_location
)
{
this
->
_printHeader
(
name
,
source_location
);
...
...
@@ -76,8 +74,8 @@ class ParallelChecker
auto
values_group_id
=
HDF5
::
createOrOpenGroup
(
file_id
,
"/values"
);
auto
group_id
=
HDF5
::
createOrOpenGroup
(
values_group_id
,
std
::
to_string
(
m_tag
));
HDF5
::
writeAttribute
(
group_id
,
"filename"
,
std
::
string
{
source_location
.
file
_
name
()});
HDF5
::
writeAttribute
(
group_id
,
"function"
,
source_location
.
function
_name
());
HDF5
::
writeAttribute
(
group_id
,
"filename"
,
std
::
string
{
source_location
.
filename
()});
HDF5
::
writeAttribute
(
group_id
,
"function"
,
source_location
.
function
());
HDF5
::
writeAttribute
(
group_id
,
"line"
,
static_cast
<
size_t
>
(
source_location
.
line
()));
HDF5
::
writeAttribute
(
group_id
,
"name"
,
name
);
...
...
@@ -122,7 +120,7 @@ class ParallelChecker
void
compare
(
const
ItemValue
<
DataType
,
item_type
,
ConnectivityPtr
>&
item_value
,
const
std
::
string
&
name
,
const
std
::
experimental
::
s
ource
_l
ocation
&
source_location
)
const
S
ource
L
ocation
&
source_location
)
{
this
->
_printHeader
(
name
,
source_location
);
...
...
@@ -172,7 +170,7 @@ class ParallelChecker
std
::
cout
<<
rang
::
fg
::
cyan
<<
" | "
<<
rang
::
fgB
::
magenta
<<
"reference function "
<<
rang
::
fgB
::
blue
<<
reference_function_name
<<
rang
::
fg
::
reset
<<
'\n'
;
std
::
cout
<<
rang
::
fg
::
cyan
<<
" | "
<<
rang
::
fgB
::
magenta
<<
"target function "
<<
rang
::
fgB
::
blue
<<
source_location
.
function
_name
()
<<
rang
::
fg
::
reset
<<
'\n'
;
<<
source_location
.
function
()
<<
rang
::
fg
::
reset
<<
'\n'
;
}
if
(
not
parallel
::
allReduceAnd
(
is_comparable
))
{
...
...
@@ -318,7 +316,7 @@ template <typename DataType, ItemType item_type, typename ConnectivityPtr>
void
check
(
const
ItemValue
<
DataType
,
item_type
,
ConnectivityPtr
>&
item_value
,
const
std
::
string
&
name
,
const
std
::
experimental
::
s
ource
_l
ocation
&
source_location
)
const
S
ource
L
ocation
&
source_location
)
{
const
bool
write_mode
=
(
parallel
::
size
()
==
1
);
...
...
@@ -337,7 +335,7 @@ template <typename DataType, ItemType item_type, typename ConnectivityPtr>
void
check
(
const
ItemValue
<
DataType
,
item_type
,
ConnectivityPtr
>&
,
const
std
::
string
&
,
const
std
::
experimental
::
s
ource
_l
ocation
&
=
std
::
experimental
::
s
ource
_l
ocation
::
current
()
)
const
S
ource
L
ocation
&
=
S
ource
L
ocation
{}
)
{
throw
UnexpectedError
(
"parallel checker cannot be used without HDF5 support"
);
}
...
...
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