Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
vite
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
solverstack
vite
Commits
4ddc860a
Commit
4ddc860a
authored
Dec 11, 2019
by
François Trahay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OTF2: implement MPI communicators
parent
149cbb3d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
144 additions
and
31 deletions
+144
-31
src/parser/OTF2Parser/ParserDefinitionOTF2.cpp
src/parser/OTF2Parser/ParserDefinitionOTF2.cpp
+93
-29
src/parser/OTF2Parser/ParserDefinitionOTF2.hpp
src/parser/OTF2Parser/ParserDefinitionOTF2.hpp
+49
-0
src/parser/OTF2Parser/ParserEventOTF2.cpp
src/parser/OTF2Parser/ParserEventOTF2.cpp
+2
-2
No files found.
src/parser/OTF2Parser/ParserDefinitionOTF2.cpp
View file @
4ddc860a
...
...
@@ -84,6 +84,9 @@ map<uint32_t, OTF2_Function > ParserDefinitionOTF2::_functions;
map
<
uint32_t
,
const
char
*
>
ParserDefinitionOTF2
::
_strings
;
map
<
OTF2_GroupRef
,
OTF2_Group
*>
ParserDefinitionOTF2
::
_groups
;
map
<
OTF2_CommRef
,
OTF2_Comm
*>
ParserDefinitionOTF2
::
_comms
;
vector
<
Color
*>
ParserDefinitionOTF2
::
_default_colors
;
uint64_t
ParserDefinitionOTF2
::
_ticks_per_second
=
1
;
...
...
@@ -127,6 +130,12 @@ ParserDefinitionOTF2::~ParserDefinitionOTF2() {
ParserDefinitionOTF2
::
_location_group
.
end
());
ParserDefinitionOTF2
::
_system_tree_node
.
erase
(
ParserDefinitionOTF2
::
_system_tree_node
.
begin
(),
ParserDefinitionOTF2
::
_system_tree_node
.
end
());
ParserDefinitionOTF2
::
_functions
.
erase
(
ParserDefinitionOTF2
::
_functions
.
begin
(),
ParserDefinitionOTF2
::
_functions
.
end
());
ParserDefinitionOTF2
::
_groups
.
erase
(
ParserDefinitionOTF2
::
_groups
.
begin
(),
ParserDefinitionOTF2
::
_groups
.
end
());
ParserDefinitionOTF2
::
_comms
.
erase
(
ParserDefinitionOTF2
::
_comms
.
begin
(),
ParserDefinitionOTF2
::
_comms
.
end
());
}
void
ParserDefinitionOTF2
::
set_handlers
(
Trace
*
t
)
{
...
...
@@ -139,6 +148,7 @@ void ParserDefinitionOTF2::set_handlers(Trace *t) {
OTF2_GlobalDefReaderCallbacks_SetRegionCallback
(
_global_def_callbacks
,
&
handler_DefState
);
// SetGroupCallback to get containerType, stateType... ?
OTF2_GlobalDefReaderCallbacks_SetGroupCallback
(
_global_def_callbacks
,
&
handler_DefGroup
);
OTF2_GlobalDefReaderCallbacks_SetCommCallback
(
_global_def_callbacks
,
&
handler_DefComm
);
OTF2_GlobalDefReaderCallbacks_SetMetricMemberCallback
(
_global_def_callbacks
,
&
handler_DefMetricMember
);
OTF2_GlobalDefReaderCallbacks_SetMetricClassCallback
(
_global_def_callbacks
,
&
handler_DefMetricClass
);
...
...
@@ -293,35 +303,67 @@ OTF2_CallbackCode ParserDefinitionOTF2::handler_DefGroup(void * /*userD
OTF2_GroupRef
group_id
,
OTF2_StringRef
name_id
,
OTF2_GroupType
type
,
OTF2_Paradigm
/*paradigm*/
,
OTF2_GroupFlag
/*flags*/
,
uint32_t
/*numberOfMembers*/
,
const
uint64_t
*/
*
members
*/
)
{
switch
(
type
)
{
case
OTF2_GROUP_TYPE_UNKNOWN
:
break
;
case
OTF2_GROUP_TYPE_LOCATIONS
:
cout
<<
"New location group: group_id "
<<
group_id
<<
", name_id"
<<
name_id
<<
endl
;
break
;
case
OTF2_GROUP_TYPE_REGIONS
:
cout
<<
"New region group: group_id "
<<
group_id
<<
", name_id"
<<
name_id
<<
endl
;
break
;
case
OTF2_GROUP_TYPE_METRIC
:
cout
<<
"New metric group: group_id "
<<
group_id
<<
", name_id"
<<
name_id
<<
endl
;
break
;
case
OTF2_GROUP_TYPE_COMM_LOCATIONS
:
cout
<<
"New comm location group: group_id "
<<
group_id
<<
", name_id"
<<
name_id
<<
endl
;
break
;
case
OTF2_GROUP_TYPE_COMM_GROUP
:
cout
<<
"New comm group: group_id "
<<
group_id
<<
", name_id"
<<
name_id
<<
endl
;
break
;
case
OTF2_GROUP_TYPE_COMM_SELF
:
cout
<<
"New comm self: group_id "
<<
group_id
<<
", name_id"
<<
name_id
<<
endl
;
break
;
default
:
cout
<<
"type "
<<
type
<<
" not yet handled"
<<
endl
;
}
cout
<<
"
\t
Not yet implemented
\n
"
;
OTF2_Paradigm
paradigm
,
OTF2_GroupFlag
flags
,
uint32_t
numberOfMembers
,
const
uint64_t
*
members
)
{
if
(
type
==
OTF2_GROUP_TYPE_COMM_LOCATIONS
)
{
struct
OTF2_Group
*
g
=
new
struct
OTF2_Group
();
g
->
_id
=
group_id
;
g
->
_name
=
name_id
;
g
->
_type
=
type
;
g
->
_paradigm
=
paradigm
;
g
->
_flags
=
flags
;
g
->
_members
.
resize
(
numberOfMembers
);
g
->
_membersSize
=
numberOfMembers
;
for
(
uint32_t
i
=
0
;
i
<
numberOfMembers
;
i
++
)
{
g
->
_members
[
i
]
=
members
[
i
];
}
ParserDefinitionOTF2
::
_groups
[
group_id
]
=
g
;
}
else
{
switch
(
type
)
{
case
OTF2_GROUP_TYPE_UNKNOWN
:
break
;
case
OTF2_GROUP_TYPE_LOCATIONS
:
cout
<<
"New location group: group_id "
<<
group_id
<<
", name_id"
<<
name_id
<<
endl
;
break
;
case
OTF2_GROUP_TYPE_REGIONS
:
cout
<<
"New region group: group_id "
<<
group_id
<<
", name_id"
<<
name_id
<<
endl
;
break
;
case
OTF2_GROUP_TYPE_METRIC
:
cout
<<
"New metric group: group_id "
<<
group_id
<<
", name_id"
<<
name_id
<<
endl
;
break
;
case
OTF2_GROUP_TYPE_COMM_LOCATIONS
:
cout
<<
"New comm location group: group_id "
<<
group_id
<<
", name_id"
<<
name_id
<<
endl
;
break
;
case
OTF2_GROUP_TYPE_COMM_GROUP
:
cout
<<
"New comm group: group_id "
<<
group_id
<<
", name_id"
<<
name_id
<<
endl
;
break
;
case
OTF2_GROUP_TYPE_COMM_SELF
:
cout
<<
"New comm self: group_id "
<<
group_id
<<
", name_id"
<<
name_id
<<
endl
;
break
;
default
:
cout
<<
"type "
<<
type
<<
" not yet handled"
<<
endl
;
}
cout
<<
"
\t
Not yet implemented
\n
"
;
}
return
OTF2_CALLBACK_SUCCESS
;
}
OTF2_CallbackCode
ParserDefinitionOTF2
::
handler_DefComm
(
void
*
/*userData*/
,
OTF2_CommRef
self
,
OTF2_StringRef
name
,
OTF2_GroupRef
group
,
OTF2_CommRef
parent
)
{
// defines an MPI communicator
struct
OTF2_Comm
*
c
=
new
struct
OTF2_Comm
();
c
->
_id
=
self
;
c
->
_name
=
name
;
c
->
_group
=
group
;
c
->
_parent
=
parent
;
ParserDefinitionOTF2
::
_comms
[
self
]
=
c
;
return
OTF2_CALLBACK_SUCCESS
;
}
...
...
@@ -419,6 +461,28 @@ OTF2_Location* ParserDefinitionOTF2::get_location_by_id(const OTF2_LocationRef i
return
ParserDefinitionOTF2
::
_location
[
id
];
}
OTF2_Location
*
ParserDefinitionOTF2
::
get_location_in_communicator
(
const
OTF2_CommRef
comm
,
uint32_t
rank
)
{
struct
OTF2_Comm
*
c
=
_comms
[
comm
];
if
(
!
c
)
{
cerr
<<
"Error: cannot find communicator "
<<
comm
<<
endl
;
abort
();
}
struct
OTF2_Group
*
g
=
_groups
[
c
->
_group
];
if
(
!
g
)
{
cerr
<<
"Error: cannot find rank "
<<
rank
<<
" in communicator "
<<
comm
<<
endl
;
abort
();
}
if
(
rank
>
g
->
_members
.
size
())
{
cerr
<<
"Error: searching for rank "
<<
rank
<<
" in communicator "
<<
comm
<<
", but comm_size="
<<
g
->
_members
.
size
()
<<
", memberSize="
<<
g
->
_membersSize
<<
endl
;
*
(
int
*
)
0
=
0
;
abort
();
}
return
get_location_by_id
(
g
->
_members
[
rank
]);
}
OTF2_Function
ParserDefinitionOTF2
::
get_function_by_id
(
const
uint32_t
id
)
{
return
ParserDefinitionOTF2
::
_functions
[
id
];
}
...
...
src/parser/OTF2Parser/ParserDefinitionOTF2.hpp
View file @
4ddc860a
...
...
@@ -165,6 +165,23 @@ struct OTF2_MetricClass {
OTF2_RecorderKind
_recorderKind
;
};
struct
OTF2_Group
{
OTF2_GroupRef
_id
;
OTF2_StringRef
_name
;
OTF2_GroupType
_type
;
OTF2_Paradigm
_paradigm
;
OTF2_GroupFlag
_flags
;
std
::
vector
<
uint64_t
>
_members
;
size_t
_membersSize
;
};
struct
OTF2_Comm
{
OTF2_CommRef
_id
;
OTF2_StringRef
_name
;
OTF2_GroupRef
_group
;
OTF2_CommRef
_parent
;
};
/*!
*
* \class ParserDefinitionOTF2
...
...
@@ -194,6 +211,9 @@ private:
static
std
::
map
<
uint32_t
,
OTF2_Function
>
_functions
;
static
std
::
map
<
uint32_t
,
const
char
*>
_strings
;
static
std
::
map
<
OTF2_GroupRef
,
OTF2_Group
*>
_groups
;
static
std
::
map
<
OTF2_CommRef
,
OTF2_Comm
*>
_comms
;
static
uint64_t
_ticks_per_second
;
static
double
_first_timestamp
;
...
...
@@ -238,6 +258,12 @@ private:
uint32_t
numberOfMembers
,
const
uint64_t
*
members
);
static
OTF2_CallbackCode
handler_DefComm
(
void
*
userData
,
OTF2_CommRef
self
,
OTF2_StringRef
name
,
OTF2_GroupRef
group
,
OTF2_CommRef
parent
);
static
OTF2_CallbackCode
handler_DefMetricMember
(
void
*
userData
,
OTF2_MetricMemberRef
self
,
...
...
@@ -362,6 +388,13 @@ public:
*/
static
OTF2_Location
*
get_location_by_id
(
const
OTF2_LocationRef
id
);
/*!
* \fn get_location_by_communicator(const OTF2_CommRef comm, uint32_t rank)
* \brief Search for the location that corresponds to an MPI rank in an MPI communicator
* \param id the id we want the corresponding location
* \return The location associated to rank
*/
static
OTF2_Location
*
get_location_in_communicator
(
const
OTF2_CommRef
comm
,
uint32_t
rank
);
/*!
* \fn get_function_by_id(const uint32_t id)
...
...
@@ -371,6 +404,22 @@ public:
*/
static
OTF2_Function
get_function_by_id
(
const
uint32_t
id
);
/*!
* \fn get_group_by_id(const OTF2_GroupRef id)
* \brief Accessor for the function map
* \param id the id we want the corresponding group
* \return The OTF2_Group associated to id
*/
static
OTF2_Group
*
get_group_by_id
(
OTF2_GroupRef
id
);
/*!
* \fn get_comm_by_id(const OTF2_CommRef id)
* \brief Accessor for the function map
* \param id the id we want the corresponding comm
* \return The OTF2_Comm associated to id
*/
static
OTF2_Comm
*
get_comm_by_id
(
OTF2_CommRef
id
);
/*!
* \fn get_ticks_per_second()
* \brief Accessor for the tick_per_second (equivalent to a time unit)
...
...
src/parser/OTF2Parser/ParserEventOTF2.cpp
View file @
4ddc860a
...
...
@@ -314,7 +314,7 @@ OTF2_CallbackCode ParserEventOTF2::callback_MpiSend(OTF2_LocationRef sender,
Date
d
=
ParserDefinitionOTF2
::
get_timestamp
(
time
);
OTF2_Location
*
temp_sender
=
ParserDefinitionOTF2
::
get_location_by_id
(
sender
);
OTF2_Location
*
temp_receiver
=
ParserDefinitionOTF2
::
get_location_
by_id
(
receiver
);
OTF2_Location
*
temp_receiver
=
ParserDefinitionOTF2
::
get_location_
in_communicator
(
communicator
,
receiver
);
// The sender process may have no ancestor, so let's say that his ancestor is himself
OTF2_Location
*
temp_ancestor
=
temp_sender
;
...
...
@@ -432,7 +432,7 @@ OTF2_CallbackCode ParserEventOTF2::callback_MpiRecv(OTF2_LocationRef receiver,
Trace
*
t
=
(
Trace
*
)
userData
;
Date
d
=
ParserDefinitionOTF2
::
get_timestamp
(
time
);
OTF2_Location
*
temp_sender
=
ParserDefinitionOTF2
::
get_location_
by_id
(
sender
);
OTF2_Location
*
temp_sender
=
ParserDefinitionOTF2
::
get_location_
in_communicator
(
communicator
,
sender
);
OTF2_Location
*
temp_receiver
=
ParserDefinitionOTF2
::
get_location_by_id
(
receiver
);
// The sender process may have no ancestor, so let's say that his ancestor is himself
OTF2_Location
*
temp_ancestor
=
temp_sender
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment