Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Events update to address bug, add tests, and clarify documentation #18

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion events/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,18 @@ The behavior of each test can be modified with the following command line argume

## Event Callback and Read Data Example
The events_example.c file has been provided as an example of registering an event callback and reading event data.
It can be used with the Open MPI '--mca pml ob1' mpiexec flags to generate MPI_T Event callback behavior and
confirm callback functionality.

## Known Open MPI MPI_T Event test failures

- MPI_T_event_handle_free : user_data is not accessible in callback function
- MPI_T_event_handle_set_info, MPI_T_event_callback_set_info : keys are not added to Info objects

## Possible Additional Tests

- MPI_T_event_set_dropped_handler : Functionality is not currently implemented for dropped events in Open MPI, but a test to co nfirm that the dropped handler is called could be useful.

## Test Suite And MPI Implementations

Tested with [Open MPI PR #8057](https://github.com/open-mpi/ompi/pull/8057) with pml ob1 module events.
Tested with [Open MPI PR #8057](https://github.com/open-mpi/ompi/pull/8057) with pml ob1 module events.
6 changes: 3 additions & 3 deletions events/events_dropped.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ void print_results() {

if ( 0 != rank ) return;

if ( 0 == event_dropped_cb_success )
error_count++;
//if ( 0 == event_dropped_cb_success )
// error_count++;

print_pf_result("MPI_T_event_set_dropped_handler", "Event Set Dropped Callback Success", event_set_dropped_handler_success);
print_pf_result("MPI_T_event_set_dropped_handler", "Event Set Dropped Callback Called", event_dropped_cb_success);
//print_pf_result("MPI_T_event_set_dropped_handler", "Event Set Dropped Callback Called", event_dropped_cb_success);

fprintf(outstream, "%-*s - %-*s : %6d\n", func_width, "TOTAL ERROR COUNT", metric_width, "", error_count);

Expand Down
2 changes: 1 addition & 1 deletion events/events_source.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void test_source() {
int num_sources, source_index;
MPI_Count timestamp;
char name[MAX_STRING], desc[MAX_STRING];
int name_len, desc_len;
int name_len = MAX_STRING, desc_len = MAX_STRING;
MPI_Count ticks_per_second, max_ticks;
MPI_Info info;
MPI_T_source_order ordering;
Expand Down
59 changes: 59 additions & 0 deletions events/events_types.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ int event_info_failed = 0;
int event_info_displacements_start_at_0 = 1;
int event_count_result = 0;
int event_get_num_handle_null = 0;
int event_info_negative_name_len_handled = 1;
int event_info_negative_desc_len_handled = 1;


void print_results() {
Expand All @@ -32,6 +34,8 @@ void print_results() {

if ( do_failure_tests ) {
print_pf_result("MPI_T_event_get_num", "Handle NULL argument", event_get_num_handle_null);
print_pf_result("MPI_T_event_get_info", "Handle negative name length", event_info_negative_name_len_handled);
print_pf_result("MPI_T_event_get_info", "Handle negative desc length", event_info_negative_desc_len_handled);
}

fprintf(outstream, "%-*s - %-*s : %6d\n", func_width, "TOTAL ERROR COUNT", metric_width, "", error_count);
Expand Down Expand Up @@ -199,6 +203,61 @@ void test_get_info() {
}
}


if ( do_failure_tests ) {

int save_name_len;

save_name_len = ci.name_len;

/* name_len and desc_len are INOUT arguments and should handle negative values
* Ideally it would return MPI_ERR_ARG (although not specified in MPI Standard v4.0),
* but otherwise it should at least not segfault.*/
ci.name_len = -100;
print_debug("Testing MPI_T_event_get_info with negative name_len\n");
retval = MPI_T_event_get_info(
ci.event_index,
ci.name,
&(ci.name_len),
&(ci.verbosity),
ci.array_of_datatypes,
ci.array_of_displacements,
&(ci.num_elements),
&(ci.enumtype),
&(ci.info),
ci.desc,
&(ci.desc_len),
&(ci.bind)
) ;

if (MPI_ERR_ARG != retval && 1 == event_info_negative_name_len_handled ) {
event_info_negative_name_len_handled = 0;
}

ci.name_len = save_name_len;
ci.desc_len = -100;

print_debug("Testing MPI_T_event_get_info with negative name_len\n");
retval = MPI_T_event_get_info(
ci.event_index,
ci.name,
&(ci.name_len),
&(ci.verbosity),
ci.array_of_datatypes,
ci.array_of_displacements,
&(ci.num_elements),
&(ci.enumtype),
&(ci.info),
ci.desc,
&(ci.desc_len),
&(ci.bind)
) ;

if (MPI_ERR_ARG != retval && 1 == event_info_negative_desc_len_handled ) {
event_info_negative_desc_len_handled = 0;
}
}

free(ci.name);
free(ci.desc);
free(infos);
Expand Down