[mpich-discuss] Problem with MPI_File_write_all in Fortran90?
Rajeev Thakur
thakur at mcs.anl.gov
Mon Jul 23 18:30:04 CDT 2012
Even in C, the file size should be 40K for a 100*100 integer array, not 118K. 9.8T is generous.
Rajeev
On Jul 23, 2012, at 5:58 PM, Angel de Vicente wrote:
> Hi,
>
> this is the first time tham I'm using MPI_File_write_all with Fortran,
> so perhaps I'm doing something really silly, but as far as I can tell
> these two programs that I attach (in C and in Fortran 90) should behave
> the same way.
>
> angelv$ mpicc -o parallel_i_oc parallel_i_o.c
> angelv$ mpif90 -o parallel_i_of parallel_i_o.f90
> angelv$ mpiexec -n 4 ./parallel_i_oc
> angelv$ mpiexec -n 4 ./parallel_i_of
> angelv$ ls -lth datafile*
> -rw-r--r-- 1 angelv dialout 9.8T 2012-07-23 23:45 datafile_f
> -rw-r--r-- 1 angelv dialout 118K 2012-07-23 23:45 datafile_c
> angelv$
>
> I don't even have 9.8T in this hard disk, so something funny is going
> on. Any ideas?
>
> This is with MPICH2 version 1.4.1p1
>
> Thanks,
>
> #include "mpi.h"
>
> int main( int argc, char *argv[] )
> {
> int gsizes[2], distribs[2], dargs[2], psizes[2], rank, size, m, n;
> MPI_Datatype filetype;
> int i,j;
> MPI_File fh;
> int *local_array;
> MPI_Status status;
>
> MPI_Init( &argc, &argv );
> MPI_Comm_rank(MPI_COMM_WORLD, &rank);
> MPI_Comm_size( MPI_COMM_WORLD, &size );
>
> local_array = (int *)malloc( 50 * 50 * sizeof(int) );
>
> for (i=0;i<50;i++) {
> for (j=0;j<50;j++) {
> local_array[i,j] = rank * 100000 + i*1000 +j;
> }
> }
>
> gsizes[0] = 100;
> gsizes[1] = 100;
>
> distribs[0] = MPI_DISTRIBUTE_BLOCK;
> distribs[1] = MPI_DISTRIBUTE_BLOCK;
>
> dargs[0] = MPI_DISTRIBUTE_DFLT_DARG;
> dargs[1] = MPI_DISTRIBUTE_DFLT_DARG;
>
> psizes[0] = 2;
> psizes[1] = 2;
>
>
> MPI_Type_create_darray(4, rank, 2, gsizes, distribs, dargs,
> psizes, MPI_ORDER_C, MPI_INT, &filetype);
> MPI_Type_commit(&filetype);
>
> MPI_File_open(MPI_COMM_WORLD, "datafile_c",
> MPI_MODE_CREATE | MPI_MODE_WRONLY,
> MPI_INFO_NULL, &fh);
>
> MPI_File_set_view(fh, 0, MPI_INT, filetype, "native",
> MPI_INFO_NULL);
>
> MPI_File_write_all(fh, local_array, 2500,
> MPI_INT, &status);
>
> MPI_File_close(&fh);
>
> MPI_Finalize();
> return 0;
> }
> <parallel_i_o.f90>
> --
> Ùngel de Vicente
> http://www.iac.es/galeria/angelv/
>
> ---------------------------------------------------------------------------------------------
> ADVERTENCIA: Sobre la privacidad y cumplimiento de la Ley de Protección de Datos, acceda a http://www.iac.es/disclaimer.php
> WARNING: For more information on privacy and fulfilment of the Law concerning the Protection of Data, consult http://www.iac.es/disclaimer.php?lang=en
> _______________________________________________
> mpich-discuss mailing list mpich-discuss at mcs.anl.gov
> To manage subscription options or unsubscribe:
> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
More information about the mpich-discuss
mailing list