[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.2b4-15-gbfd674b

Service Account noreply at mpich.org
Tue Jul 28 15:02:30 CDT 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".

The branch, master has been updated
       via  bfd674b37b1fb35957e5177fed1451e0e8a67ded (commit)
       via  92f1c69f0de87f934b4fbbd52fc46b642a4714e8 (commit)
       via  43cbd1e146224d44eab75bbdf1cdf9e806a31e3d (commit)
       via  1a2399281630976b209073c55597f06a062d6edf (commit)
       via  bbf05d805ee975451bd97f3e5cbf9c2e56e49511 (commit)
      from  6b41775b2056ff18b3c28aab71764e35904c00fa (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/bfd674b37b1fb35957e5177fed1451e0e8a67ded

commit bfd674b37b1fb35957e5177fed1451e0e8a67ded
Author: Rob Latham <robl at mcs.anl.gov>
Date:   Thu Jul 23 13:46:55 2015 -0500

    do not want generic hints to override this lustre hint
    
    Signed-off-by: Pavan Balaji <balaji at anl.gov>

diff --git a/src/mpi/romio/adio/ad_lustre/ad_lustre_hints.c b/src/mpi/romio/adio/ad_lustre/ad_lustre_hints.c
index e30d433..0046a24 100644
--- a/src/mpi/romio/adio/ad_lustre/ad_lustre_hints.c
+++ b/src/mpi/romio/adio/ad_lustre/ad_lustre_hints.c
@@ -125,6 +125,12 @@ void ADIOI_LUSTRE_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
     /* set the values for collective I/O and data sieving parameters */
     ADIOI_GEN_SetInfo(fd, users_info, error_code);
 
+    /* generic hints might step on striping_unit */
+    if (users_info != MPI_INFO_NULL) {
+	ADIOI_Info_check_and_install_int(fd, users_info, "striping_unit",
+		NULL, myname, error_code);
+    }
+
     if (ADIOI_Direct_read) fd->direct_read = 1;
     if (ADIOI_Direct_write) fd->direct_write = 1;
 

http://git.mpich.org/mpich.git/commitdiff/92f1c69f0de87f934b4fbbd52fc46b642a4714e8

commit 92f1c69f0de87f934b4fbbd52fc46b642a4714e8
Author: Rob Latham <robl at mcs.anl.gov>
Date:   Wed Jun 3 11:37:59 2015 -0500

    hint processing should not open files
    
    move opening of files from hint processing and into open routines.
    
    Ref: #2261
    Ref: https://github.com/open-mpi/ompi/issues/158
    Signed-off-by: Pavan Balaji <balaji at anl.gov>

diff --git a/src/mpi/romio/adio/ad_lustre/ad_lustre_hints.c b/src/mpi/romio/adio/ad_lustre/ad_lustre_hints.c
index 051cfb0..e30d433 100644
--- a/src/mpi/romio/adio/ad_lustre/ad_lustre_hints.c
+++ b/src/mpi/romio/adio/ad_lustre/ad_lustre_hints.c
@@ -20,8 +20,7 @@ void ADIOI_LUSTRE_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
     char *value;
     int flag;
     ADIO_Offset stripe_val[3], str_factor = -1, str_unit=0, start_iodev=-1;
-    struct lov_user_md lum = { 0 };
-    int err, myrank, fd_sys, perm, amode, old_mask;
+    int err, myrank;
     static char myname[] = "ADIOI_LUSTRE_SETINFO";
 
     value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));
@@ -47,18 +46,25 @@ void ADIOI_LUSTRE_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
             /* striping information */
 	    ADIOI_Info_get(users_info, "striping_unit", MPI_MAX_INFO_VAL,
 			 value, &flag);
-	    if (flag)
+	    if (flag) {
+		ADIOI_Info_set(fd->info, "striping_unit", value);
 		str_unit=atoll(value);
+	    }
 
 	    ADIOI_Info_get(users_info, "striping_factor", MPI_MAX_INFO_VAL,
 			 value, &flag);
