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

Cannot write to /dev/stdout using MPI_File_write_shared #4632

Open
simonbyrne opened this issue Jun 10, 2020 · 0 comments
Open

Cannot write to /dev/stdout using MPI_File_write_shared #4632

simonbyrne opened this issue Jun 10, 2020 · 0 comments
Assignees

Comments

@simonbyrne
Copy link

simonbyrne commented Jun 10, 2020

MPICH isn't able to write to /dev/stdout using MPI_File_write_shared (or indeed, any MPI_File_write_XXX operations).

The following code works with Open MPI 4.0.2, but fails with MPICH 3.3.2 on MacOS:

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

int main(int argc, char** argv) {
    // Initialize the MPI environment
    MPI_Init(NULL, NULL);

    MPI_File fh;
    MPI_File_open(MPI_COMM_WORLD, "/dev/stdout", MPI_MODE_WRONLY | MPI_MODE_CREATE, MPI_INFO_NULL, &fh);

    char buf[100];
    int rank;
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    snprintf(buf, 100, "hello from rank %d \n", rank);
    MPI_Status status;
    MPI_File_write_shared(fh, buf, strlen(buf), MPI_CHAR, &status);

    MPI_File_close(&fh);

    MPI_Finalize();
}

gives the following error:

├ mpiexec -n 3 ./mpi-stdout
I/O error: Internal MPI error!, error stack:
MPI_FILE_READ_SHARED(98): Could not access shared file pointer
I/O error: Internal MPI error!, error stack:
MPI_FILE_READ_SHARED(98): Could not access shared file pointer
@simonbyrne simonbyrne changed the title Cannot write to /dev/stdout using MPI_File_shared Cannot write to /dev/stdout using MPI_File_write_shared Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants