Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openfoam
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor 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
Development
openfoam
Commits
686f2a39
Commit
686f2a39
authored
1 year ago
by
Andrew Heather
Browse files
Options
Downloads
Plain Diff
Merge branch 'extrae-profiling' into 'develop'
ENH: add profiling hooks for Extrae into the OpenFOAM profiling (
#3043
) See merge request
!652
parents
e8f0cfb2
0fbdbb83
No related branches found
No related tags found
1 merge request
!652
ENH: add profiling hooks for Extrae into the OpenFOAM profiling (#3043)
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CONTRIBUTORS.md
+1
-0
1 addition, 0 deletions
CONTRIBUTORS.md
src/OpenFOAM/Make/options
+6
-0
6 additions, 0 deletions
src/OpenFOAM/Make/options
src/OpenFOAM/global/profiling/profilingTrigger.C
+117
-0
117 additions, 0 deletions
src/OpenFOAM/global/profiling/profilingTrigger.C
with
124 additions
and
0 deletions
CONTRIBUTORS.md
+
1
−
0
View file @
686f2a39
...
@@ -46,6 +46,7 @@ It is likely incomplete...
...
@@ -46,6 +46,7 @@ It is likely incomplete...
-
Victor Olesen
-
Victor Olesen
-
Evangelos Papoutsis-Kiachagias
-
Evangelos Papoutsis-Kiachagias
-
Juho Peltola
-
Juho Peltola
-
Josep Pocurull
-
Johan Roenby
-
Johan Roenby
-
Henrik Rusche
-
Henrik Rusche
-
Bruno Santos
-
Bruno Santos
...
...
This diff is collapsed.
Click to expand it.
src/OpenFOAM/Make/options
+
6
−
0
View file @
686f2a39
...
@@ -10,6 +10,12 @@ ifeq (,$(findstring ~libz,$(WM_COMPILE_CONTROL)))
...
@@ -10,6 +10,12 @@ ifeq (,$(findstring ~libz,$(WM_COMPILE_CONTROL)))
LIB_LIBS += -lz
LIB_LIBS += -lz
endif
endif
/* extrae profiling hooks [https://tools.bsc.es/extrae] */
ifeq (,$(findstring windows,$(WM_OSTYPE)))
ifeq (,$(findstring ~extrae,$(WM_COMPILE_CONTROL)))
EXE_INC += -DHAVE_EXTRAE
endif
endif
/* Never self-link (WM_PROJECT == OpenFOAM), but do link to Pstream */
/* Never self-link (WM_PROJECT == OpenFOAM), but do link to Pstream */
...
...
This diff is collapsed.
Click to expand it.
src/OpenFOAM/global/profiling/profilingTrigger.C
+
117
−
0
View file @
686f2a39
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
Copyright (C) 2009-2016 Bernhard Gschaider
Copyright (C) 2009-2016 Bernhard Gschaider
Copyright (C) 2016-2023 OpenCFD Ltd.
Copyright (C) 2016-2023 OpenCFD Ltd.
Copyright (C) 2023 Josep Pocurull Serra, Barcelona Supercomputing Center
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
License
License
This file is part of OpenFOAM.
This file is part of OpenFOAM.
...
@@ -30,6 +31,115 @@ License
...
@@ -30,6 +31,115 @@ License
#include
"profilingTrigger.H"
#include
"profilingTrigger.H"
#include
"profilingInformation.H"
#include
"profilingInformation.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// Extrae profiling hooks
// ----------------------
// https://tools.bsc.es/extrae
// ----------------------
#ifdef HAVE_EXTRAE
#include
<map>
#include
<utility>
// Weak functions for Extrae C api
extern
"C"
{
typedef
unsigned
extrae_type_t
;
typedef
unsigned
long
long
extrae_value_t
;
// Adds to the Paraver Configuration File human readable information
// regarding type and its values.
void
Extrae_define_event_type
(
extrae_type_t
*
type
,
char
*
type_description
,
unsigned
*
nvalues
,
extrae_value_t
*
values
,
char
**
values_description
)
__attribute__
((
weak
));
// Adds a single timestamped event into the tracefile
void
Extrae_event
(
extrae_type_t
type
,
extrae_value_t
value
)
__attribute__
((
weak
));
}
// End extern "C"
// Descriptor for the events
static
char
myExtrae_description
[]
=
"OpenFOAM Extrae Profiling"
;
static
void
open_extrae_region
(
const
std
::
string
&
name
)
{
// Event history (by name) of profiling triggers
static
std
::
map
<
std
::
string
,
extrae_value_t
>
event_history
;
// Scratch space for transcribing map -> flat lists
static
Foam
::
DynamicList
<
char
*>
eventNames
;
static
Foam
::
DynamicList
<
extrae_value_t
>
eventValues
;
if
(
event_history
.
empty
())
{
event_history
.
insert
(
std
::
make_pair
(
"End"
,
0
));
}
extrae_type_t
event_type
=
7000
;
extrae_value_t
event_name
;
// Check if there is already an event with that name
auto
iter
=
event_history
.
find
(
name
);
if
(
iter
!=
event_history
.
end
())
{
event_name
=
iter
->
second
;
}
else
{
// Update extrae defined events
event_name
=
static_cast
<
extrae_value_t
>
(
event_history
.
size
());
event_history
.
insert
(
std
::
make_pair
(
name
,
event_name
));
unsigned
numEvents
=
event_history
.
size
();
const
Foam
::
label
len
(
numEvents
);
eventNames
.
resize_nocopy
(
len
);
eventValues
.
resize_nocopy
(
len
);
Foam
::
label
i
=
0
;
for
(
const
auto
&
iter
:
event_history
)
{
eventNames
[
i
]
=
const_cast
<
char
*>
(
iter
.
first
.
data
());
eventValues
[
i
]
=
iter
.
second
;
++
i
;
}
Extrae_define_event_type
(
&
event_type
,
myExtrae_description
,
&
numEvents
,
eventValues
.
data
(),
eventNames
.
data
()
);
}
Extrae_event
(
event_type
,
event_name
);
}
static
void
close_extrae_region
()
{
Extrae_event
(
7000
,
0
);
}
#endif
/* HAVE_EXTRAE */
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam
::
profilingTrigger
::
profilingTrigger
()
noexcept
Foam
::
profilingTrigger
::
profilingTrigger
()
noexcept
...
@@ -48,6 +158,9 @@ Foam::profilingTrigger::profilingTrigger(const std::string& name)
...
@@ -48,6 +158,9 @@ Foam::profilingTrigger::profilingTrigger(const std::string& name)
:
:
ptr_
(
profiling
::
New
(
name
))
ptr_
(
profiling
::
New
(
name
))
{
{
#ifdef HAVE_EXTRAE
if
(
Extrae_event
)
open_extrae_region
(
std
::
string
(
name
));
#endif
}
}
...
@@ -69,6 +182,10 @@ bool Foam::profilingTrigger::running() const noexcept
...
@@ -69,6 +182,10 @@ bool Foam::profilingTrigger::running() const noexcept
void
Foam
::
profilingTrigger
::
stop
()
void
Foam
::
profilingTrigger
::
stop
()
{
{
#ifdef HAVE_EXTRAE
if
(
Extrae_event
)
close_extrae_region
();
#endif
if
(
ptr_
)
if
(
ptr_
)
{
{
// profiling info pointer managed by pool storage, so no delete here
// profiling info pointer managed by pool storage, so no delete here
...
...
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