Parallel read of a nxn matrix stored in a file -
i'm developing program, solve equation ax = b using gaussian elimination. i've got file, in i've stored matrix of type double (row major order since using c). i'm trying read file in parallel, using parallel file i/o functions provided mpi.
i've gained understanding of mpi_file_set_view
, how logically partitions shared file each process has different view of file. i've understood view must consist of etype
, filetype
, displacement. in case, i've got have cyclic row distribution , i've got following code:
int count, blksize, stride,lb,extent; mpi_file fh; mpi_offset of; /* define types etype, ftype etype: type of data stored in file. ftype: description of how data stored in file. */ mpi_datatype etype, ftype,mpi_vect; /* etype: */ count = (n + (size -1))/size; blksize = n; stride = size; lb = 0; extent = n*sizeof(double); mpi_type_vector(count,blksize,stride,mpi_double,&mpi_vect); mpi_type_create_resized(mpi_vect,lb,extent,&etype); mpi_type_commit(&etype); /* ftype: describes logical division of file. strided vector of blocksize 1 , count n/size. stride size */ mpi_type_vector(count,1,stride, mpi_double, &ftype); mpi_type_commit(&ftype); mpi_file_open(mpi_comm_world,filename,mpi_mode_rdonly,mpi_info_null,&fh); mpi_file_set_view(fh,0,etype,ftype,native,mpi_info_null); /* assume buf allocated mpi_vector blocksize equal row size , stride equal number of processors */ mpi_file_read(fh,buf,count,mpi_vec,mpi_status_ignore);
my question is, how decide proper etype , ftype? appreciated.
thanks.
etype
, ftype
still trip me , i've been working mpi-io 15 years. concept isn't tough, reason naming convention not stick me.
the etype
or "elementary type" sets fundamental unit various counts. when call mpi_file_read_at_all
, give offset, offset count of etype
. not bytes.
there 2 ways read particular region of file: can adjust file view on each process start want, or can use explicit offset routines (e.g. mpi_file_read_at_all
). if constructing file view each process might not need worry etype: set mpi_byte.
Comments
Post a Comment