-	    if (flag)
+	    if (flag) {
+		ADIOI_Info_set(fd->info, "striping_factor", value);
 		str_factor=atoll(value);
+	    }
 
 	    ADIOI_Info_get(users_info, "romio_lustre_start_iodevice",
                          MPI_MAX_INFO_VAL, value, &flag);
-	    if (flag)
+	    if (flag) {
+		ADIOI_Info_set(fd->info, "romio_lustre_start_iodevice", value);
 		start_iodev=atoll(value);
+	    }
+
 
             /* direct read and write */
 	    ADIOI_Info_get(users_info, "direct_read", MPI_MAX_INFO_VAL,
@@ -84,72 +90,20 @@ void ADIOI_LUSTRE_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
 	}
 	MPI_Bcast(stripe_val, 3, MPI_OFFSET, 0, fd->comm);
 
+	/* do not open file in hint processing.   Open file in open routines,
+	 * where we can better deal with EXCL flag .  Continue to check the
+	 * "all processors set a value" condition holds.  */
 	if (stripe_val[0] != str_factor
 		|| stripe_val[1] != str_unit
 		|| stripe_val[2] != start_iodev) {
-	    FPRINTF(stderr, "ADIOI_LUSTRE_SetInfo: All keys"
-		    "-striping_factor:striping_unit:start_iodevice "
-		    "need to be identical across all processes\n");
-	    MPI_Abort(MPI_COMM_WORLD, 1);
-	} else if ((str_factor > 0) || (str_unit > 0) || (start_iodev >= 0)) {
-	     /* if user has specified striping info, process 0 tries to set it */
-	    if (!myrank) {
-		if (fd->perm == ADIO_PERM_NULL) {
-		    old_mask = umask(022);
-		    umask(old_mask);
-		    perm = old_mask ^ 0666;
-		}
-		else perm = fd->perm;
-
-		amode = 0;
-		if (fd->access_mode & ADIO_CREATE)
-		    amode = amode | O_CREAT;
-		if (fd->access_mode & ADIO_RDONLY)
-		    amode = amode | O_RDONLY;
-		if (fd->access_mode & ADIO_WRONLY)
-		    amode = amode | O_WRONLY;
-		if (fd->access_mode & ADIO_RDWR)
-		    amode = amode | O_RDWR;
-		if (fd->access_mode & ADIO_EXCL)
-		    amode = amode | O_EXCL;
-
-		/* we need to create file so ensure this is set */
-		amode = amode | O_LOV_DELAY_CREATE | O_CREAT;
-
-		fd_sys = open(fd->filename, amode, perm);
-		if (fd_sys == -1) {
-		    if (errno != EEXIST)
-			fprintf(stderr,
-				"Failure to open file %s %d %d\n",strerror(errno), amode, perm);
-		} else {
-		    lum.lmm_magic = LOV_USER_MAGIC;
-		    lum.lmm_pattern = 0;
-		    lum.lmm_stripe_size = str_unit;
-		    /* crude check for overflow of lustre internal datatypes.
-		     * Silently cap to large value if user provides a value
-		     * larger than lustre supports */
-		    if (lum.lmm_stripe_size != str_unit) {
-			lum.lmm_stripe_size = UINT_MAX;
-		    }
-		    lum.lmm_stripe_count = str_factor;
-		    if ( lum.lmm_stripe_count != str_factor) {
-			lum.lmm_stripe_count = USHRT_MAX;
-		    }
-		    lum.lmm_stripe_offset = start_iodev;
-		    if (lum.lmm_stripe_offset != start_iodev) {
-			lum.lmm_stripe_offset = USHRT_MAX;
-		    }
-
-		    err = ioctl(fd_sys, LL_IOC_LOV_SETSTRIPE, &lum);
-		    if (err == -1 && errno != EEXIST) {
-			fprintf(stderr, "Failure to set stripe info %s \n", strerror(errno));
-		    }
-		    close(fd_sys);
-	       }
-	    } /* End of striping parameters validation */
+		   MPIO_ERR_CREATE_CODE_INFO_NOT_SAME("ADIOI_LUSTRE_SetInfo",
+					       "str_factor or str_unit or start_iodev",
+					       error_code);
+		   ADIOI_Free(value);
+		   return;
 	}
