import re


def get_mpi_implementation(configure_log):
    """Return the name of the MPI implementation that QDYN was configured with
    (e.g. 'openmpi', or None if QDYN was compiled without MPI support"""
    with open(configure_log) as in_fh:
        for line in in_fh:
            if 'use-mpi' in line:
                m = re.search(r'use-mpi=(\w+)', line)
                if m:
                    implementation = m.group(1)
                    return implementation
    return None