You need to declare the file handle as
MPI_File fh;
and pass it as &fh to MPI_File_open.
Rajeev
> Date: Fri, 29 Apr 2005 04:00:35 -0400 (EDT)
> From: gsaxena_at_[hidden]
> Subject: LAM: Trying to use MPI_File_Open
> To: lam_at_[hidden]
>
> 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
>
>
>
>
> ------------------------------
>
> Message: 4
> Date: Fri, 29 Apr 2005 14:25:48 +0200
> From: Christophe Peyret <christophe.peyret_at_[hidden]>
> Subject: LAM: Re: LAM-MPI and Mac OSX 10.4 (Tiger)
> To: lam_at_[hidden]
> Message-ID: <EE32BB29-16B1-4104-B775-1A9DA1331E25_at_[hidden]>
> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
>
> Hi
>
> Well, we are on Fiday the 29th of April and I have in my hand the
> Precious (Tiger DVD). As you can imagine, the temptation to
> immediatly update my Power Mac to 10.4 is very high. But for
> my work,
> I need to be sure that my developer tools (lam-mpi, xlf xlc) will
> still work so I wait for your advices and the LAM-MPI team
> now is not
> any more under NDA :)
>
>
> End of lam Digest, Vol 390, Issue 1
> ***********************************
>
>
|