-	MPI_Barrier(fd->comm);
     }
+
     /* get other hint */
     if (users_info != MPI_INFO_NULL) {
         /* CO: IO Clients/OST,
diff --git a/src/mpi/romio/adio/ad_lustre/ad_lustre_open.c b/src/mpi/romio/adio/ad_lustre/ad_lustre_open.c
index e06cb24..bfb16c4 100644
--- a/src/mpi/romio/adio/ad_lustre/ad_lustre_open.c
+++ b/src/mpi/romio/adio/ad_lustre/ad_lustre_open.c
@@ -18,14 +18,17 @@
 void ADIOI_LUSTRE_Open(ADIO_File fd, int *error_code)
 {
     int perm, old_mask, amode, amode_direct;
-    int lumlen;
+    int lumlen, myrank, flag, set_layout=0, err;
     struct lov_user_md *lum = NULL;
     char *value;
+    ADIO_Offset str_factor = -1, str_unit=0, start_iodev=-1;
 
 #if defined(MPICH) || !defined(PRINT_ERR_MSG)
     static char myname[] = "ADIOI_LUSTRE_OPEN";
 #endif
 
+    MPI_Comm_rank(fd->comm, &myrank);
+
     if (fd->perm == ADIO_PERM_NULL) {
 	old_mask = umask(022);
 	umask(old_mask);
@@ -47,46 +50,102 @@ void ADIOI_LUSTRE_Open(ADIO_File fd, int *error_code)
 
     amode_direct = amode | O_DIRECT;
 
-    fd->fd_sys = open(fd->filename, amode|O_CREAT, perm);
-
-    if (fd->fd_sys != -1) {
-        int err;
-
-        /* get file striping information and set it in info */
-	/* odd malloc here because lov_user_md contains some fixed data and
-	 * then a list of 'lmm_objects' representing stripe */
-        lumlen = sizeof(struct lov_user_md) +
-                 MAX_LOV_UUID_COUNT * sizeof(struct lov_user_ost_data);
-	/* furthermore, Pascal Deveze reports that, even though we pass a
-	 * "GETSTRIPE" (read) flag to the ioctl, if some of the values of this
-	 * struct are uninitialzed, the call can give an error.  calloc in case
-	 * there are other members that must be initialized and in case
-	 * lov_user_md struct changes in future */
-	lum = (struct lov_user_md *)ADIOI_Calloc(1,lumlen);
-        lum->lmm_magic = LOV_USER_MAGIC;
-        err = ioctl(fd->fd_sys, LL_IOC_LOV_GETSTRIPE, (void *)lum);
-        if (!err) {
-            value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));
-
-            fd->hints->striping_unit = lum->lmm_stripe_size;
-            sprintf(value, "%d", lum->lmm_stripe_size);
-            ADIOI_Info_set(fd->info, "striping_unit", value);
-
-            fd->hints->striping_factor = lum->lmm_stripe_count;
-            sprintf(value, "%d", lum->lmm_stripe_count);
-            ADIOI_Info_set(fd->info, "striping_factor", value);
-
-            fd->hints->fs_hints.lustre.start_iodevice = lum->lmm_stripe_offset;
-            sprintf(value, "%d", lum->lmm_stripe_offset);
-            ADIOI_Info_set(fd->info, "romio_lustre_start_iodevice", value);
-
-            ADIOI_Free(value);
-        }
-        ADIOI_Free(lum);
-
-        if (fd->access_mode & ADIO_APPEND)
-            fd->fp_ind = fd->fp_sys_posn = lseek(fd->fd_sys, 0, SEEK_END);
-    } 
+    /* odd length here because lov_user_md contains some fixed data and
+     * then a list of 'lmm_objects' representing stripe */
+    lumlen = sizeof(struct lov_user_md) +
+	    MAX_LOV_UUID_COUNT * sizeof(struct lov_user_ost_data);
+    lum = (struct lov_user_md *)ADIOI_Calloc(1,lumlen);
+
+     value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));
+    /* we already validated in LUSTRE_SetInfo that these are going to be the same */
+    if (fd->info != MPI_INFO_NULL) {
+	/* striping information */
+	ADIOI_Info_get(fd->info, "striping_unit", MPI_MAX_INFO_VAL,
+		value, &flag);
+	if (flag)
+	    str_unit=atoll(value);
+
+	ADIOI_Info_get(fd->info, "striping_factor", MPI_MAX_INFO_VAL,
+		value, &flag);
+	if (flag)
+	    str_factor=atoll(value);
+
+	ADIOI_Info_get(fd->info, "romio_lustre_start_iodevice",
+		MPI_MAX_INFO_VAL, value, &flag);
+	if (flag)
+	    start_iodev=atoll(value);
+    }
+    if ((str_factor > 0) || (str_unit > 0) || (start_iodev >= 0))
+	set_layout = 1;
+
+    /* if hints were set, we need to delay creation of any lustre objects.
+     * However, if we open the file with O_LOV_DELAY_CREATE and don't call the
+     * follow-up ioctl, subsequent writes will fail */
+    if (myrank == 0 && set_layout)
+	amode = amode | O_LOV_DELAY_CREATE;
+
+    fd->fd_sys = open(fd->filename, amode, perm);
+    if (fd->fd_sys == -1) goto fn_exit;
+
+    /* we can only set these hints on new files */
+    /* It was strange and buggy to open the file in the hint path.  Instead,
+     * we'll apply the file tunings at open time */
+    if ((amode & O_CREAT) && set_layout ) {
+	/* if user has specified striping info, process 0 tries to set it */
+	if (!myrank) {
+	    lum->lmm_magic = LOV_USER_MAGIC;
+	    lum->lmm_pattern = 0;
+	    /* crude check for overflow of lustre internal datatypes.
+		 * Silently cap to large value if user provides a value
+		 * larger than lustre supports */
+	    if (str_unit > UINT_MAX)
+	            lum->lmm_stripe_size = UINT_MAX;
+	    else
+	            lum->lmm_stripe_size = str_unit;
+
+	    if (str_factor > USHRT_MAX)
+	            lum->lmm_stripe_count = USHRT_MAX;
+	    else
+	            lum->lmm_stripe_count = str_factor;
+
+	    if (start_iodev > USHRT_MAX)
+	             lum->lmm_stripe_offset = USHRT_MAX;
+	    else
+	            lum->lmm_stripe_offset = start_iodev;
+	    err = ioctl(fd->fd_sys, LL_IOC_LOV_SETSTRIPE, lum);
+	    if (err == -1 && errno != EEXIST) {
+		fprintf(stderr, "Failure to set stripe info %s \n", strerror(errno));
+		/* not a fatal error, but user might care to know */
+	    }
+	} /* End of striping parameters validation */
+    }
+
+    /* Pascal Deveze reports that, even though we pass a
+     * "GETSTRIPE" (read) flag to the ioctl, if some of the values of this
+     * struct are uninitialzed, the call can give an error.  zero it out in case
+     * there are other members that must be initialized and in case
+     * lov_user_md struct changes in future */
+    memset(lum, 0, lumlen);
+    lum->lmm_magic = LOV_USER_MAGIC;
+    err = ioctl(fd->fd_sys, LL_IOC_LOV_GETSTRIPE, (void *)lum);
+    if (!err) {
+
+	fd->hints->striping_unit = lum->lmm_stripe_size;
+	sprintf(value, "%d", lum->lmm_stripe_size);
+	ADIOI_Info_set(fd->info, "striping_unit", value);
+
+	fd->hints->striping_factor = lum->lmm_stripe_count;
+	sprintf(value, "%d", lum->lmm_stripe_count);
+	ADIOI_Info_set(fd->info, "striping_factor", value);
+
+	fd->hints->fs_hints.lustre.start_iodevice = lum->lmm_stripe_offset;
+	sprintf(value, "%d", lum->lmm_stripe_offset);
+	ADIOI_Info_set(fd->info, "romio_lustre_start_iodevice", value);
+
+    }
+
+    if (fd->access_mode & ADIO_APPEND)
+	fd->fp_ind = fd->fp_sys_posn = lseek(fd->fd_sys, 0, SEEK_END);
 
     if ((fd->fd_sys != -1) && (fd->access_mode & ADIO_APPEND))
 	fd->fp_ind = fd->fp_sys_posn = lseek(fd->fd_sys, 0, SEEK_END);
