Skip to content

Commit 4b3c70d

Browse files
committed
Modifications for changes to proposed MPI_T Events API as well as minor fixes.
Signed-off-by: Chris Chambreau <chambreau1@llnl.gov>
1 parent 1d73fcd commit 4b3c70d

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
@@ -831,12 +831,12 @@ typedef enum {
831831
/*
832832
* MPIT source ordering
833833
*/
834-
enum ompi_mpi_t_order_t {
834+
enum ompi_mpi_t_source_order_t {
835835
MPI_T_ORDERED,
836836
MPI_T_UNORDERED,
837837
};
838838

839-
typedef enum ompi_mpi_t_order_t MPI_T_order;
839+
typedef enum ompi_mpi_t_source_order_t MPI_T_source_order;
840840

841841
/*
842842
* MPI Tool event functions
@@ -2719,7 +2719,7 @@ OMPI_DECLSPEC int PMPI_T_event_get_timestamp (MPI_T_event_instance event, MPI_C
27192719
OMPI_DECLSPEC int PMPI_T_event_get_source (MPI_T_event_instance event, int *source_index);
27202720
OMPI_DECLSPEC int PMPI_T_source_get_num (int *num_source);
27212721
OMPI_DECLSPEC int PMPI_T_source_get_info (int source_id, char *name, int *name_len,
2722-
char *desc, int *desc_len, MPI_T_order *ordering,
2722+
char *desc, int *desc_len, MPI_T_source_order *ordering,
27232723
MPI_Count *ticks_per_second, MPI_Count *max_timestamp,
27242724
MPI_Info *info);
27252725
OMPI_DECLSPEC int PMPI_T_source_get_timestamp (int source_id, MPI_Count *timestamp);
@@ -2820,7 +2820,7 @@ OMPI_DECLSPEC int MPI_T_event_get_source (MPI_T_event_instance event, int *sour
28202820

28212821
OMPI_DECLSPEC int MPI_T_source_get_num (int *num_source);
28222822
OMPI_DECLSPEC int MPI_T_source_get_info (int source_id, char *name, int *name_len,
2823-
char *desc, int *desc_len, MPI_T_order *ordering,
2823+
char *desc, int *desc_len, MPI_T_source_order *ordering,
28242824
MPI_Count *ticks_per_second, MPI_Count *max_timestamp,
28252825
MPI_Info *info);
28262826
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
@@ -99,12 +99,12 @@ mca_base_event_list_item_t mca_pml_ob1_events[] = {
9999

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

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

110110
[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
@@ -20,7 +20,7 @@
2020
#include "ompi/mpi/tool/profile/defines.h"
2121
#endif
2222

23-
int MPI_T_source_get_info (int source_id, char *name, int *name_len, char *desc, int *desc_len, MPI_T_order *ordering,
23+
int MPI_T_source_get_info (int source_id, char *name, int *name_len, char *desc, int *desc_len, MPI_T_source_order *ordering,
2424
MPI_Count *ticks_per_second, MPI_Count *max_timestamp, MPI_Info *info)
2525
{
2626
mca_base_source_t *source;
@@ -35,11 +35,17 @@ int MPI_T_source_get_info (int source_id, char *name, int *name_len, char *desc,
3535
return MPI_T_ERR_INVALID_INDEX;
3636
}
3737

38+
if (NULL == name && name_len)
39+
*name_len = strlen(source->source_name);
40+
3841
if (name && name_len) {
3942
strncpy (name, source->source_name, *name_len);
4043
*name_len = strlen (name);
4144
}
4245

46+
if (NULL == desc && desc_len)
47+
*desc_len = strlen(source->source_description);
48+
4349
if (desc && desc_len) {
4450
strncpy (desc, source->source_description, *desc_len);
4551
*desc_len = strlen (desc);
@@ -54,10 +60,10 @@ int MPI_T_source_get_info (int source_id, char *name, int *name_len, char *desc,
5460
}
5561

5662
if (max_timestamp) {
57-
*max_timestamp = SIZE_T_MAX;
63+
*max_timestamp = SIZE_MAX;
5864
}
5965

60-
if (*info) {
66+
if (NULL != info && *info) {
6167
*info = OBJ_NEW(ompi_info_t);
6268
}
6369

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
@@ -302,6 +302,7 @@ int mca_base_var_init(void)
302302
if( NULL == (cwd = getcwd(NULL, 0) )) {
303303
opal_output(0, "Error: Unable to get the current working directory\n");
304304
cwd = strdup(".");
305+
}
305306

306307
ret = mca_base_source_init ();
307308
if (OPAL_SUCCESS != ret) {

0 commit comments

Comments
 (0)