martinruefenacht / lemonspotter

MPI Test Generation Framework
MIT License
1 stars 0 forks source link

MPI_Init_MPI_Finalize tests fail sometimes #23

Closed martinruefenacht closed 5 years ago

martinruefenacht commented 5 years ago

The MPI_Init_MPI_Finalize test with NULL arguments fails occasionally, but with the same actual test code. Something inside LemonSpotter is broken with the detection of the failed condition I think.

#include <stdio.h>
#include <stdlib.h>
#include <mpi.h>

int main(int argument_count, char **argument_list)
{
        int* argument_count_arg_NULL = NULL;
        char*** argument_list_arg_NULL = NULL;

        int return_MPI_Init = MPI_Init(argument_count_arg_NULL, argument_list_arg_NULL);
        printf("return_MPI_Init %i\n", return_MPI_Init);
        printf("argument_count_arg_NULL %p\n", argument_count_arg_NULL);
        printf("argument_list_arg_NULL %p\n", argument_list_arg_NULL);

        if(return_MPI_Init != MPI_SUCCESS)
        {
                exit(return_MPI_Init);
        }

        int return_MPI_Finalize = MPI_Finalize();
        printf("return_MPI_Finalize %i\n", return_MPI_Finalize);

        if(return_MPI_Finalize != MPI_SUCCESS)
        {
                exit(return_MPI_Finalize);
        }

        return 0;
}
martinruefenacht commented 5 years ago

This happens for both the NULL_NULL and argc_argv case.

martinruefenacht commented 5 years ago

The start return variable does not get set correctly. Therefore MPI_SUCCESS != return_variable.value.

martinruefenacht commented 5 years ago

I think this is happening: http://math.andrej.com/2009/04/09/pythons-lambda-is-broken/comment-page-1/

When inspecting the memory address of the return variable the one that is pointed is always the same between both tests of Start-End MPI_INIT_MPI_FINALIZE.

Python closures are late-binding! This is a problem...

martinruefenacht commented 5 years ago

Using solution from https://docs.python-guide.org/writing/gotchas/#late-binding-closures

martinruefenacht commented 5 years ago

This was fixed in pull request #21.