LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: gsaxena_at_[hidden]
Date: 2005-04-29 03:00:35


I am a new user of lam-mpi, I'm trying to open a file using the
MPI_File_open command to open a ppm image file called apic.ppm it is in
raw format.

Here's my execution time error message:

[gsaxena_at_morgoth project]$ mpicc lam-basic.c
[gsaxena_at_morgoth project]$ mpiexec -n 3 a.out
0 of 3 processes Up
0 sent data to 1
Task Complete
1 of 3 processes Up
Rank0: Opening file now
2 of 3 processes Up
Rank0: Opening file now
-----------------------------------------------------------------------------
One of the processes started by mpirun has exited with a nonzero exit
code. This typically indicates that the process finished in error.
If your process did not finish in error, be sure to include a "return
0" or "exit(0)" in your C code before exiting the application.

PID 6805 failed on node n0 (127.0.0.1) due to signal 11.
-----------------------------------------------------------------------------
mpirun failed with exit status 11

The file apic.ppm is present in the same folder.

The code I wrote was as follows: (ignore the boring printfs, they were
only for testing if the code was being reached or not, wanted to open a
file in the all processes but the root, then use MPI_send to send specific
modified data to root where eventually a file will created and written).

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

#define ROWS 40
#define COLS 40

#define DATALEN (ROWS*COLS*3)

int main(int argc, char* argv[]) {
        int rank, procs;

        MPI_Init(&argc,&argv);
        MPI_Comm_rank(MPI_COMM_WORLD, &rank);
        MPI_Comm_size(MPI_COMM_WORLD, &procs);

        printf("%d of %d processes Up\n", rank, procs);

        size=(ROWS*COLS*3)/(procs-1);

        if(rank==0) {
                printf("%d sent data to %d\n",rank,dest);
                printf("Task Complete\n");
 }
        else {
                fprintf(stdout, "Rank%d: Opening file now\n");
                               MPI_File_open(MPI_COMM_SELF,"apic.ppm",MPI_MODE_RDONLY,info,fh);
                fprintf(stdout,"File is opened\n");
                MPI_File_close(fh);
                printf("%d: job over\n",rank);

        }

        MPI_Finalize();
        return 0;
}

Any suggestions ?

Gaurav Saxena
Graduate Student
Kent State University