[MPICH] More one error with fileviews
Luiz Mendes
luizmendesw at gmail.com
Sun Jan 28 13:07:27 CST 2007
HI all, i code onde application to read from a file using fileviews with
specifics offsets for each process.
But when i try to do this, the application enter on a loop, and the app
remains without response.
The code is below.
#include <stdio.h>
#include "mpi.h"
#define FILESIZE 1048576
#define INTS_PER_BLK 2
int main(int argc, char **argv)
{
int rank, nprocs, nints, bufsize;
MPI_File fh;
MPI_Datatype filetype;
MPI_Init(&argc,&argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
bufsize = FILESIZE/nprocs;
int buf[10];
int buf2[10];
nints = bufsize/sizeof(int);
MPI_File_open(MPI_COMM_WORLD, "rupi.dat", MPI_MODE_RDONLY,MPI_INFO_NULL,
&fh);
MPI_Type_vector(3, 1, 3, MPI_INT, &filetype);
MPI_Type_commit(&filetype);
if(rank==0)
{
MPI_File_set_view(fh, 0, MPI_INT, filetype, "native",
MPI_INFO_NULL);
MPI_File_read(fh, buf, 3, MPI_INT, MPI_STATUS_IGNORE);
int m;
for(m=0; m<=2;m++)
{
printf("\n --> Matriz[%d] = %d",m,buf[m]);
}
}
else
{
MPI_File_set_view(fh, sizeof(int), MPI_INT, filetype, "native",
MPI_INFO_NULL);
MPI_File_read(fh, buf2, 3, MPI_INT, MPI_STATUS_IGNORE);
int m;
for(m=0; m<=2;m++)
{
printf("\n --> Matriz[%d] = %d",m,buf2[m]);
}
}
MPI_File_close(&fh);
// MPI_Type_free(&filetype);
MPI_Finalize();
return 0;
}
COULD YOU HELP ME?
tHANKS IN ADVANCE
LUIZ MENDES
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20070128/67244659/attachment.htm>
More information about the mpich-discuss
mailing list