I just configure my cluster according to the instruction of quick start.
And everything goes well until I run my first MPI-IO code.
I got the unexpected results which are listed below.
[EMAIL PROTECTED] exp1]$ mpiexec -np 1 sample
outdata:abcdefghi
Wrote only 5023040 of 10 bytes!
Read only 5023040 of 10 bytes!
Indata:@�L
Here are my codes. Please give me some suggestion. Thank you!.
*************************sample.c****************************
#include "mpi.h"
#include "mpio.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
MPI_File fh;
MPI_Status status;
int nprocs,rank;
int count=0;
char outdata[10]={'a', 'b' ,'c', 'd', 'e', 'f', 'g', 'h', 'i',
'\0'};
char indata[10];
MPI_Init(&argc,&argv);
MPI_Comm_size(MPI_COMM_WORLD,&nprocs);
MPI_Comm_rank(MPI_COMM_WORLD,&rank);
printf("outdata:%s\n",outdata);
MPI_File_open(MPI_COMM_WORLD,"/mnt/pvfs2/matrix",MPI_MODE_RDWR|
MPI_MODE_CREATE,MPI_INFO_NULL,&fh);
MPI_File_seek(fh,rank*10,MPI_SEEK_SET);
MPI_File_write(fh,outdata,10,MPI_CHAR,&status);
MPI_Get_count(&status,MPI_CHAR,&count);
if(count!=10)
printf("Wrote only %d of %d bytes!\n",count,10);
MPI_File_seek(fh,rank*10,MPI_SEEK_SET);
MPI_File_read(fh,indata,10,MPI_CHAR,&status);
MPI_Get_count(&status,MPI_CHAR,&count);
if(count!=10)
printf("Read only %d of %d bytes!\n",count,10);
printf("Indata:%s\n",indata);
MPI_File_close(&fh);
MPI_Barrier(MPI_COMM_WORLD);
MPI_Finalize();
}
_______________________________________________
Pvfs2-users mailing list
[email protected]
http://www.beowulf-underground.org/mailman/listinfo/pvfs2-users