@@ -102,6 +161,9 @@ void ADIOI_LUSTRE_Open(ADIO_File fd, int *error_code)
 	}
     }
 
+fn_exit:
+    ADIOI_Free(lum);
+    ADIOI_Free(value);
     /* --BEGIN ERROR HANDLING-- */
     if (fd->fd_sys == -1 || ((fd->fd_direct == -1) && 
 		(fd->direct_write || fd->direct_read))) {

http://git.mpich.org/mpich.git/commitdiff/43cbd1e146224d44eab75bbdf1cdf9e806a31e3d

commit 43cbd1e146224d44eab75bbdf1cdf9e806a31e3d
Author: Rob Latham <robl at mcs.anl.gov>
Date:   Thu Jul 23 12:09:26 2015 -0500

    move hint dumping a bit later
    
    if any file system sets hints in open, we won't see them unless we dump the
    hints after open.
    
    Signed-off-by: Pavan Balaji <balaji at anl.gov>

diff --git a/src/mpi/romio/adio/common/ad_open.c b/src/mpi/romio/adio/common/ad_open.c
index 5c95b47..04468de 100644
--- a/src/mpi/romio/adio/common/ad_open.c
+++ b/src/mpi/romio/adio/common/ad_open.c
@@ -152,12 +152,6 @@ MPI_File ADIO_Open(MPI_Comm orig_comm,
 	if (*error_code != MPI_SUCCESS) 
 	    goto fn_exit;
     }
-    /* for debugging, it can be helpful to see the hints selected */
-    p = getenv("ROMIO_PRINT_HINTS");
-    if (rank == 0 && p != NULL ) {
-	ADIOI_Info_print_keyvals(fd->info);
-    }
-
     fd->is_open = 0;
     fd->my_cb_nodes_index = -2;
     fd->is_agg = is_aggregator(rank, fd);
@@ -173,6 +167,13 @@ MPI_File ADIO_Open(MPI_Comm orig_comm,
 
     ADIOI_OpenColl(fd, rank, access_mode, error_code);
 
+    /* for debugging, it can be helpful to see the hints selected. Some file
+     * systes set up the hints in the open call (e.g. lustre) */
+    p = getenv("ROMIO_PRINT_HINTS");
+    if (rank == 0 && p != NULL ) {
+	ADIOI_Info_print_keyvals(fd->info);
+    }
+
  fn_exit:
     MPI_Allreduce(error_code, &max_error_code, 1, MPI_INT, MPI_MAX, comm);
     if (max_error_code != MPI_SUCCESS) {

http://git.mpich.org/mpich.git/commitdiff/1a2399281630976b209073c55597f06a062d6edf

commit 1a2399281630976b209073c55597f06a062d6edf
Author: Rob Latham <robl at mcs.anl.gov>
Date:   Thu Jun 4 03:54:02 2015 -0500

    try to more gracefully handle out of memory conditions
    
    Signed-off-by: Pavan Balaji <balaji at anl.gov>

diff --git a/test/mpi/io/bigtype.c b/test/mpi/io/bigtype.c
index d500714..11e3ea3 100644
--- a/test/mpi/io/bigtype.c
+++ b/test/mpi/io/bigtype.c
@@ -36,7 +36,15 @@ int main(int argc, char** argv)
     k = 0;
     /* create a large buffer 2*/
     buf_write = malloc (NUM_X*NUM_Y*sizeof(int));
+    if (buf_write == NULL) {
+        fprintf(stderr, "not enough memory\n");
+        exit(1);
+    }
     buf_read = malloc (NUM_X*NUM_Y*sizeof(int));
+    if (buf_read == NULL) {
+        fprintf(stderr, "not enough memory\n");
+        exit(1);
+    }
     memset(buf_read, 0, NUM_X*NUM_Y*sizeof(int));
 
     for (i=0; i<NUM_X ; i++) {
@@ -77,13 +85,13 @@ int main(int argc, char** argv)
 
     if(MPI_File_open (MPI_COMM_WORLD, "testfile", MPI_MODE_RDWR | MPI_MODE_CREATE,
                       MPI_INFO_NULL, &fh) != 0) {
-        printf("Can't open file: %s\n","testfile");
+        fprintf(stderr, "Can't open file: %s\n","testfile");
         exit(1);
     }
 
     if (MPI_SUCCESS != MPI_File_set_view(fh, 2144, MPI_BYTE,
                                          file_type, "native", MPI_INFO_NULL)) {
-        printf ("ERROR SET VIEW\n");
+        fprintf (stderr, "ERROR SET VIEW\n");
         exit(1);
     }
 
@@ -95,13 +103,13 @@ int main(int argc, char** argv)
                                  mem_type,
                                  MPI_STATUS_IGNORE);
     if (rc != MPI_SUCCESS){
-        printf ("%d ERROR WRITE AT ALL\n", rc);
+        fprintf (stderr, "%d ERROR WRITE AT ALL\n", rc);
         exit(1);
     }
 
     if (MPI_SUCCESS != MPI_File_set_view(fh, 2144, MPI_BYTE,
                                          file_type, "native", MPI_INFO_NULL)) {
-        printf ("ERROR SET VIEW\n");
+        fprintf (stderr, "ERROR SET VIEW\n");
         exit(1);
     }
 
@@ -113,7 +121,7 @@ int main(int argc, char** argv)
                                mem_type,
                                MPI_STATUS_IGNORE);
     if (rc != MPI_SUCCESS) {
-        printf ("%d ERROR READ AT ALL\n", rc);
+        fprintf (stderr, "%d ERROR READ AT ALL\n", rc);
         exit(1);
     }
 
diff --git a/test/mpi/io/i_bigtype.c b/test/mpi/io/i_bigtype.c
index a5968a9..35aa8de 100644
--- a/test/mpi/io/i_bigtype.c
+++ b/test/mpi/io/i_bigtype.c
@@ -47,6 +47,10 @@ int main(int argc, char **argv)
     /* create a large buffer 2 */
     buf_write = malloc(NUM_X * NUM_Y * sizeof(int));
     buf_read = malloc(NUM_X * NUM_Y * sizeof(int));
+    if (buf_write == NULL || buf_read == NULL ) {
+        fprintf(stderr, "Not enough memory\n");
+        exit(1);
+    }
     memset(buf_read, 0, NUM_X * NUM_Y * sizeof(int));
 
     for (i = 0; i < NUM_X; i++) {
@@ -88,21 +92,21 @@ int main(int argc, char **argv)
     rc = MPI_File_open(MPI_COMM_WORLD, "testfile",
                        MPI_MODE_RDWR | MPI_MODE_CREATE, MPI_INFO_NULL, &fh);
     if (rc != MPI_SUCCESS) {
-        printf("Can't open file: %s\n", "testfile");
+        fprintf(stderr, "Can't open file: %s\n", "testfile");
         exit(1);
     }
 
     rc = MPI_File_set_view(fh, 2144, MPI_BYTE, file_type, "native",
                            MPI_INFO_NULL);
     if (rc != MPI_SUCCESS) {
-        printf("ERROR SET VIEW\n");
+        fprintf(stderr, "ERROR SET VIEW\n");
         exit(1);
     }
 
     /* write everything */
     rc = MPI_File_iwrite_at_all(fh, 0, buf_write, 1, mem_type, &request);
     if (rc != MPI_SUCCESS) {
-        printf("%d ERROR IWRITE AT ALL\n", rc);
+        fprintf(stderr, "%d ERROR IWRITE AT ALL\n", rc);
         exit(1);
     }
     MPI_Wait(&request, &status);
@@ -110,14 +114,14 @@ int main(int argc, char **argv)
     rc = MPI_File_set_view(fh, 2144, MPI_BYTE, file_type, "native",
                            MPI_INFO_NULL);
     if (rc != MPI_SUCCESS) {
-        printf("ERROR SET VIEW\n");
+        fprintf(stderr, "ERROR SET VIEW\n");
         exit(1);
     }
 
     /* read everything */
     rc = MPI_File_iread_at_all(fh, 0, buf_read, 1, mem_type, &request);
     if (rc != MPI_SUCCESS) {
-        printf("%d ERROR IREAD AT ALL\n", rc);
+        fprintf(stderr, "%d ERROR IREAD AT ALL\n", rc);
         exit(1);
     }
     MPI_Wait(&request, &status);

http://git.mpich.org/mpich.git/commitdiff/bbf05d805ee975451bd97f3e5cbf9c2e56e49511

commit bbf05d805ee975451bd97f3e5cbf9c2e56e49511
Author: Rob Latham <robl at mcs.anl.gov>
Date:   Wed Jun 3 11:34:31 2015 -0500

    test case for "unable to create file"
    
    This test failed on Lustre and Panaasas because the hinting code opens a
    file in order to set or get layout information.
    
    Ref #2261
    Ref https://github.com/open-mpi/ompi/issues/158
    
    Signed-off-by: Pavan Balaji <balaji at anl.gov>

diff --git a/test/mpi/io/Makefile.am b/test/mpi/io/Makefile.am
index abbfce5..e03cdb3 100644
--- a/test/mpi/io/Makefile.am
+++ b/test/mpi/io/Makefile.am
@@ -25,7 +25,9 @@ noinst_PROGRAMS = \
     resized       \
     resized2      \
     bigtype       \
-    hindexed_io
+    hindexed_io   \
+    simple_collective
+
 
 if BUILD_MPIX_TESTS
 noinst_PROGRAMS +=      \
diff --git a/test/mpi/io/simple_collective.c b/test/mpi/io/simple_collective.c
new file mode 100644
index 0000000..54e32fa
--- /dev/null
+++ b/test/mpi/io/simple_collective.c
@@ -0,0 +1,163 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *  (C) 2015 by Argonne National Laboratory.
+ *      See COPYRIGHT in top-level directory.
+ */
+
+
+/* this deceptively simple test uncovered a bug in the way certain file systems
+ * dealt with tuning parmeters.  See
+ * https://github.com/open-mpi/ompi/issues/158 and
+ * http://trac.mpich.org/projects/mpich/ticket/2261
+ *
+ * originally uncovered in Darshan:
+ * http://lists.mcs.anl.gov/pipermail/darshan-users/2015-February/000256.html
+ *
+ * to really exercise the bug in simple_collective,
+ * we'd have to run on a Lustre or Panasas file system.
+ *
+ * I am surprised src/mpi/romio/test/create_excl.c did not uncover the bug
+ */
+
+#define _LARGEFILE64_SOURCE
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/time.h>
+#include <mpi.h>
+#include <errno.h>
+#include <getopt.h>
+
+static char *opt_file = NULL;
+static int rank = -1;
+
+static int parse_args(int argc, char **argv);
+static void usage(const char *prog);
+
+int test_write(char *file, int nprocs, int rank, MPI_Info info)
+{
+    double stime, etime, wtime, w_elapsed, w_slowest, elapsed, slowest;
+    MPI_File fh;
+    int ret;
+    char buffer[700] = { 0 };
+    MPI_Status status;
+    int verbose = 0;
+
+    MPI_Barrier(MPI_COMM_WORLD);
+    stime = MPI_Wtime();
+
+    ret = MPI_File_open(MPI_COMM_WORLD, file,
+                        MPI_MODE_CREATE | MPI_MODE_WRONLY | MPI_MODE_EXCL, info, &fh);
+
+    if (ret != 0) {
+        fprintf(stderr, "Error: failed to open %s\n", file);
+        return 1;
+    }
+
+    etime = MPI_Wtime();
+
+    ret = MPI_File_write_at_all(fh, rank * 700, buffer, 700, MPI_BYTE, &status);
+    if (ret != 0) {
+        fprintf(stderr, "Error: failed to write %s\n", file);
+        return 1;
+    }
+
+    wtime = MPI_Wtime();
+
+    MPI_File_close(&fh);
+
+    elapsed = etime - stime;
+    w_elapsed = wtime - etime;
+    MPI_Reduce(&elapsed, &slowest, 1, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD);
+    MPI_Reduce(&w_elapsed, &w_slowest, 1, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD);
+
+    if (rank == 0) {
+        unlink(file);
+
+        slowest *= 1000.0;
+        w_slowest *= 1000.0;
+        if (verbose == 1) {
+            printf("file: %s, nprocs: %d, open_time: %f ms, write_time: %f ms\n",
+                   file, nprocs, slowest, w_slowest);
+        }
+    }
+    return 0;
+}
+
+int main(int argc, char **argv)
+{
+    int nprocs;
+    char file[256];
+    MPI_Info info;
+    int nr_errors = 0;
+
+
+    MPI_Init(&argc, &argv);
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
+
+    /* parse the command line arguments */
+    parse_args(argc, argv);
+
+    sprintf(file, "%s", opt_file);
+    MPI_Info_create(&info);
+    nr_errors += test_write(file, nprocs, rank, info);
+    /* acutal value does not matter.  test only writes a small amount of data */
+    MPI_Info_set(info, "striping_factor", "50");
+    nr_errors += test_write(file, nprocs, rank, info);
+    MPI_Info_free(&info);
+
+    MPI_Finalize();
+    if (!rank && nr_errors == 0) {
+        printf(" No Errors\n");
+    }
+    return (-nr_errors);
+}
+
+static int parse_args(int argc, char **argv)
+{
+    int c;
+
+    while ((c = getopt(argc, argv, "e")) != EOF) {
+        switch (c) {
+        case 'h':
+            if (rank == 0)
+                usage(argv[0]);
+            exit(0);
+        case '?':      /* unknown */
+            if (rank == 0)
+                usage(argv[0]);
+            exit(1);
+        default:
+            break;
+        }
+    }
+
+    if (argc - optind != 1) {
+        if (rank == 0)
+            usage(argv[0]);
+        exit(1);
+    }
+
+    opt_file = strdup(argv[optind]);
+    assert(opt_file);
+
+    return (0);
+}
+
+static void usage(const char *prog)
+{
+    printf("Usage: %s [<OPTIONS>...] <FILE NAME>\n", prog);
+    printf("\n<OPTIONS> is one or more of\n");
+    printf(" -h       print this help\n");
+}
+
+/*
+ * vim: ts=8 sts=4 sw=4 noexpandtab
+ */
diff --git a/test/mpi/io/testlist.in b/test/mpi/io/testlist.in
index 2c88ede..9604d33 100644
--- a/test/mpi/io/testlist.in
+++ b/test/mpi/io/testlist.in
@@ -11,6 +11,7 @@ resized 1
 resized2 1
 bigtype 1
 hindexed_io 1
+simple_collective 1 arg="simple_collective.testfile"
 i_bigtype 1 mpiversion=3.1
 i_hindexed_io 1 mpiversion=3.1
 i_rdwrord 4 mpiversion=3.1

-----------------------------------------------------------------------

Summary of changes:
 src/mpi/romio/adio/ad_lustre/ad_lustre_hints.c |   92 ++++----------
 src/mpi/romio/adio/ad_lustre/ad_lustre_open.c  |  144 +++++++++++++++------
 src/mpi/romio/adio/common/ad_open.c            |   13 +-
 test/mpi/io/Makefile.am                        |    4 +-
 test/mpi/io/bigtype.c                          |   18 ++-
 test/mpi/io/i_bigtype.c                        |   14 ++-
 test/mpi/io/simple_collective.c                |  163 ++++++++++++++++++++++++
 test/mpi/io/testlist.in                        |    1 +
 8 files changed, 325 insertions(+), 124 deletions(-)
 create mode 100644 test/mpi/io/simple_collective.c


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list