Search code examples
cmpifreebsdmpich

MPI_Init failing in FreeBSD 13


I'm using FreeBSD 13, and trying to compile (successfully) and run (un-succesfully) a simple minimal MPI program

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

int main(int argc, char **argv) {
    int res;

    res = MPI_Init(&argc, &argv);
    if (res != MPI_SUCCESS)
    {
        fprintf (stderr, "MPI_Init failed!\n");
        exit (0);
    }

    res = MPI_Finalize();
    if (res != MPI_SUCCESS)
    {
        fprintf (stderr, "MPI_Finalize failed!\n");
        exit (0);
    }
}

I'm using mpich-3.4.2_2 MPI library, compile the above with mpicc example_mpi.c, then run with mpirun -np 2 ./a.out.

Compiler is

FreeBSD clang version 11.0.1 ([email protected]:llvm/llvm-project.git llvmorg-11.0.1-0-g43ff75f2c3fe) Target: x86_64-unknown-freebsd13.0 Thread model: posix InstalledDir: /usr/bin

I'm getting a strange MPI init error

Abort(268484367) on node 0 (rank 0 in comm 0): Fatal error in PMPI_Init: Other MPI error, error stack: MPIR_Init_thread(153): gpu_init failed [unset]: write_line error; fd=-1 buf=:cmd=abort exitcode=268484367 : system msg for write_line failure : Bad file descriptor MPI_Init failed!

Any idea what is going on? I ran under root and same issue.


Solution

  • Seemed to have been a bug, I just saw it was fixed by FreeBSD folks.

    See https://cgit.freebsd.org/ports/commit/?id=fd490a171c3da0d7bcb9a5f3ee3b4b46075dfa9e