Skip to content

Commit a91b0b8

Browse files
cchambreaukingshuk00
authored andcommitted
Modifications for changes to proposed MPI_T Events API as well as minor fixes.
Signed-off-by: Chris Chambreau <chambreau1@llnl.gov>
1 parent 2bb827b commit a91b0b8

File tree

6 files changed

+41
-11
lines changed

6 files changed

+41
-11
lines changed

ompi/include/mpi.h.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -928,12 +928,12 @@ typedef enum {
928928
/*
929929
* MPIT source ordering
930930
*/
931-
enum ompi_mpi_t_order_t {
931+
enum ompi_mpi_t_source_order_t {
932932
MPI_T_ORDERED,
933933
MPI_T_UNORDERED,
934934
};
935935

936-
typedef enum ompi_mpi_t_order_t MPI_T_order;
936+
typedef enum ompi_mpi_t_source_order_t MPI_T_source_order;
937937

938938
/*
939939
* MPI Tool event functions
@@ -3025,7 +3025,7 @@ OMPI_DECLSPEC int PMPI_T_event_get_timestamp (MPI_T_event_instance event, MPI_C
30253025
OMPI_DECLSPEC int PMPI_T_event_get_source (MPI_T_event_instance event, int *source_index);
30263026
OMPI_DECLSPEC int PMPI_T_source_get_num (int *num_source);
30273027
OMPI_DECLSPEC int PMPI_T_source_get_info (int source_id, char *name, int *name_len,
3028-
char *desc, int *desc_len, MPI_T_order *ordering,
3028+
char *desc, int *desc_len, MPI_T_source_order *ordering,
30293029
MPI_Count *ticks_per_second, MPI_Count *max_timestamp,
30303030
MPI_Info *info);
30313031
OMPI_DECLSPEC int PMPI_T_source_get_timestamp (int source_id, MPI_Count *timestamp);
@@ -3139,7 +3139,7 @@ OMPI_DECLSPEC int MPI_T_event_get_source (MPI_T_event_instance event, int *sour
31393139

31403140
OMPI_DECLSPEC int MPI_T_source_get_num (int *num_source);
31413141
OMPI_DECLSPEC int MPI_T_source_get_info (int source_id, char *name, int *name_len,
3142-
char *desc, int *desc_len, MPI_T_order *ordering,
3142+
char *desc, int *desc_len, MPI_T_source_order *ordering,
31433143
MPI_Count *ticks_per_second, MPI_Count *max_timestamp,
31443144
MPI_Info *info);
31453145
OMPI_DECLSPEC int MPI_T_source_get_timestamp (int source_id, MPI_Count *timestamp);

ompi/mca/pml/ob1/pml_ob1_component.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ mca_base_event_list_item_t mca_pml_ob1_events[] = {
103103

104104
[MCA_PML_OB1_EVENT_SEARCH_POSTED_BEGIN] = {.name = "search_posted_begin", .desc = "Begin searching posted message queue",
105105
.verbosity = OPAL_INFO_LVL_5, .datatypes = &mca_pml_ob1_match_hdr_types[1],
106-
.offsets = &mca_pml_ob1_match_hdr_offsets[1], .num_datatypes = 2,
106+
.offsets = &mca_pml_ob1_match_hdr_offsets[1], .num_datatypes = 3,
107107
.elements = &mca_pml_ob1_match_hdr_names[1], .extent = 8, .bind = MCA_BASE_VAR_BIND_MPI_COMM},
108108

109109
[MCA_PML_OB1_EVENT_SEARCH_POSTED_END] = {.name = "search_posted_end", .desc = "Finished searching posted message queue",
110110
.verbosity = OPAL_INFO_LVL_5, .datatypes = &mca_pml_ob1_match_hdr_types[1],
111-
.offsets = &mca_pml_ob1_match_hdr_offsets[1], .num_datatypes = 2,
111+
.offsets = &mca_pml_ob1_match_hdr_offsets[1], .num_datatypes = 3,
112112
.elements = &mca_pml_ob1_match_hdr_names[1], .extent = 8, .bind = MCA_BASE_VAR_BIND_MPI_COMM},
113113

114114
[MCA_PML_OB1_EVENT_SEARCH_UNEX_BEGIN] = {.name = "search_unexpected_begin", .desc = "Begin searching unexpected message queue",

ompi/mpi/tool/event_get_info.c

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,30 @@ int MPI_T_event_get_info (int event_index, char *name, int *name_len,
6161
mpit_copy_string (name, name_len, event->event_name);
6262
mpit_copy_string (desc, desc_len, event->event_description);
6363

64-
max_datatypes = num_elements ? (*num_elements < (int) (event->event_datatype_count + 1) ? *num_elements - 1 : event->event_datatype_count) : 0;
64+
// num_elements is INOUT
65+
//
66+
// Can query number of datatypes, returned in num_elements
67+
// if array_of_datatypes or displacements are NULL, just return data_type_count.
68+
// Otherwise, if array_of_datatypes or displacements are not NULL, use num_elements
69+
// as maximum datatypes or displacements returned.
70+
//
71+
// Unless the user passes the NULL pointer for num_elements,
72+
// the function returns the number of elements required for this event type.
73+
//
74+
// If the number of elements used by the event type is larger than the value of num_elements
75+
// provided by the user, the number of datatype handles and displacements returned in the
76+
// corresponding arrays is truncated to the value of num_elements passed in by the user.
77+
78+
max_datatypes = 0;
79+
if (num_elements) {
80+
if (NULL != array_of_datatypes || NULL != array_of_displacements) {
81+
if (*num_elements < (int) (event->event_datatype_count))
82+
max_datatypes = *num_elements;
83+
else
84+
max_datatypes = event->event_datatype_count;
85+
}
86+
*num_elements = event->event_datatype_count;
87+
}
6588

6689
if (max_datatypes) {
6790
if (array_of_datatypes) {

ompi/mpi/tool/source_get_info.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include "ompi/mpi/tool/profile/defines.h"
2323
#endif
2424

25-
int MPI_T_source_get_info (int source_id, char *name, int *name_len, char *desc, int *desc_len, MPI_T_order *ordering,
25+
int MPI_T_source_get_info (int source_id, char *name, int *name_len, char *desc, int *desc_len, MPI_T_source_order *ordering,
2626
MPI_Count *ticks_per_second, MPI_Count *max_timestamp, MPI_Info *info)
2727
{
2828
mca_base_source_t *source;
@@ -37,11 +37,17 @@ int MPI_T_source_get_info (int source_id, char *name, int *name_len, char *desc,
3737
return MPI_T_ERR_INVALID_INDEX;
3838
}
3939

40+
if (NULL == name && name_len)
41+
*name_len = strlen(source->source_name);
42+
4043
if (name && name_len) {
4144
strncpy (name, source->source_name, *name_len);
4245
*name_len = strlen (name);
4346
}
4447

48+
if (NULL == desc && desc_len)
49+
*desc_len = strlen(source->source_description);
50+
4551
if (desc && desc_len) {
4652
strncpy (desc, source->source_description, *desc_len);
4753
*desc_len = strlen (desc);
@@ -56,10 +62,10 @@ int MPI_T_source_get_info (int source_id, char *name, int *name_len, char *desc,
5662
}
5763

5864
if (max_timestamp) {
59-
*max_timestamp = SIZE_T_MAX;
65+
*max_timestamp = SIZE_MAX;
6066
}
6167

62-
if (*info) {
68+
if (NULL != info && *info) {
6369
*info = OBJ_NEW(ompi_info_t);
6470
}
6571

opal/mca/base/mca_base_event.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#include "opal/class/opal_pointer_array.h"
2828
#include "opal/class/opal_hash_table.h"
29-
#include "opal/threads/thread_usage.h"
29+
#include "opal/mca/threads/thread_usage.h"
3030

3131
static opal_hash_table_t mca_base_event_index_hash;
3232
static opal_pointer_array_t registered_events;

opal/mca/base/mca_base_var.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ int mca_base_var_init(void)
277277
if (NULL == (cwd = getcwd(NULL, 0))) {
278278
opal_output(0, "Error: Unable to get the current working directory\n");
279279
cwd = strdup(".");
280+
}
280281

281282
ret = mca_base_source_init ();
282283
if (OPAL_SUCCESS != ret) {

0 commit comments

Comments
 (0)