[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.1b1-83-g0590d54

mysql vizuser noreply at mpich.org
Fri Oct 4 15:53:18 CDT 2013


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  0590d5431bb3b5976491f476a07f5533c8e36f5d (commit)
       via  edaa8396d770222318f771a26bda7057ba864fff (commit)
       via  b15761fc38ba3e97cabd349aafee48cee7926f9c (commit)
       via  3fb810c0662fe0a94fbddb94f5bd809f8f982f4f (commit)
       via  270d5115c0cbd7a796da021936e69d8c25e5ed45 (commit)
      from  3b3bd0654f69b0415a7a5d07ef3379fac0b6b799 (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/0590d5431bb3b5976491f476a07f5533c8e36f5d

commit 0590d5431bb3b5976491f476a07f5533c8e36f5d
Author: Rob Latham <robl at mcs.anl.gov>
Date:   Tue Jun 25 17:23:21 2013 -0500

    update adio drivers to use common hint processing funcs
    
    drivers updated:
    - ad_bgl
    - ad_bg
    - ad_lustre
    - ad_panfs
    - ad_pvfs2
    
      Reviewed-by: Rajeev Thakur <thakur at mcs.anl.gov>

diff --git a/src/mpi/romio/adio/ad_bg/ad_bg_hints.c b/src/mpi/romio/adio/ad_bg/ad_bg_hints.c
index 22b5e37..47a0e77 100644
--- a/src/mpi/romio/adio/ad_bg/ad_bg_hints.c
+++ b/src/mpi/romio/adio/ad_bg/ad_bg_hints.c
@@ -14,6 +14,7 @@
 
 #include "adio.h"
 #include "adio_extern.h"
+#include "hint_fns.h"
 
 #include "ad_bg.h"
 #include "ad_bg_pset.h"
@@ -168,317 +169,83 @@ void ADIOI_BG_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
 
     /* add in user's info if supplied */
     if (users_info != MPI_INFO_NULL) {
-	ADIOI_Info_get(users_info, "cb_buffer_size", MPI_MAX_INFO_VAL, 
-		     value, &flag);
-	if (flag && ((intval=atoi(value)) > 0)) {
-	    tmp_val = intval;
-
-	    MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-	    /* --BEGIN ERROR HANDLING-- */
-	    if (tmp_val != intval) {
-		MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-						   "cb_buffer_size",
-						   error_code);
-		return;
-	    }
-	    /* --END ERROR HANDLING-- */
-
-	    ADIOI_Info_set(info, "cb_buffer_size", value);
-	    fd->hints->cb_buffer_size = intval;
-
-	}
+	ADIOI_Info_check_and_install_int(fd, users_info, "cb_buffer_size", 
+		&(fd->hints->cb_buffer_size), myname, error_code);
 #if 0
 	/* bg is not implementing file realms (ADIOI_IOStridedColl) ... */
 	/* aligning file realms to certain sizes (e.g. stripe sizes)
 	 * may benefit I/O performance */
-	ADIOI_Info_get(users_info, "romio_cb_fr_alignment", MPI_MAX_INFO_VAL, 
-		     value, &flag);
-	if (flag && ((intval=atoi(value)) > 0)) {
-	    tmp_val = intval;
-
-	    MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-	    /* --BEGIN ERROR HANDLING-- */
-	    if (tmp_val != intval) {
-		MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-						   "romio_cb_fr_alignment",
-						   error_code);
-		return;
-	    }
-	    /* --END ERROR HANDLING-- */
-
-	    ADIOI_Info_set(info, "romio_cb_fr_alignment", value);
-	    fd->hints->cb_fr_alignment = intval;
-
-	}
+	ADIOI_Info_check_and_install_int(fd, users_info, "romio_cb_fr_alignment", 
+		&(fd->hints->cb_fr_alignment), myname, error_code);
 
 	/* for collective I/O, try to be smarter about when to do data sieving
 	 * using a specific threshold for the datatype size/extent
 	 * (percentage 0-100%) */
-	ADIOI_Info_get(users_info, "romio_cb_ds_threshold", MPI_MAX_INFO_VAL, 
-		     value, &flag);
-	if (flag && ((intval=atoi(value)) > 0)) {
-	    tmp_val = intval;
-
-	    MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-	    /* --BEGIN ERROR HANDLING-- */
-	    if (tmp_val != intval) {
-		MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-						   "romio_cb_ds_threshold",
-						   error_code);
-		return;
-	    }
-	    /* --END ERROR HANDLING-- */
-
-	    ADIOI_Info_set(info, "romio_cb_ds_threshold", value);
-	    fd->hints->cb_ds_threshold = intval;
+	ADIOI_Info_check_and_install_int(fd, users_info, "romio_cb_ds_threshold", 
+		&(fd->hints->cb_ds_threshold), myname, error_code);
 
-	}
-	ADIOI_Info_get(users_info, "romio_cb_alltoall", MPI_MAX_INFO_VAL, value,
-		     &flag);
-	if (flag) {
-	    if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) {
-		ADIOI_Info_set(info, "romio_cb_alltoall", value);
-		fd->hints->cb_read = ADIOI_HINT_ENABLE;
-	    }
-	    else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) {
-		ADIOI_Info_set(info, "romio_cb_alltoall", value);
-		fd->hints->cb_read = ADIOI_HINT_DISABLE;
-	    }
-	    else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC"))
-	    {
-		ADIOI_Info_set(info, "romio_cb_alltoall", value);
-		fd->hints->cb_read = ADIOI_HINT_AUTO;
-	    }
-
-	    tmp_val = fd->hints->cb_alltoall;
-
-	    MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-	    /* --BEGIN ERROR HANDLING-- */
-	    if (tmp_val != fd->hints->cb_alltoall) {
-		MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-						   "romio_cb_alltoall",
-						   error_code);
-		return;
-	    }
-	    /* --END ERROR HANDLING-- */
-	}
+	ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_cb_alltoall",
+		&(fd->hints->cb_alltoall), myname, error_code);
 #endif
 	/* new hints for enabling/disabling coll. buffering on
 	 * reads/writes
 	 */
-	ADIOI_Info_get(users_info, "romio_cb_read", MPI_MAX_INFO_VAL, value,
-		     &flag);
-	if (flag) {
-	    if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) {
-		ADIOI_Info_set(info, "romio_cb_read", value);
-		fd->hints->cb_read = ADIOI_HINT_ENABLE;
-	    }
-	    else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) {
-		    /* romio_cb_read overrides no_indep_rw */
-		ADIOI_Info_set(info, "romio_cb_read", value);
-		ADIOI_Info_set(info, "romio_no_indep_rw", "false");
-		fd->hints->cb_read = ADIOI_HINT_DISABLE;
-		fd->hints->no_indep_rw = ADIOI_HINT_DISABLE;
-	    }
-	    else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC"))
-	    {
-		ADIOI_Info_set(info, "romio_cb_read", value);
-		fd->hints->cb_read = ADIOI_HINT_AUTO;
-	    }
-
-	    tmp_val = fd->hints->cb_read;
-
-	    MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-	    /* --BEGIN ERROR HANDLING-- */
-	    if (tmp_val != fd->hints->cb_read) {
-		MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-						   "romio_cb_read",
-						   error_code);
-		return;
-	    }
-	    /* --END ERROR HANDLING-- */
+	ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_cb_read",
+		&(fd->hints->cb_read), myname, error_code);
+	if (fd->hints->cb_read == ADIOI_HINT_DISABLE) {
+	    /* romio_cb_read overrides no_indep_rw */
+	    ADIOI_Info_set(info, "romio_no_indep_rw", "false");
+	    fd->hints->no_indep_rw = ADIOI_HINT_DISABLE;
 	}
-	ADIOI_Info_get(users_info, "romio_cb_write", MPI_MAX_INFO_VAL, value,
-		     &flag);
-	if (flag) {
-	    if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) {
-		ADIOI_Info_set(info, "romio_cb_write", value);
-		fd->hints->cb_write = ADIOI_HINT_ENABLE;
-	    }
-	    else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE"))
-	    {
-		/* romio_cb_write overrides no_indep_rw, too */
-		ADIOI_Info_set(info, "romio_cb_write", value);
-		ADIOI_Info_set(info, "romio_no_indep_rw", "false");
-		fd->hints->cb_write = ADIOI_HINT_DISABLE;
-		fd->hints->no_indep_rw = ADIOI_HINT_DISABLE;
-	    }
-	    else if (!strcmp(value, "automatic") ||
-		     !strcmp(value, "AUTOMATIC"))
-	    {
-		ADIOI_Info_set(info, "romio_cb_write", value);
-		fd->hints->cb_write = ADIOI_HINT_AUTO;
-	    }
-	
-	    tmp_val = fd->hints->cb_write;
-
-	    MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-	    /* --BEGIN ERROR HANDLING-- */
-	    if (tmp_val != fd->hints->cb_write) {
-		MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-						   "romio_cb_write",
-						   error_code);
-		return;
-	    }
-	    /* --END ERROR HANDLING-- */
+	ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_cb_write",
+		&(fd->hints->cb_write), myname, error_code);
+	if (fd->hints->cb_write == ADIOI_HINT_DISABLE) {
+	    /* romio_cb_write overrides no_indep_rw */
+	    ADIOI_Info_set(info, "romio_no_indep_rw", "false");
+	    fd->hints->no_indep_rw = ADIOI_HINT_DISABLE;
 	}
-
 #if 0
 	/* bg is not implementing file realms (ADIOI_IOStridedColl) ... */
 	/* enable/disable persistent file realms for collective I/O */
 	/* may want to check for no_indep_rdwr hint as well */
-	ADIOI_Info_get(users_info, "romio_cb_pfr", MPI_MAX_INFO_VAL, value,
-		     &flag);
-	if (flag) {
-	    if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) {
-		ADIOI_Info_set(info, "romio_cb_pfr", value);
-		fd->hints->cb_pfr = ADIOI_HINT_ENABLE;
-	    }
-	    else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) {
-		ADIOI_Info_set(info, "romio_cb_pfr", value);
-		fd->hints->cb_pfr = ADIOI_HINT_DISABLE;
-	    }
-	    else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC"))
-	    {
-		ADIOI_Info_set(info, "romio_cb_pfr", value);
-		fd->hints->cb_pfr = ADIOI_HINT_AUTO;
-	    }
-
-	    tmp_val = fd->hints->cb_pfr;
-
-	    MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-	    /* --BEGIN ERROR HANDLING-- */
-	    if (tmp_val != fd->hints->cb_pfr) {
-		MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-						   "romio_cb_pfr",
-						   error_code);
-		return;
-	    }
-	    /* --END ERROR HANDLING-- */
-	}
-
+	ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_cb_pfr",
+		&(fd->hints->cb_pfr), myname, error_code);
+	
 	/* file realm assignment types ADIOI_FR_AAR(0),
 	 ADIOI_FR_FSZ(-1), ADIOI_FR_USR_REALMS(-2), all others specify
 	 a regular fr size in bytes. probably not the best way... */
-	ADIOI_Info_get(users_info, "romio_cb_fr_type", MPI_MAX_INFO_VAL, 
-		     value, &flag);
-	if (flag && ((intval=atoi(value)) >= -2)) {
-	    tmp_val = intval;
-
-	    MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-	    /* --BEGIN ERROR HANDLING-- */
-	    if (tmp_val != intval) {
-		MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-						   "romio_cb_fr_type",
-						   error_code);
-		return;
-	    }
-	    /* --END ERROR HANDLING-- */
-
-	    ADIOI_Info_set(info, "romio_cb_fr_type", value);
-	    fd->hints->cb_fr_type = intval;
+	ADIOI_Info_check_and_install_int(fd, users_info, "romio_cb_fr_type",
+		&(fd->hints->cb_fr_type), myname, error_code);
 
-	}
 #endif
-	/* new hint for specifying no indep. read/write will be performed */
-	ADIOI_Info_get(users_info, "romio_no_indep_rw", MPI_MAX_INFO_VAL, value,
-		     &flag);
-	if (flag) {
-	    if (!strcmp(value, "true") || !strcmp(value, "TRUE")) {
-		    /* if 'no_indep_rw' set, also hint that we will do
-		     * collective buffering: if we aren't doing independent io,
-		     * then we have to do collective  */
-		ADIOI_Info_set(info, "romio_no_indep_rw", value);
-		ADIOI_Info_set(info, "romio_cb_write", "enable");
-		ADIOI_Info_set(info, "romio_cb_read", "enable");
-		fd->hints->no_indep_rw = 1;
-		fd->hints->cb_read = 1;
-		fd->hints->cb_write = 1;
-		tmp_val = 1;
-	    }
-	    else if (!strcmp(value, "false") || !strcmp(value, "FALSE")) {
-		ADIOI_Info_set(info, "romio_no_indep_rw", value);
-		fd->hints->no_indep_rw = 0;
-		tmp_val = 0;
-	    }
-	    else {
-		/* default is above */
-		tmp_val = 0;
-	    }
-
-	    MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-	    /* --BEGIN ERROR HANDLING-- */
-	    if (tmp_val != fd->hints->no_indep_rw) {
-		MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-						   "romio_no_indep_rw",
-						   error_code);
-		return;
-	    }
-	    /* --END ERROR HANDLING-- */
-	}
+	/* Has the user indicated all I/O will be done collectively? */
+	ADIOI_Info_check_and_install_true(fd, users_info, "romio_no_indep_rw",
+		&(fd->hints->no_indep_rw), myname, error_code);
+	if (fd->hints->no_indep_rw == 1) {
+	    /* if 'no_indep_rw' set, also hint that we will do
+	     * collective buffering: if we aren't doing independent io,
+	     * then we have to do collective  */
+	    ADIOI_Info_set(info, "romio_cb_write", "enable");
+	    ADIOI_Info_set(info, "romio_cb_read", "enable");
+	    fd->hints->cb_read = 1;
+	    fd->hints->cb_write = 1;
+	} 
+
 	/* new hints for enabling/disabling data sieving on
 	 * reads/writes
 	 */
-	ADIOI_Info_get(users_info, "romio_ds_read", MPI_MAX_INFO_VAL, value, 
-		     &flag);
-	if (flag) {
-	    if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) {
-		ADIOI_Info_set(info, "romio_ds_read", value);
-		fd->hints->ds_read = ADIOI_HINT_ENABLE;
-	    }
-	    else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) {
-		ADIOI_Info_set(info, "romio_ds_read", value);
-		fd->hints->ds_read = ADIOI_HINT_DISABLE;
-	    }
-	    else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC"))
-	    {
-		ADIOI_Info_set(info, "romio_ds_read", value);
-		fd->hints->ds_read = ADIOI_HINT_AUTO;
-	    }
-	    /* otherwise ignore */
-	}
-	ADIOI_Info_get(users_info, "romio_ds_write", MPI_MAX_INFO_VAL, value, 
-		     &flag);
-	if (flag) {
-	    if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) {
-		ADIOI_Info_set(info, "romio_ds_write", value);
-		fd->hints->ds_write = ADIOI_HINT_ENABLE;
-	    }
-	    else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) {
-		ADIOI_Info_set(info, "romio_ds_write", value);
-		fd->hints->ds_write = ADIOI_HINT_DISABLE;
-	    }
-	    else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC"))
-	    {
-		ADIOI_Info_set(info, "romio_ds_write", value);
-		fd->hints->ds_write = ADIOI_HINT_AUTO;
-	    }
-	    /* otherwise ignore */
-	}
+	ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_ds_read",
+		&(fd->hints->ds_read), myname, error_code);
+	ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_ds_write",
+		&(fd->hints->ds_write), myname, error_code);
 
-	ADIOI_Info_get(users_info, "ind_wr_buffer_size", MPI_MAX_INFO_VAL, 
-		     value, &flag);
-	if (flag && ((intval = atoi(value)) > 0)) {
-	    ADIOI_Info_set(info, "ind_wr_buffer_size", value);
-	    fd->hints->ind_wr_buffer_size = intval;
-	}
 
-	ADIOI_Info_get(users_info, "ind_rd_buffer_size", MPI_MAX_INFO_VAL, 
-		     value, &flag);
-	if (flag && ((intval = atoi(value)) > 0)) {
-	    ADIOI_Info_set(info, "ind_rd_buffer_size", value);
-	    fd->hints->ind_rd_buffer_size = intval;
-	}
+
+	ADIOI_Info_check_and_install_int(fd, users_info, "ind_wr_buffer_size",
+		&(fd->hints->ind_wr_buffer_size), myname, error_code);
+	ADIOI_Info_check_and_install_int(fd, users_info, "ind_rd_buffer_size",
+		&(fd->hints->ind_rd_buffer_size), myname, error_code);
+
 
 	memset( value, 0, MPI_MAX_INFO_VAL+1 );
 	ADIOI_Info_get(users_info, "romio_min_fdomain_size", MPI_MAX_INFO_VAL,
@@ -489,11 +256,8 @@ void ADIOI_BG_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
 	}
   /* Now we use striping unit in common code so we should
      process hints for it. */
-	ADIOI_Info_get(users_info, "striping_unit", MPI_MAX_INFO_VAL,
-			value, &flag);
-	if ( flag && ((intval = atoi(value)) > 0) ) {
-		ADIOI_Info_set(info, "striping_unit", value);
-		fd->hints->striping_unit = intval;
+	ADIOI_Info_check_and_install_int(fd, users_info, "striping_unit", 
+		&(fd->hints->striping_unit), myname, error_code);
 	}
 
 	memset( value, 0, MPI_MAX_INFO_VAL+1 );
diff --git a/src/mpi/romio/adio/ad_bgl/ad_bgl_hints.c b/src/mpi/romio/adio/ad_bgl/ad_bgl_hints.c
index d106eea..e9f5a31 100644
--- a/src/mpi/romio/adio/ad_bgl/ad_bgl_hints.c
+++ b/src/mpi/romio/adio/ad_bgl/ad_bgl_hints.c
@@ -14,6 +14,7 @@
 
 #include "adio.h"
 #include "adio_extern.h"
+#include "hints_fn.h"
 
 #include "ad_bgl.h"
 #include "ad_bgl_pset.h"
@@ -56,7 +57,7 @@ void ADIOI_BGL_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
 
     MPI_Info info;
     char *value;
-    int flag, intval, tmp_val, nprocs=0, nprocs_is_valid = 0;
+    int flag, intval, tmp_val, nprocs=0;
     static char myname[] = "ADIOI_BGL_SETINFO";
 
     int did_anything = 0;
@@ -95,7 +96,6 @@ void ADIOI_BGL_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
 
 	/* number of processes that perform I/O in collective I/O */
 	MPI_Comm_size(fd->comm, &nprocs);
-	nprocs_is_valid = 1;
 	ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", nprocs);
 	ADIOI_Info_set(info, "cb_nodes", value);
 	fd->hints->cb_nodes = -1;
@@ -167,332 +167,92 @@ void ADIOI_BGL_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
 
     /* add in user's info if supplied */
     if (users_info != MPI_INFO_NULL) {
-	ADIOI_Info_get(users_info, "cb_buffer_size", MPI_MAX_INFO_VAL, 
-		     value, &flag);
-	if (flag && ((intval=atoi(value)) > 0)) {
-	    tmp_val = intval;
-
-	    MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-	    /* --BEGIN ERROR HANDLING-- */
-	    if (tmp_val != intval) {
-		MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-						   "cb_buffer_size",
-						   error_code);
-		return;
-	    }
-	    /* --END ERROR HANDLING-- */
-
-	    ADIOI_Info_set(info, "cb_buffer_size", value);
-	    fd->hints->cb_buffer_size = intval;
-
-	}
+	ADIOI_Info_check_and_install_int(fd, users_info, "cb_buffer_size",
+		&(fd->hints->cb_buffer_size), myname, error_code);
 #if 0
 	/* bgl is not implementing file realms (ADIOI_IOStridedColl) ... */
 	/* aligning file realms to certain sizes (e.g. stripe sizes)
 	 * may benefit I/O performance */
-	ADIOI_Info_get(users_info, "romio_cb_fr_alignment", MPI_MAX_INFO_VAL, 
-		     value, &flag);
-	if (flag && ((intval=atoi(value)) > 0)) {
-	    tmp_val = intval;
-
-	    MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-	    /* --BEGIN ERROR HANDLING-- */
-	    if (tmp_val != intval) {
-		MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-						   "romio_cb_fr_alignment",
-						   error_code);
-		return;
-	    }
-	    /* --END ERROR HANDLING-- */
-
-	    ADIOI_Info_set(info, "romio_cb_fr_alignment", value);
-	    fd->hints->cb_fr_alignment = intval;
-
-	}
+	ADIOI_Info_check_and_install_int(fd, users_info, "romio_cb_fr_alignment", 
+		&(fd->hints->cb_fr_alignment), myname, error_code);
 
 	/* for collective I/O, try to be smarter about when to do data sieving
 	 * using a specific threshold for the datatype size/extent
 	 * (percentage 0-100%) */
-	ADIOI_Info_get(users_info, "romio_cb_ds_threshold", MPI_MAX_INFO_VAL, 
-		     value, &flag);
-	if (flag && ((intval=atoi(value)) > 0)) {
-	    tmp_val = intval;
-
-	    MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-	    /* --BEGIN ERROR HANDLING-- */
-	    if (tmp_val != intval) {
-		MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-						   "romio_cb_ds_threshold",
-						   error_code);
-		return;
-	    }
-	    /* --END ERROR HANDLING-- */
-
-	    ADIOI_Info_set(info, "romio_cb_ds_threshold", value);
-	    fd->hints->cb_ds_threshold = intval;
+	ADIOI_Info_check_and_install_int(fd, users_info, "romio_cb_ds_threshold", 
+		&(fd->hints->cb_ds_threshold), myname, error_code);
 
-	}
-	ADIOI_Info_get(users_info, "romio_cb_alltoall", MPI_MAX_INFO_VAL, value,
-		     &flag);
-	if (flag) {
-	    if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) {
-		ADIOI_Info_set(info, "romio_cb_alltoall", value);
-		fd->hints->cb_read = ADIOI_HINT_ENABLE;
-	    }
-	    else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) {
-		ADIOI_Info_set(info, "romio_cb_alltoall", value);
-		fd->hints->cb_read = ADIOI_HINT_DISABLE;
-	    }
-	    else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC"))
-	    {
-		ADIOI_Info_set(info, "romio_cb_alltoall", value);
-		fd->hints->cb_read = ADIOI_HINT_AUTO;
-	    }
-
-	    tmp_val = fd->hints->cb_alltoall;
-
-	    MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-	    /* --BEGIN ERROR HANDLING-- */
-	    if (tmp_val != fd->hints->cb_alltoall) {
-		MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-						   "romio_cb_alltoall",
-						   error_code);
-		return;
-	    }
-	    /* --END ERROR HANDLING-- */
-	}
+	ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_cb_alltoall",
+		&(fd->hints->cb_alltoall), myname, error_code);
 #endif
 	/* new hints for enabling/disabling coll. buffering on
 	 * reads/writes
 	 */
-	ADIOI_Info_get(users_info, "romio_cb_read", MPI_MAX_INFO_VAL, value,
-		     &flag);
-	if (flag) {
-	    if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) {
-		ADIOI_Info_set(info, "romio_cb_read", value);
-		fd->hints->cb_read = ADIOI_HINT_ENABLE;
-	    }
-	    else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) {
-		    /* romio_cb_read overrides no_indep_rw */
-		ADIOI_Info_set(info, "romio_cb_read", value);
-		ADIOI_Info_set(info, "romio_no_indep_rw", "false");
-		fd->hints->cb_read = ADIOI_HINT_DISABLE;
-		fd->hints->no_indep_rw = ADIOI_HINT_DISABLE;
-	    }
-	    else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC"))
-	    {
-		ADIOI_Info_set(info, "romio_cb_read", value);
-		fd->hints->cb_read = ADIOI_HINT_AUTO;
-	    }
-
-	    tmp_val = fd->hints->cb_read;
-
-	    MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-	    /* --BEGIN ERROR HANDLING-- */
-	    if (tmp_val != fd->hints->cb_read) {
-		MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-						   "romio_cb_read",
-						   error_code);
-		return;
-	    }
-	    /* --END ERROR HANDLING-- */
+	ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_cb_read",
+		&(fd->hints->cb_read), myname, error_code);
+	if (fd->hints->cb_read == ADIOI_HINT_DISABLE) {
+	    /* romio_cb_read overrides no_indep_rw */
+	    ADIOI_Info_set(info, "romio_no_indep_rw", "false");
+	    fd->hints->no_indep_rw = ADIOI_HINT_DISABLE;
 	}
-	ADIOI_Info_get(users_info, "romio_cb_write", MPI_MAX_INFO_VAL, value,
-		     &flag);
-	if (flag) {
-	    if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) {
-		ADIOI_Info_set(info, "romio_cb_write", value);
-		fd->hints->cb_write = ADIOI_HINT_ENABLE;
-	    }
-	    else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE"))
-	    {
-		/* romio_cb_write overrides no_indep_rw, too */
-		ADIOI_Info_set(info, "romio_cb_write", value);
-		ADIOI_Info_set(info, "romio_no_indep_rw", "false");
-		fd->hints->cb_write = ADIOI_HINT_DISABLE;
-		fd->hints->no_indep_rw = ADIOI_HINT_DISABLE;
-	    }
-	    else if (!strcmp(value, "automatic") ||
-		     !strcmp(value, "AUTOMATIC"))
-	    {
-		ADIOI_Info_set(info, "romio_cb_write", value);
-		fd->hints->cb_write = ADIOI_HINT_AUTO;
-	    }
-	
-	    tmp_val = fd->hints->cb_write;
-
-	    MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-	    /* --BEGIN ERROR HANDLING-- */
-	    if (tmp_val != fd->hints->cb_write) {
-		MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-						   "romio_cb_write",
-						   error_code);
-		return;
-	    }
-	    /* --END ERROR HANDLING-- */
+
+	ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_cb_write",
+		&(fd->hints->cb_write), myname, error_code);
+	if (fd->hints->cb_write == ADIOI_HINT_DISABLE) {
+	    /* romio_cb_write overrides no_indep_rw */
+	    ADIOI_Info_set(info, "romio_no_indep_rw", "false");
+	    fd->hints->no_indep_rw = ADIOI_HINT_DISABLE;
 	}
 
+
 #if 0
 	/* bgl is not implementing file realms (ADIOI_IOStridedColl) ... */
 	/* enable/disable persistent file realms for collective I/O */
 	/* may want to check for no_indep_rdwr hint as well */
-	ADIOI_Info_get(users_info, "romio_cb_pfr", MPI_MAX_INFO_VAL, value,
-		     &flag);
-	if (flag) {
-	    if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) {
-		ADIOI_Info_set(info, "romio_cb_pfr", value);
-		fd->hints->cb_pfr = ADIOI_HINT_ENABLE;
-	    }
-	    else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) {
-		ADIOI_Info_set(info, "romio_cb_pfr", value);
-		fd->hints->cb_pfr = ADIOI_HINT_DISABLE;
-	    }
-	    else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC"))
-	    {
-		ADIOI_Info_set(info, "romio_cb_pfr", value);
-		fd->hints->cb_pfr = ADIOI_HINT_AUTO;
-	    }
-
-	    tmp_val = fd->hints->cb_pfr;
-
-	    MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-	    /* --BEGIN ERROR HANDLING-- */
-	    if (tmp_val != fd->hints->cb_pfr) {
-		MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-						   "romio_cb_pfr",
-						   error_code);
-		return;
-	    }
-	    /* --END ERROR HANDLING-- */
-	}
+	ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_cb_pfr",
+		&(fd->hints->cb_pfr), myname, error_code);
+
 
 	/* file realm assignment types ADIOI_FR_AAR(0),
 	 ADIOI_FR_FSZ(-1), ADIOI_FR_USR_REALMS(-2), all others specify
 	 a regular fr size in bytes. probably not the best way... */
-	ADIOI_Info_get(users_info, "romio_cb_fr_type", MPI_MAX_INFO_VAL, 
-		     value, &flag);
-	if (flag && ((intval=atoi(value)) >= -2)) {
-	    tmp_val = intval;
-
-	    MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-	    /* --BEGIN ERROR HANDLING-- */
-	    if (tmp_val != intval) {
-		MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-						   "romio_cb_fr_type",
-						   error_code);
-		return;
-	    }
-	    /* --END ERROR HANDLING-- */
-
-	    ADIOI_Info_set(info, "romio_cb_fr_type", value);
-	    fd->hints->cb_fr_type = intval;
-
-	}
+	ADIOI_Info_check_and_install_int(fd, users_info, "romio_cb_fr_type",
+		&(fd->hints->cb_fr_type), myname, error_code);
 #endif
-	/* new hint for specifying no indep. read/write will be performed */
-	ADIOI_Info_get(users_info, "romio_no_indep_rw", MPI_MAX_INFO_VAL, value,
-		     &flag);
-	if (flag) {
-	    if (!strcmp(value, "true") || !strcmp(value, "TRUE")) {
-		    /* if 'no_indep_rw' set, also hint that we will do
-		     * collective buffering: if we aren't doing independent io,
-		     * then we have to do collective  */
-		ADIOI_Info_set(info, "romio_no_indep_rw", value);
-		ADIOI_Info_set(info, "romio_cb_write", "enable");
-		ADIOI_Info_set(info, "romio_cb_read", "enable");
-		fd->hints->no_indep_rw = 1;
-		fd->hints->cb_read = 1;
-		fd->hints->cb_write = 1;
-		tmp_val = 1;
-	    }
-	    else if (!strcmp(value, "false") || !strcmp(value, "FALSE")) {
-		ADIOI_Info_set(info, "romio_no_indep_rw", value);
-		fd->hints->no_indep_rw = 0;
-		tmp_val = 0;
-	    }
-	    else {
-		/* default is above */
-		tmp_val = 0;
-	    }
-
-	    MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-	    /* --BEGIN ERROR HANDLING-- */
-	    if (tmp_val != fd->hints->no_indep_rw) {
-		MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-						   "romio_no_indep_rw",
-						   error_code);
-		return;
-	    }
-	    /* --END ERROR HANDLING-- */
-	}
+	/* Has the user indicated all I/O will be done collectively? */
+	ADIOI_Info_check_and_install_true(fd, users_info, "romio_no_indep_rw",
+		&(fd->hints->no_indep_rw), myname, error_code);
+	if (fd->hints->no_indep_rw == 1) {
+	    /* if 'no_indep_rw' set, also hint that we will do
+	     * collective buffering: if we aren't doing independent io,
+	     * then we have to do collective  */
+	    ADIOI_Info_set(info, "romio_cb_write", "enable");
+	    ADIOI_Info_set(info, "romio_cb_read", "enable");
+	    fd->hints->cb_read = 1;
+	    fd->hints->cb_write = 1;
+	} 
 	/* new hints for enabling/disabling data sieving on
 	 * reads/writes
 	 */
-	ADIOI_Info_get(users_info, "romio_ds_read", MPI_MAX_INFO_VAL, value, 
-		     &flag);
-	if (flag) {
-	    if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) {
-		ADIOI_Info_set(info, "romio_ds_read", value);
-		fd->hints->ds_read = ADIOI_HINT_ENABLE;
-	    }
-	    else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) {
-		ADIOI_Info_set(info, "romio_ds_read", value);
-		fd->hints->ds_read = ADIOI_HINT_DISABLE;
-	    }
-	    else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC"))
-	    {
-		ADIOI_Info_set(info, "romio_ds_read", value);
-		fd->hints->ds_read = ADIOI_HINT_AUTO;
-	    }
-	    /* otherwise ignore */
-	}
-	ADIOI_Info_get(users_info, "romio_ds_write", MPI_MAX_INFO_VAL, value, 
-		     &flag);
-	if (flag) {
-	    if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) {
-		ADIOI_Info_set(info, "romio_ds_write", value);
-		fd->hints->ds_write = ADIOI_HINT_ENABLE;
-	    }
-	    else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) {
-		ADIOI_Info_set(info, "romio_ds_write", value);
-		fd->hints->ds_write = ADIOI_HINT_DISABLE;
-	    }
-	    else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC"))
-	    {
-		ADIOI_Info_set(info, "romio_ds_write", value);
-		fd->hints->ds_write = ADIOI_HINT_AUTO;
-	    }
-	    /* otherwise ignore */
+	ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_ds_read",
+		&(fd->hints->ds_read), myname, error_code);
+	ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_ds_write",
+		&(fd->hints->ds_write), myname, error_code);
 	}
 
-	ADIOI_Info_get(users_info, "ind_wr_buffer_size", MPI_MAX_INFO_VAL, 
-		     value, &flag);
-	if (flag && ((intval = atoi(value)) > 0)) {
-	    ADIOI_Info_set(info, "ind_wr_buffer_size", value);
-	    fd->hints->ind_wr_buffer_size = intval;
-	}
+	ADIOI_Info_check_and_install_int(fd, users_info, "ind_wr_buffer_size",
+		&(fd->hints->ind_wr_buffer_size), myname, error_code);
+	ADIOI_Info_check_and_install_int(fd, users_info, "ind_rd_buffer_size",
+		&(fd->hints->ind_rd_buffer_size), myname, error_code);
 
-	ADIOI_Info_get(users_info, "ind_rd_buffer_size", MPI_MAX_INFO_VAL, 
-		     value, &flag);
-	if (flag && ((intval = atoi(value)) > 0)) {
-	    ADIOI_Info_set(info, "ind_rd_buffer_size", value);
-	    fd->hints->ind_rd_buffer_size = intval;
-	}
 
-	memset( value, 0, MPI_MAX_INFO_VAL+1 );
-	ADIOI_Info_get(users_info, "romio_min_fdomain_size", MPI_MAX_INFO_VAL,
-			value, &flag);
-	if ( flag && ((intval = atoi(value)) > 0) ) {
-		ADIOI_Info_set(info, "romio_min_fdomain_size", value);
-		fd->hints->min_fdomain_size = intval;
+	ADIOI_Info_check_and_install_int(fd, users_info, "romio_min_fdomain_size",
+		&(fd->hints->min_fdomain_size), myname, error_code);
 	}
   /* Now we use striping unit in common code so we should
      process hints for it. */
-	ADIOI_Info_get(users_info, "striping_unit", MPI_MAX_INFO_VAL,
-			value, &flag);
-	if ( flag && ((intval = atoi(value)) > 0) ) {
-		ADIOI_Info_set(info, "striping_unit", value);
-		fd->hints->striping_unit = intval;
+	ADIOI_Info_check_and_install_int(fd, users_info, "striping_unit", 
+		&(fd->hints->striping_unit), myname, error_code);
 	}
 
 	memset( value, 0, MPI_MAX_INFO_VAL+1 );
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 ea2c4ba..8872e01 100644
--- a/src/mpi/romio/adio/ad_lustre/ad_lustre_hints.c
+++ b/src/mpi/romio/adio/ad_lustre/ad_lustre_hints.c
@@ -10,6 +10,7 @@
 
 #include "ad_lustre.h"
 #include "adio_extern.h"
+#include "hint_fns.h"
 
 void ADIOI_LUSTRE_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
 {
@@ -138,56 +139,19 @@ void ADIOI_LUSTRE_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
     if (users_info != MPI_INFO_NULL) {
         /* CO: IO Clients/OST,
          * to keep the load balancing between clients and OSTs */
-        ADIOI_Info_get(users_info, "romio_lustre_co_ratio", MPI_MAX_INFO_VAL, value,
-                     &flag);
-	if (flag && (int_val = atoi(value)) > 0) {
-            tmp_val = int_val;
-	    MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-	    if (tmp_val != int_val) {
-                MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-                                                   "romio_lustre_co_ratio",
-                                                   error_code);
-                ADIOI_Free(value);
-		return;
-	    }
-	    ADIOI_Info_set(fd->info, "romio_lustre_co_ratio", value);
-            fd->hints->fs_hints.lustre.co_ratio = atoi(value);
-	}
+	ADIOI_Info_check_and_install_int(fd, users_info, "romio_lustre_co_ratio", 
+		&(fd->hints->fs_hints.lustre.co_ratio));
+
         /* coll_threshold:
          * if the req size is bigger than this, collective IO may not be performed.
          */
-	ADIOI_Info_get(users_info, "romio_lustre_coll_threshold", MPI_MAX_INFO_VAL, value,
-                     &flag);
-	if (flag && (int_val = atoi(value)) > 0) {
-            tmp_val = int_val;
-	    MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-	    if (tmp_val != int_val) {
-	        MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-		                                   "romio_lustre_coll_threshold",
-	                                           error_code);
-                ADIOI_Free(value);
-	        return;
-	    }
-	    ADIOI_Info_set(fd->info, "romio_lustre_coll_threshold", value);
-            fd->hints->fs_hints.lustre.coll_threshold = atoi(value);
-        }
+	ADIOI_Info_check_and_install_int(fd, users_info, "romio_lustre_coll_threshold",
+		&(fd->hints->fs_hints.lustre.coll_threshold) );
+
         /* ds_in_coll: disable data sieving in collective IO */
-	ADIOI_Info_get(users_info, "romio_lustre_ds_in_coll", MPI_MAX_INFO_VAL,
-	             value, &flag);
-	if (flag && (!strcmp(value, "disable") ||
-                     !strcmp(value, "DISABLE"))) {
-            tmp_val = int_val = 2;
-	    MPI_Bcast(&tmp_val, 2, MPI_INT, 0, fd->comm);
-	    if (tmp_val != int_val) {
-	        MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-		                                   "romio_lustre_ds_in_coll",
-						   error_code);
-                ADIOI_Free(value);
-                return;
-	    }
-	    ADIOI_Info_set(fd->info, "romio_lustre_ds_in_coll", "disable");
-            fd->hints->fs_hints.lustre.ds_in_coll = ADIOI_HINT_DISABLE;
-	}
+	ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_lustre_ds_in_coll",
+		&(fd->hints->fs_hints.lustre.ds_in_coll) );
+
     }
     /* set the values for collective I/O and data sieving parameters */
     ADIOI_GEN_SetInfo(fd, users_info, error_code);
diff --git a/src/mpi/romio/adio/ad_panfs/ad_panfs_hints.c b/src/mpi/romio/adio/ad_panfs/ad_panfs_hints.c
index 4931eb8..f6e6615 100644
--- a/src/mpi/romio/adio/ad_panfs/ad_panfs_hints.c
+++ b/src/mpi/romio/adio/ad_panfs/ad_panfs_hints.c
@@ -8,6 +8,7 @@
 
 #include "ad_panfs.h"
 #include <pan_fs_client_cw_mode.h>
+#include "hint_fns.h"
 
 void ADIOI_PANFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
 {
@@ -36,101 +37,33 @@ void ADIOI_PANFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
         /* has user specified striping parameters 
                and do they have the same value on all processes? */
         if (users_info != MPI_INFO_NULL) {
-	        value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));
 
-            ADIOI_Info_get(users_info, "panfs_concurrent_write", MPI_MAX_INFO_VAL, 
-                 value, &flag);
-            if (flag) {
-                concurrent_write = strtoul(value,NULL,10);
-                tmp_val = concurrent_write;
-                MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-                if (tmp_val != concurrent_write) {
-                    FPRINTF(stderr, "ADIOI_PANFS_SetInfo: the value for key \"panfs_concurrent_write\" must be the same on all processes\n");
-                    MPI_Abort(MPI_COMM_WORLD, 1);
-                }
-	            ADIOI_Info_set(fd->info, "panfs_concurrent_write", value); 
-            }
+	    ADIOI_Info_check_and_install_int(fd, users_info, "panfs_concurrent_write",
+		    NULL, myname, error_code);
 
-            ADIOI_Info_get(users_info, "panfs_layout_type", MPI_MAX_INFO_VAL, 
-                 value, &flag);
-            if (flag) {
-                layout_type = strtoul(value,NULL,10);
-                tmp_val = layout_type;
-                MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-                if (tmp_val != layout_type) {
-                    FPRINTF(stderr, "ADIOI_PANFS_SetInfo: the value for key \"panfs_layout_type\" must be the same on all processes\n");
-                    MPI_Abort(MPI_COMM_WORLD, 1);
-                }
-	            ADIOI_Info_set(fd->info, "panfs_layout_type", value); 
-            }
+	    ADIOI_Info_check_and_install_int(fd, users_info, "panfs_layout_type",
+		    NULL, myname, error_code);
 
-            ADIOI_Info_get(users_info, "panfs_layout_stripe_unit", MPI_MAX_INFO_VAL, 
-                 value, &flag);
-            if (flag) {
-                layout_stripe_unit = strtoul(value,NULL,10);
-                tmp_val = layout_stripe_unit;
-                MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-                if (tmp_val != layout_stripe_unit) {
-                    FPRINTF(stderr, "ADIOI_PANFS_SetInfo: the value for key \"panfs_layout_stripe_unit\" must be the same on all processes\n");
-                    MPI_Abort(MPI_COMM_WORLD, 1);
-                }
-	            ADIOI_Info_set(fd->info, "panfs_layout_stripe_unit", value); 
-            }
+	    ADIOI_Info_check_and_install_int(fd, users_info, "panfs_layout_stripe_unit",
+		    NULL, myname, error_code);
 
-            ADIOI_Info_get(users_info, "panfs_layout_parity_stripe_width", MPI_MAX_INFO_VAL, 
-                 value, &flag);
-            if (flag && (layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE)) {
-                layout_parity_stripe_width = strtoul(value,NULL,10);
-                tmp_val = layout_parity_stripe_width;
-                MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-                if (tmp_val != layout_parity_stripe_width) {
-                    FPRINTF(stderr, "ADIOI_PANFS_SetInfo: the value for key \"panfs_layout_parity_stripe_width\" must be the same on all processes\n");
-                    MPI_Abort(MPI_COMM_WORLD, 1);
-                }
-	            ADIOI_Info_set(fd->info, "panfs_layout_parity_stripe_width", value); 
-            }
+	    /* strange: there was a check "layout_type ==
+	     * PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE, but
+	     * nothing ever touched layout_type  */
+	    ADIOI_Info_check_and_install_int(fd, users_info,
+		    "panfs_layout_parity_stripe_width", NULL, myname, error_code);
 
-            ADIOI_Info_get(users_info, "panfs_layout_parity_stripe_depth", MPI_MAX_INFO_VAL, 
-                 value, &flag);
-            if (flag && (layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE)) {
-                layout_parity_stripe_depth = strtoul(value,NULL,10);
-                tmp_val = layout_parity_stripe_depth;
-                MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-                if (tmp_val != layout_parity_stripe_depth) {
-                    FPRINTF(stderr, "ADIOI_PANFS_SetInfo: the value for key \"panfs_layout_parity_stripe_depth\" must be the same on all processes\n");
-                    MPI_Abort(MPI_COMM_WORLD, 1);
-                }
-	            ADIOI_Info_set(fd->info, "panfs_layout_parity_stripe_depth", value); 
-            }
-
-            ADIOI_Info_get(users_info, "panfs_layout_total_num_comps", MPI_MAX_INFO_VAL, 
-                 value, &flag);
-            if (flag) {
-                layout_total_num_comps = strtoul(value,NULL,10);
-                tmp_val = layout_total_num_comps;
-                MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-                if (tmp_val != layout_total_num_comps) {
-                    FPRINTF(stderr, "ADIOI_PANFS_SetInfo: the value for key \"panfs_layout_total_num_comps\" must be the same on all processes\n");
-                    MPI_Abort(MPI_COMM_WORLD, 1);
-                }
-	            ADIOI_Info_set(fd->info, "panfs_layout_total_num_comps", value); 
-            }
-
-            ADIOI_Info_get(users_info, "panfs_layout_visit_policy", MPI_MAX_INFO_VAL, 
-                 value, &flag);
-            if (flag && (layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE || layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID10)) {
-                layout_visit_policy = strtoul(value,NULL,10);
-                tmp_val = layout_visit_policy;
-                MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-                if (tmp_val != layout_visit_policy) {
-                    FPRINTF(stderr, "ADIOI_PANFS_SetInfo: the value for key \"panfs_layout_visit_policy\" must be the same on all processes\n");
-                    MPI_Abort(MPI_COMM_WORLD, 1);
-                }
-	            ADIOI_Info_set(fd->info, "panfs_layout_visit_policy", value); 
-            }
-
-	        ADIOI_Free(value);
+	    ADIOI_Info_check_and_install_int(fd, users_info,
+		    "panfs_layout_parity_stripe_depth", NULL, myname, error_code);
 
+	    ADIOI_Info_check_and_install_int(fd, users_info,
+		    "panfs_layout_total_num_comps", NULL, myname, error_code);
+	    /* this hint used to check for
+	     * PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE or
+	     * PAN_FS_CLIENT_LAYOUT_TYPE__RAID10, but again, layout_type never
+	     * gets updated */
+	    ADIOI_Info_check_and_install_int(fd, users_info,
+		    "panfs_layout_visit_policy", NULL, myname, error_code);
         }
     }
 
diff --git a/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_hints.c b/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_hints.c
index 9d3aebb..217a223 100644
--- a/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_hints.c
+++ b/src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_hints.c
@@ -8,6 +8,8 @@
 #include <stdlib.h>
 #include "ad_pvfs2.h"
 
+#include "hint_fns.h"
+
 void ADIOI_PVFS2_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
 {
     char *value;
@@ -45,8 +47,8 @@ void ADIOI_PVFS2_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
 	
 	/* any user-provided hints? */
 	if (users_info != MPI_INFO_NULL) {
-	    /* pvfs2 debugging */
 	    value = (char *) ADIOI_Malloc( (MPI_MAX_INFO_VAL+1)*sizeof(char));
+	    /* pvfs2 debugging */
 	    ADIOI_Info_get(users_info, "romio_pvfs2_debugmask", 
 		    MPI_MAX_INFO_VAL, value, &flag);
 	    if (flag) {
@@ -67,41 +69,13 @@ void ADIOI_PVFS2_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
 	    }
 
 	    /* the striping factor */
-	    ADIOI_Info_get(users_info, "striping_factor", 
-		    MPI_MAX_INFO_VAL, value, &flag);
-	    if (flag) {
-		tmp_value = fd->hints->striping_factor =  atoi(value);
+	    ADIOI_Info_check_and_install_int(fd, users_info, "striping_factor",
+		    &(fd->hints->striping_factor), myname, error_code);
 
-		MPI_Bcast(&tmp_value, 1, MPI_INT, 0, fd->comm);
-		/* --BEGIN ERROR HANDLING-- */
-		if (tmp_value != fd->hints->striping_factor) {
-		    MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-						       "striping_factor",
-						       error_code);
-		    return;
-		}
-		/* --END ERROR HANDLING-- */
-		
-		ADIOI_Info_set(fd->info, "striping_factor", value);
-	    }
 
 	    /* the striping unit */
-	    ADIOI_Info_get(users_info, "striping_unit",
-		    MPI_MAX_INFO_VAL, value, &flag);
-	    if (flag) {
-		tmp_value = fd->hints->striping_unit = atoi(value);
-		MPI_Bcast(&tmp_value, 1, MPI_INT, 0, fd->comm);
-		/* --BEGIN ERROR HANDLING-- */
-		if (tmp_value != fd->hints->striping_unit) {
-		    MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname, 
-			                               "striping_unit",
-			                                error_code);
-		    return;
-		}
-		/* --END ERROR HANDLING-- */
-
-		ADIOI_Info_set(fd->info, "striping_unit", value);
-	    }
+	    ADIOI_Info_check_and_install_int(fd, users_info, "striping_unit",
+		    &(fd->hints->striping_unit), myname, error_code);
 
 	    /* distribution name */
 	    ADIOI_Info_get(users_info, "romio_pvfs2_distribution_name",
@@ -109,158 +83,30 @@ void ADIOI_PVFS2_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
 	    if (flag) {
 	    }
 
-
 	    /* POSIX read */
-            ADIOI_Info_get(users_info, "romio_pvfs2_posix_read",
-                         MPI_MAX_INFO_VAL, value, &flag);
-            if (flag) {
-                if ( !strcmp(value, "enable") || !strcmp(value, "ENABLE"))
-                {
-                    ADIOI_Info_set(fd->info, "romio_pvfs2_posix_read", value);
-                    fd->hints->fs_hints.pvfs2.posix_read = ADIOI_HINT_ENABLE;
-                }
-                else if ( !strcmp(value, "disable") ||
-                          !strcmp(value, "DISABLE"))
-                {
-                    ADIOI_Info_set(fd->info , "romio_pvfs2_posix_read", value);
-                    fd->hints->fs_hints.pvfs2.posix_read = ADIOI_HINT_DISABLE;
-                }
-                tmp_value = fd->hints->fs_hints.pvfs2.posix_read;
-                MPI_Bcast(&tmp_value, 1, MPI_INT, 0, fd->comm);
-                if (tmp_value != fd->hints->fs_hints.pvfs2.posix_read) {
-                    MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-                                                       "posix_read",
-                                                       error_code);
-                    return;
-                }
-            }
+	    ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_pvfs2_posix_read",
+		    &(fd->hints->pvfs2.posix_read), myname, error_code);
 
             /* POSIX write */
-            ADIOI_Info_get(users_info, "romio_pvfs2_posix_write",
-                         MPI_MAX_INFO_VAL, value, &flag);
-            if (flag) {
-                if ( !strcmp(value, "enable") || !strcmp(value, "ENABLE"))
-                {
-                    ADIOI_Info_set(fd->info, "romio_pvfs2_posix_write", value);
-                    fd->hints->fs_hints.pvfs2.posix_write = ADIOI_HINT_ENABLE;
-                }
-                else if ( !strcmp(value, "disable") ||
-                          !strcmp(value, "DISABLE"))
-                {
-                    ADIOI_Info_set(fd->info , "romio_pvfs2_posix_write", value);
-                    fd->hints->fs_hints.pvfs2.posix_write = ADIOI_HINT_DISABLE;
-                }
-                tmp_value = fd->hints->fs_hints.pvfs2.posix_write;
-                MPI_Bcast(&tmp_value, 1, MPI_INT, 0, fd->comm);
-                if (tmp_value != fd->hints->fs_hints.pvfs2.posix_write) {
-                    MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-                                                       "posix_write",
-                                                       error_code);
-                    return;
-                }
-            }
+	    ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_pvfs2_posix_write",
+		    &(fd->hints->pvfs2.posix_write), myname, error_code);
 
 	    /* Datatype read */
-            ADIOI_Info_get(users_info, "romio_pvfs2_dtype_read",
-                         MPI_MAX_INFO_VAL, value, &flag);
-            if (flag) {
-                if ( !strcmp(value, "enable") || !strcmp(value, "ENABLE"))
-                {
-                    ADIOI_Info_set(fd->info, "romio_pvfs2_dtype_read", value);
-                    fd->hints->fs_hints.pvfs2.dtype_read = ADIOI_HINT_ENABLE;
-                }
-                else if ( !strcmp(value, "disable") ||
-                          !strcmp(value, "DISABLE"))
-                {
-                    ADIOI_Info_set(fd->info , "romio_pvfs2_dtype_read", value);
-                    fd->hints->fs_hints.pvfs2.dtype_read = ADIOI_HINT_DISABLE;
-                }
-                tmp_value = fd->hints->fs_hints.pvfs2.dtype_read;
-                MPI_Bcast(&tmp_value, 1, MPI_INT, 0, fd->comm);
-                if (tmp_value != fd->hints->fs_hints.pvfs2.dtype_read) {
-                    MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-                                                       "dtype_read",
-                                                       error_code);
-                    return;
-                }
-            }
+	    ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_pvfs2_dtype_read",
+		    &(fd->hints->pvfs2.dtype_read), myname, error_code);
 
             /* Datatype write */
-            ADIOI_Info_get(users_info, "romio_pvfs2_dtype_write",
-                         MPI_MAX_INFO_VAL, value, &flag);
-            if (flag) {
-                if ( !strcmp(value, "enable") || !strcmp(value, "ENABLE"))
-                {
-                    ADIOI_Info_set(fd->info, "romio_pvfs2_dtype_write", value);
-                    fd->hints->fs_hints.pvfs2.dtype_write = ADIOI_HINT_ENABLE;
-                }
-                else if ( !strcmp(value, "disable") ||
-                          !strcmp(value, "DISABLE"))
-                {
-                    ADIOI_Info_set(fd->info , "romio_pvfs2_dtype_write", value);
-                    fd->hints->fs_hints.pvfs2.dtype_write = ADIOI_HINT_DISABLE;
-                }
-                tmp_value = fd->hints->fs_hints.pvfs2.dtype_write;
-                MPI_Bcast(&tmp_value, 1, MPI_INT, 0, fd->comm);
-                if (tmp_value != fd->hints->fs_hints.pvfs2.dtype_write) {
-                    MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-                                                       "dtype_write",
-                                                       error_code);
-                    return;
-                }
-            }
+	    ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_pvfs2_dtype_write",
+		    &(fd->hints->pvfs2.dtype_write), myname, error_code);
 
 	    /* Listio read */
-            ADIOI_Info_get(users_info, "romio_pvfs2_listio_read",
-                         MPI_MAX_INFO_VAL, value, &flag);
-            if (flag) {
-                if ( !strcmp(value, "enable") || !strcmp(value, "ENABLE"))
-                {
-                    ADIOI_Info_set(fd->info, "romio_pvfs2_listio_read", value);
-                    fd->hints->fs_hints.pvfs2.listio_read = ADIOI_HINT_ENABLE;
-                }
-                else if ( !strcmp(value, "disable") ||
-                          !strcmp(value, "DISABLE"))
-                {
-                    ADIOI_Info_set(fd->info , "romio_pvfs2_listio_read", value);
-                    fd->hints->fs_hints.pvfs2.listio_read = ADIOI_HINT_DISABLE;
-                }
-                tmp_value = fd->hints->fs_hints.pvfs2.listio_read;
-                MPI_Bcast(&tmp_value, 1, MPI_INT, 0, fd->comm);
-                if (tmp_value != fd->hints->fs_hints.pvfs2.listio_read) {
-                    MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-                                                       "listio_read",
-                                                       error_code);
-                    return;
-                }
-            }
+	    ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_pvfs2_listio_read",
+		    &(fd->hints->pvfs2.listio_read), myname, error_code);
 
             /* Datatype write */
-            ADIOI_Info_get(users_info, "romio_pvfs2_listio_write",
-                         MPI_MAX_INFO_VAL, value, &flag);
-            if (flag) {
-                if ( !strcmp(value, "enable") || !strcmp(value, "ENABLE"))
-                {
-                    ADIOI_Info_set(fd->info, "romio_pvfs2_listio_write", value);
-                    fd->hints->fs_hints.pvfs2.listio_write = ADIOI_HINT_ENABLE;
-                }
-                else if ( !strcmp(value, "disable") ||
-                          !strcmp(value, "DISABLE"))
-                {
-                    ADIOI_Info_set(fd->info , "romio_pvfs2_listio_write", value);
-                    fd->hints->fs_hints.pvfs2.listio_write = ADIOI_HINT_DISABLE;
-                }
-                tmp_value = fd->hints->fs_hints.pvfs2.listio_write;
-                MPI_Bcast(&tmp_value, 1, MPI_INT, 0, fd->comm);
-                if (tmp_value != fd->hints->fs_hints.pvfs2.listio_write) {
-                    MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-                                                       "listio_write",
-                                                       error_code);
-                    return;
-                }
-            }
+	    ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_pvfs2_listio_write",
+		    &(fd->hints->pvfs2.listio_write), myname, error_code);
             ADIOI_Free(value);
-
 	}
     }
     /* set the values for collective I/O and data sieving parameters */

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

commit edaa8396d770222318f771a26bda7057ba864fff
Author: Rob Latham <robl at mcs.anl.gov>
Date:   Mon Jun 24 19:05:31 2013 -0500

    unused variable warning

diff --git a/src/mpi/romio/mpi-io/mpiu_external32.c b/src/mpi/romio/mpi-io/mpiu_external32.c
index 75b4c27..ba22df2 100644
--- a/src/mpi/romio/mpi-io/mpiu_external32.c
+++ b/src/mpi/romio/mpi-io/mpiu_external32.c
@@ -120,7 +120,6 @@ fn_exit:
 int MPIU_datatype_full_size(MPI_Datatype datatype, MPI_Aint *size)
 {
     int error_code = MPI_SUCCESS;
-    MPI_Aint extent = 0;
     MPI_Aint true_extent = 0;
     MPI_Aint true_lb = 0;
 

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

commit b15761fc38ba3e97cabd349aafee48cee7926f9c
Author: Rob Latham <robl at mcs.anl.gov>
Date:   Mon Jun 24 23:50:21 2013 -0500

    improved error handling for test/file_info
    
    continue the slow and intermittent process of adding error checking to
    romio test cases

diff --git a/src/mpi/romio/test/file_info.c b/src/mpi/romio/test/file_info.c
index 7f2a779..fba6189 100644
--- a/src/mpi/romio/test/file_info.c
+++ b/src/mpi/romio/test/file_info.c
@@ -12,6 +12,14 @@
 #include <string.h>
 #include <stdlib.h>
 
+static void handle_error(int errcode, const char *str)
+{
+	char msg[MPI_MAX_ERROR_STRING];
+	int resultlen;
+	MPI_Error_string(errcode, msg, &resultlen);
+	fprintf(stderr, "%s: %s\n", str, msg);
+	MPI_Abort(MPI_COMM_WORLD, 1);
+}
 /* this test wants to compare the hints it gets from a file with a set of
  * default hints.  These hints are specific to the MPI-IO implementation, so if
  * you want to test something besides the default you'll have to use a command
@@ -43,7 +51,6 @@ hint_defaults BLUEGENE_DEFAULTS = {
     .romio_cb_write = "enable",
     .cb_config_list = NULL};
 
-
 /* #undef INFO_DEBUG */
 
 /* Test will print out information about unexpected hint keys or values that
@@ -62,6 +69,7 @@ int main(int argc, char **argv)
     MPI_Info info, info_used;
     char *filename, key[MPI_MAX_INFO_KEY], value[MPI_MAX_INFO_VAL];
     hint_defaults *defaults;
+    int ret;
 
     MPI_Init(&argc,&argv);
 
@@ -111,8 +119,9 @@ int main(int argc, char **argv)
 
 
 /* open the file with MPI_INFO_NULL */
-    MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, 
+    ret = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, 
                   MPI_INFO_NULL, &fh);
+    if (ret != MPI_SUCCESS) handle_error(ret, "MPI_File_open");
 
 /* check the default values set by ROMIO */
     MPI_File_get_info(fh, &info_used);
@@ -277,11 +286,13 @@ int main(int argc, char **argv)
     MPI_Info_set(info, "pfs_svr_buf", "true");
 
 /* open the file and set new info */
-    MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, 
+    ret = MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, 
                   info, &fh);
+    if (ret != MPI_SUCCESS) handle_error(ret, "MPI_File_open");
 
 /* check the values set */
-    MPI_File_get_info(fh, &info_used);
+    ret = MPI_File_get_info(fh, &info_used);
+    if (ret != MPI_SUCCESS) handle_error(ret, "MPI_File_get_info");
     MPI_Info_get_nkeys(info_used, &nkeys);
 
     for (i=0; i<nkeys; i++) {

http://git.mpich.org/mpich.git/commitdiff/3fb810c0662fe0a94fbddb94f5bd809f8f982f4f

commit 3fb810c0662fe0a94fbddb94f5bd809f8f982f4f
Author: Rob Latham <robl at mcs.anl.gov>
Date:   Tue Jun 25 00:13:06 2013 -0500

    clean up tests with enable-strict
    
    ROMIO tests were not cleanly buildig with --enable-strict, mostly due to
    missing 'const' for strings.   One test uses strdup, which is
    incompatible with strict ansi.

diff --git a/src/mpi/romio/test/aggregation1.c b/src/mpi/romio/test/aggregation1.c
index f12e305..5331639 100644
--- a/src/mpi/romio/test/aggregation1.c
+++ b/src/mpi/romio/test/aggregation1.c
@@ -7,6 +7,7 @@
 /* Test case from John Bent (ROMIO req #835)
  * Aggregation code was not handling certain access patterns when collective
  * buffering forced */
+#define _XOPEN_SOURCE 500 /* strdup not in string.h otherwsie */
 #include <unistd.h>
 #include <stdlib.h>
 #include <mpi.h>
@@ -38,7 +39,7 @@ Usage( int line ) {
 }
 
 static void
-fatal_error( int mpi_ret, MPI_Status *mpi_stat, char *msg ) {
+fatal_error( int mpi_ret, MPI_Status *mpi_stat, const char *msg ) {
     fprintf( stderr, "Fatal error %s: %d\n", msg, mpi_ret );
     MPI_Abort( MPI_COMM_WORLD, -1 );
 }
diff --git a/src/mpi/romio/test/aggregation2.c b/src/mpi/romio/test/aggregation2.c
index 02d2629..a35ebe0 100644
--- a/src/mpi/romio/test/aggregation2.c
+++ b/src/mpi/romio/test/aggregation2.c
@@ -20,7 +20,7 @@
 
 #define BUFSIZE 512
 
-static void handle_error(int errcode, char *str)
+static void handle_error(int errcode, const char *str)
 {
         char msg[MPI_MAX_ERROR_STRING];
         int resultlen;
diff --git a/src/mpi/romio/test/async-multiple.c b/src/mpi/romio/test/async-multiple.c
index 57e8104..ec9726c 100644
--- a/src/mpi/romio/test/async-multiple.c
+++ b/src/mpi/romio/test/async-multiple.c
@@ -16,9 +16,9 @@
    reads them back. The file name is taken as a command-line argument,
    and the process rank is appended to it.*/ 
 
-void handle_error(int errcode, char *str);
+void handle_error(int errcode, const char *str);
 
-void handle_error(int errcode, char *str) 
+void handle_error(int errcode, const char *str) 
 {
 	char msg[MPI_MAX_ERROR_STRING];
 	int resultlen;
diff --git a/src/mpi/romio/test/async.c b/src/mpi/romio/test/async.c
index 6bfd04f..8882716 100644
--- a/src/mpi/romio/test/async.c
+++ b/src/mpi/romio/test/async.c
@@ -14,9 +14,9 @@
    reads them back. The file name is taken as a command-line argument,
    and the process rank is appended to it.*/ 
 
-void handle_error(int errcode, char *str);
+void handle_error(int errcode, const char *str);
 
-void handle_error(int errcode, char *str) 
+void handle_error(int errcode, const char *str) 
 {
 	char msg[MPI_MAX_ERROR_STRING];
 	int resultlen;
diff --git a/src/mpi/romio/test/coll_test.c b/src/mpi/romio/test/coll_test.c
index d37b757..cbea6cf 100644
--- a/src/mpi/romio/test/coll_test.c
+++ b/src/mpi/romio/test/coll_test.c
@@ -18,9 +18,9 @@
 
 /* Note that the file access pattern is noncontiguous. */
    
-void handle_error(int errcode, char *str);
+void handle_error(int errcode, const char *str);
 
-void handle_error(int errcode, char *str)
+void handle_error(int errcode, const char *str)
 {
 	char msg[MPI_MAX_ERROR_STRING];
 	int resultlen;
diff --git a/src/mpi/romio/test/external32.c b/src/mpi/romio/test/external32.c
index 9b0d116..bca3555 100644
--- a/src/mpi/romio/test/external32.c
+++ b/src/mpi/romio/test/external32.c
@@ -27,7 +27,7 @@ static void handle_error(int errcode, char *str)
 
 
 
-void is_little_or_big_endian( char* datarep, char* c, char* c_le, int len ) {
+static void is_little_or_big_endian( const char* datarep, char* c, char* c_le, int len ) {
     int i, is_le = 1, is_be = 1;
     for( i = 0; i < len; i++ ) {
         is_le = is_le && ( c[i] == c_le[i] );
@@ -46,7 +46,7 @@ void is_little_or_big_endian( char* datarep, char* c, char* c_le, int len ) {
 int main( int argc, char* argv[] ) {
     int sample_i = 123456789, i, j;
     char sample_i_le[4] = {0x15,0xcd,0x5b,0x07}, c[4];
-    char* datarep[3] = { "native", "external32", "internal" };
+    const char* datarep[3] = { "native", "external32", "internal" };
     MPI_File fileh;
     int rank;
     FILE* fileh_std;
diff --git a/src/mpi/romio/test/noncontig_coll2.c b/src/mpi/romio/test/noncontig_coll2.c
index 10ad4ab..4699da8 100644
--- a/src/mpi/romio/test/noncontig_coll2.c
+++ b/src/mpi/romio/test/noncontig_coll2.c
@@ -23,7 +23,7 @@
 #define STARTING_SIZE 5000
 
 int test_file(char *filename, int mynod, int nprocs, char * cb_hosts, 
-		char *msg, int verbose); 
+		const char *msg, int verbose); 
 
 #define ADIOI_Free free
 #define ADIOI_Malloc malloc
@@ -37,7 +37,7 @@ struct ADIO_cb_name_arrayD {
 };  
 typedef struct ADIO_cb_name_arrayD *ADIO_cb_name_array;
 
-void handle_error(int errcode, char *str);
+void handle_error(int errcode, const char *str);
 int cb_gather_name_array(MPI_Comm comm, ADIO_cb_name_array *arrayp);
 void default_str(int mynod, int len, ADIO_cb_name_array array, char *dest);
 void reverse_str(int mynod, int len, ADIO_cb_name_array array, char *dest);
@@ -45,7 +45,7 @@ void reverse_alternating_str(int mynod, int len, ADIO_cb_name_array array, char
 void simple_shuffle_str(int mynod, int len, ADIO_cb_name_array array, char *dest);
 
 
-void handle_error(int errcode, char *str) 
+void handle_error(int errcode, const char *str) 
 {
 	char msg[MPI_MAX_ERROR_STRING];
 	int resultlen;
@@ -348,7 +348,7 @@ int main(int argc, char **argv)
 
 #define SEEDER(x,y,z) ((x)*1000000 + (y) + (x)*(z))
 
-int test_file(char *filename, int mynod, int nprocs, char * cb_hosts, char *msg, int verbose) 
+int test_file(char *filename, int mynod, int nprocs, char * cb_hosts, const char *msg, int verbose) 
 {
     MPI_Datatype typevec, newtype, t[3];
     int *buf, i, b[3], errcode, errors=0;
diff --git a/src/mpi/romio/test/ordered_fp.c b/src/mpi/romio/test/ordered_fp.c
index b2e0e92..8090e1f 100644
--- a/src/mpi/romio/test/ordered_fp.c
+++ b/src/mpi/romio/test/ordered_fp.c
@@ -11,9 +11,9 @@
 #define COUNT (200)
 #undef TIMING
 
-void handle_error(int errcode, char *str);
+void handle_error(int errcode, const char *str);
 
-void handle_error(int errcode, char *str) 
+void handle_error(int errcode, const char *str) 
 {
 	char msg[MPI_MAX_ERROR_STRING];
 	int resultlen;
diff --git a/src/mpi/romio/test/shared_fp.c b/src/mpi/romio/test/shared_fp.c
index 12dd7db..df41bdd 100644
--- a/src/mpi/romio/test/shared_fp.c
+++ b/src/mpi/romio/test/shared_fp.c
@@ -10,9 +10,9 @@
 
 #define COUNT 1024
 
-void handle_error(int errcode, char *str);
+void handle_error(int errcode, const char *str);
 
-void handle_error(int errcode, char *str) 
+void handle_error(int errcode, const char *str) 
 {
 	char msg[MPI_MAX_ERROR_STRING];
 	int resultlen;
diff --git a/src/mpi/romio/test/simple.c b/src/mpi/romio/test/simple.c
index 0480552..2e90c9d 100644
--- a/src/mpi/romio/test/simple.c
+++ b/src/mpi/romio/test/simple.c
@@ -10,7 +10,7 @@
 
 #define SIZE (65536)
 
-static void handle_error(int errcode, char *str)
+static void handle_error(int errcode, const char *str)
 {
 	char msg[MPI_MAX_ERROR_STRING];
 	int resultlen;

http://git.mpich.org/mpich.git/commitdiff/270d5115c0cbd7a796da021936e69d8c25e5ed45

commit 270d5115c0cbd7a796da021936e69d8c25e5ed45
Author: Rob Latham <robl at mcs.anl.gov>
Date:   Mon Jun 24 08:45:38 2013 -0500

    reduce duplcated code in hint processing
    
    for years we've added hints by cutting and pasting.  Turn all this
    dupilcated code into common hint processing funcitons.   Still need to
    do this for all drivers, too

diff --git a/src/mpi/romio/adio/common/Makefile.mk b/src/mpi/romio/adio/common/Makefile.mk
index 1bed978..0acb27d 100644
--- a/src/mpi/romio/adio/common/Makefile.mk
+++ b/src/mpi/romio/adio/common/Makefile.mk
@@ -65,5 +65,6 @@ romio_other_sources +=                  \
     adio/common/shfp_fname.c            \
     adio/common/status_setb.c           \
     adio/common/strfns.c                \
-    adio/common/system_hints.c
+    adio/common/system_hints.c          \
+    adio/common/hint_fns.c
 
diff --git a/src/mpi/romio/adio/common/ad_hints.c b/src/mpi/romio/adio/common/ad_hints.c
index a7a6f6d..1bc74f1 100644
--- a/src/mpi/romio/adio/common/ad_hints.c
+++ b/src/mpi/romio/adio/common/ad_hints.c
@@ -7,6 +7,7 @@
 
 #include "adio.h"
 #include "adio_extern.h"
+#include "hint_fns.h"
 
 void ADIOI_GEN_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
 {
@@ -18,7 +19,7 @@ void ADIOI_GEN_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
 
     MPI_Info info;
     char *value;
-    int flag, intval, tmp_val, nprocs=0, nprocs_is_valid = 0, len;
+    int flag, nprocs=0, len;
     int ok_to_override_cb_nodes=0;
     static char myname[] = "ADIOI_GEN_SETINFO";
 
@@ -34,6 +35,8 @@ void ADIOI_GEN_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
     if (fd->info == MPI_INFO_NULL) MPI_Info_create(&(fd->info));
     info = fd->info;
 
+    MPI_Comm_size(fd->comm, &nprocs);
+
     /* Note that fd->hints is allocated at file open time; thus it is
      * not necessary to allocate it, or check for allocation, here.
      */
@@ -69,8 +72,6 @@ void ADIOI_GEN_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
 	fd->hints->cb_config_list = NULL;
 
 	/* number of processes that perform I/O in collective I/O */
-	MPI_Comm_size(fd->comm, &nprocs);
-	nprocs_is_valid = 1;
 	ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", nprocs);
 	ADIOI_Info_set(info, "cb_nodes", value);
 	fd->hints->cb_nodes = nprocs;
@@ -136,391 +137,120 @@ void ADIOI_GEN_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
 
     /* add in user's info if supplied */
     if (users_info != MPI_INFO_NULL) {
-	ADIOI_Info_get(users_info, "cb_buffer_size", MPI_MAX_INFO_VAL, 
-		     value, &flag);
-	if (flag && ((intval=atoi(value)) > 0)) {
-	    tmp_val = intval;
-
-	    MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-	    /* --BEGIN ERROR HANDLING-- */
-	    if (tmp_val != intval) {
-		MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-						   "cb_buffer_size",
-						   error_code);
-		return;
-	    }
-	    /* --END ERROR HANDLING-- */
+	ADIOI_Info_check_and_install_int(fd, users_info, "cb_buffer_size", 
+		&(fd->hints->cb_buffer_size), myname, error_code);
 
-	    ADIOI_Info_set(info, "cb_buffer_size", value);
-	    fd->hints->cb_buffer_size = intval;
-
-	}
 	/* aligning file realms to certain sizes (e.g. stripe sizes)
 	 * may benefit I/O performance */
-	ADIOI_Info_get(users_info, "romio_cb_fr_alignment", MPI_MAX_INFO_VAL, 
-		     value, &flag);
-	if (flag && ((intval=atoi(value)) > 0)) {
-	    tmp_val = intval;
-
-	    MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-	    /* --BEGIN ERROR HANDLING-- */
-	    if (tmp_val != intval) {
-		MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-						   "romio_cb_fr_alignment",
-						   error_code);
-		return;
-	    }
-	    /* --END ERROR HANDLING-- */
-
-	    ADIOI_Info_set(info, "romio_cb_fr_alignment", value);
-	    fd->hints->cb_fr_alignment = intval;
-
-	}
+	ADIOI_Info_check_and_install_int(fd, users_info, "romio_cb_fr_alignment", 
+		&(fd->hints->cb_fr_alignment), myname, error_code);
 
 	/* for collective I/O, try to be smarter about when to do data sieving
 	 * using a specific threshold for the datatype size/extent
 	 * (percentage 0-100%) */
-	ADIOI_Info_get(users_info, "romio_cb_ds_threshold", MPI_MAX_INFO_VAL, 
-		     value, &flag);
-	if (flag && ((intval=atoi(value)) > 0)) {
-	    tmp_val = intval;
-
-	    MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-	    /* --BEGIN ERROR HANDLING-- */
-	    if (tmp_val != intval) {
-		MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-						   "romio_cb_ds_threshold",
-						   error_code);
-		return;
-	    }
-	    /* --END ERROR HANDLING-- */
-
-	    ADIOI_Info_set(info, "romio_cb_ds_threshold", value);
-	    fd->hints->cb_ds_threshold = intval;
-
-	}
-	ADIOI_Info_get(users_info, "romio_cb_alltoall", MPI_MAX_INFO_VAL, value,
-		     &flag);
-	if (flag) {
-	    if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) {
-		ADIOI_Info_set(info, "romio_cb_alltoall", value);
-		fd->hints->cb_read = ADIOI_HINT_ENABLE;
-	    }
-	    else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) {
-		ADIOI_Info_set(info, "romio_cb_alltoall", value);
-		fd->hints->cb_read = ADIOI_HINT_DISABLE;
-	    }
-	    else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC"))
-	    {
-		ADIOI_Info_set(info, "romio_cb_alltoall", value);
-		fd->hints->cb_read = ADIOI_HINT_AUTO;
-	    }
+	ADIOI_Info_check_and_install_int(fd, users_info, "romio_cb_ds_threshold", 
+		&(fd->hints->cb_ds_threshold), myname, error_code);
 
-	    tmp_val = fd->hints->cb_alltoall;
-
-	    MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-	    /* --BEGIN ERROR HANDLING-- */
-	    if (tmp_val != fd->hints->cb_alltoall) {
-		MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-						   "romio_cb_alltoall",
-						   error_code);
-		return;
-	    }
-	    /* --END ERROR HANDLING-- */
-	}
+	ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_cb_alltoall",
+		&(fd->hints->cb_alltoall), myname, error_code);
 
 	/* new hints for enabling/disabling coll. buffering on
 	 * reads/writes
 	 */
-	ADIOI_Info_get(users_info, "romio_cb_read", MPI_MAX_INFO_VAL, value,
-		     &flag);
-	if (flag) {
-	    if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) {
-		ADIOI_Info_set(info, "romio_cb_read", value);
-		fd->hints->cb_read = ADIOI_HINT_ENABLE;
-	    }
-	    else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) {
-		    /* romio_cb_read overrides no_indep_rw */
-		ADIOI_Info_set(info, "romio_cb_read", value);
-		ADIOI_Info_set(info, "romio_no_indep_rw", "false");
-		fd->hints->cb_read = ADIOI_HINT_DISABLE;
-		fd->hints->no_indep_rw = ADIOI_HINT_DISABLE;
-	    }
-	    else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC"))
-	    {
-		ADIOI_Info_set(info, "romio_cb_read", value);
-		fd->hints->cb_read = ADIOI_HINT_AUTO;
-	    }
-
-	    tmp_val = fd->hints->cb_read;
-
-	    MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-	    /* --BEGIN ERROR HANDLING-- */
-	    if (tmp_val != fd->hints->cb_read) {
-		MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-						   "romio_cb_read",
-						   error_code);
-		return;
-	    }
-	    /* --END ERROR HANDLING-- */
+	ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_cb_read",
+		&(fd->hints->cb_read), myname, error_code);
+	if (fd->hints->cb_read == ADIOI_HINT_DISABLE) {
+	    /* romio_cb_read overrides no_indep_rw */
+	    ADIOI_Info_set(info, "romio_no_indep_rw", "false");
+	    fd->hints->no_indep_rw = ADIOI_HINT_DISABLE;
 	}
-	ADIOI_Info_get(users_info, "romio_cb_write", MPI_MAX_INFO_VAL, value,
-		     &flag);
-	if (flag) {
-	    if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) {
-		ADIOI_Info_set(info, "romio_cb_write", value);
-		fd->hints->cb_write = ADIOI_HINT_ENABLE;
-	    }
-	    else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE"))
-	    {
-		/* romio_cb_write overrides no_indep_rw, too */
-		ADIOI_Info_set(info, "romio_cb_write", value);
-		ADIOI_Info_set(info, "romio_no_indep_rw", "false");
-		fd->hints->cb_write = ADIOI_HINT_DISABLE;
-		fd->hints->no_indep_rw = ADIOI_HINT_DISABLE;
-	    }
-	    else if (!strcmp(value, "automatic") ||
-		     !strcmp(value, "AUTOMATIC"))
-	    {
-		ADIOI_Info_set(info, "romio_cb_write", value);
-		fd->hints->cb_write = ADIOI_HINT_AUTO;
-	    }
-	
-	    tmp_val = fd->hints->cb_write;
-
-	    MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-	    /* --BEGIN ERROR HANDLING-- */
-	    if (tmp_val != fd->hints->cb_write) {
-		MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-						   "romio_cb_write",
-						   error_code);
-		return;
-	    }
-	    /* --END ERROR HANDLING-- */
+
+	ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_cb_write",
+		&(fd->hints->cb_write), myname, error_code);
+	if (fd->hints->cb_write == ADIOI_HINT_DISABLE) {
+	    /* romio_cb_write overrides no_indep_rw */
+	    ADIOI_Info_set(info, "romio_no_indep_rw", "false");
+	    fd->hints->no_indep_rw = ADIOI_HINT_DISABLE;
 	}
 
 	/* enable/disable persistent file realms for collective I/O */
 	/* may want to check for no_indep_rdwr hint as well */
-	ADIOI_Info_get(users_info, "romio_cb_pfr", MPI_MAX_INFO_VAL, value,
-		     &flag);
-	if (flag) {
-	    if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) {
-		ADIOI_Info_set(info, "romio_cb_pfr", value);
-		fd->hints->cb_pfr = ADIOI_HINT_ENABLE;
-	    }
-	    else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) {
-		ADIOI_Info_set(info, "romio_cb_pfr", value);
-		fd->hints->cb_pfr = ADIOI_HINT_DISABLE;
-	    }
-	    else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC"))
-	    {
-		ADIOI_Info_set(info, "romio_cb_pfr", value);
-		fd->hints->cb_pfr = ADIOI_HINT_AUTO;
-	    }
-
-	    tmp_val = fd->hints->cb_pfr;
-
-	    MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-	    /* --BEGIN ERROR HANDLING-- */
-	    if (tmp_val != fd->hints->cb_pfr) {
-		MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-						   "romio_cb_pfr",
-						   error_code);
-		return;
-	    }
-	    /* --END ERROR HANDLING-- */
-	}
+	ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_cb_pfr",
+		&(fd->hints->cb_pfr), myname, error_code);
 
+	
 	/* file realm assignment types ADIOI_FR_AAR(0),
 	 ADIOI_FR_FSZ(-1), ADIOI_FR_USR_REALMS(-2), all others specify
 	 a regular fr size in bytes. probably not the best way... */
-	ADIOI_Info_get(users_info, "romio_cb_fr_type", MPI_MAX_INFO_VAL, 
-		     value, &flag);
-	if (flag && ((intval=atoi(value)) >= -2)) {
-	    tmp_val = intval;
-
-	    MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-	    /* --BEGIN ERROR HANDLING-- */
-	    if (tmp_val != intval) {
-		MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-						   "romio_cb_fr_type",
-						   error_code);
-		return;
-	    }
-	    /* --END ERROR HANDLING-- */
-
-	    ADIOI_Info_set(info, "romio_cb_fr_type", value);
-	    fd->hints->cb_fr_type = intval;
-
-	}
-
-	/* new hint for specifying no indep. read/write will be performed */
-	ADIOI_Info_get(users_info, "romio_no_indep_rw", MPI_MAX_INFO_VAL, value,
-		     &flag);
-	if (flag) {
-	    if (!strcmp(value, "true") || !strcmp(value, "TRUE")) {
-		    /* if 'no_indep_rw' set, also hint that we will do
-		     * collective buffering: if we aren't doing independent io,
-		     * then we have to do collective  */
-		ADIOI_Info_set(info, "romio_no_indep_rw", value);
-		ADIOI_Info_set(info, "romio_cb_write", "enable");
-		ADIOI_Info_set(info, "romio_cb_read", "enable");
-		fd->hints->no_indep_rw = 1;
-		fd->hints->cb_read = 1;
-		fd->hints->cb_write = 1;
-		tmp_val = 1;
-	    }
-	    else if (!strcmp(value, "false") || !strcmp(value, "FALSE")) {
-		ADIOI_Info_set(info, "romio_no_indep_rw", value);
-		fd->hints->no_indep_rw = 0;
-		tmp_val = 0;
-	    }
-	    else {
-		/* default is above */
-		tmp_val = 0;
-	    }
-
-	    MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-	    /* --BEGIN ERROR HANDLING-- */
-	    if (tmp_val != fd->hints->no_indep_rw) {
-		MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-						   "romio_no_indep_rw",
-						   error_code);
-		return;
-	    }
-	    /* --END ERROR HANDLING-- */
-	}
+	ADIOI_Info_check_and_install_int(fd, users_info, "romio_cb_fr_type",
+		&(fd->hints->cb_fr_type), myname, error_code);
+
+	/* Has the user indicated all I/O will be done collectively? */
+	ADIOI_Info_check_and_install_true(fd, users_info, "romio_no_indep_rw",
+		&(fd->hints->no_indep_rw), myname, error_code);
+	if (fd->hints->no_indep_rw == 1) {
+	    /* if 'no_indep_rw' set, also hint that we will do
+	     * collective buffering: if we aren't doing independent io,
+	     * then we have to do collective  */
+	    ADIOI_Info_set(info, "romio_cb_write", "enable");
+	    ADIOI_Info_set(info, "romio_cb_read", "enable");
+	    fd->hints->cb_read = 1;
+	    fd->hints->cb_write = 1;
+	} 
 	/* new hints for enabling/disabling data sieving on
 	 * reads/writes
 	 */
-	ADIOI_Info_get(users_info, "romio_ds_read", MPI_MAX_INFO_VAL, value, 
-		     &flag);
-	if (flag) {
-	    if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) {
-		ADIOI_Info_set(info, "romio_ds_read", value);
-		fd->hints->ds_read = ADIOI_HINT_ENABLE;
-	    }
-	    else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) {
-		ADIOI_Info_set(info, "romio_ds_read", value);
-		fd->hints->ds_read = ADIOI_HINT_DISABLE;
-	    }
-	    else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC"))
-	    {
-		ADIOI_Info_set(info, "romio_ds_read", value);
-		fd->hints->ds_read = ADIOI_HINT_AUTO;
-	    }
-	    /* otherwise ignore */
-	}
-	ADIOI_Info_get(users_info, "romio_ds_write", MPI_MAX_INFO_VAL, value, 
-		     &flag);
-	if (flag) {
-	    if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) {
-		ADIOI_Info_set(info, "romio_ds_write", value);
-		fd->hints->ds_write = ADIOI_HINT_ENABLE;
-	    }
-	    else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) {
-		ADIOI_Info_set(info, "romio_ds_write", value);
-		fd->hints->ds_write = ADIOI_HINT_DISABLE;
-	    }
-	    else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC"))
-	    {
-		ADIOI_Info_set(info, "romio_ds_write", value);
-		fd->hints->ds_write = ADIOI_HINT_AUTO;
-	    }
-	    /* otherwise ignore */
-	}
+	ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_ds_read",
+		&(fd->hints->ds_read), myname, error_code);
+	ADIOI_Info_check_and_install_enabled(fd, users_info, "romio_ds_write",
+		&(fd->hints->ds_write), myname, error_code);
 
 	if (ok_to_override_cb_nodes) {
 		/* MPI_File_open path sets up some data structrues that don't
 		 * get resized in the MPI_File_set_view path, so ignore
 		 * cb_nodes in the set_view case */
-	    ADIOI_Info_get(users_info, "cb_nodes", MPI_MAX_INFO_VAL, 
-	  	     value, &flag);
-	    if (flag && ((intval=atoi(value)) > 0)) {
-	        tmp_val = intval;
-
-	        MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
-	       /* --BEGIN ERROR HANDLING-- */
-	       if (tmp_val != intval) {
-		    MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(myname,
-						       "cb_nodes",
-						       error_code);
-		    return;
-	       }
-	       /* --END ERROR HANDLING-- */
-
-	       if (!nprocs_is_valid) {
-		   /* if hints were already initialized, we might not
-		    * have already gotten this?
-		    */
-		   MPI_Comm_size(fd->comm, &nprocs);
-		   nprocs_is_valid = 1;
-	       }
-	       if (intval <= nprocs) {
-		   ADIOI_Info_set(info, "cb_nodes", value);
-		   fd->hints->cb_nodes = intval;
-	       }
-	   }
+	    ADIOI_Info_check_and_install_int(fd, users_info, "cb_nodes",
+		    &(fd->hints->cb_nodes), myname, error_code);
+	    if ((fd->hints->cb_nodes <= 0) || (fd->hints->cb_nodes > nprocs)) {
+		/* can't ask for more aggregators than mpi processes, though it
+		 * might be interesting to think what such oversubscription
+		 * might mean... someday */
+		ADIOI_Snprintf(value, MPI_MAX_INFO_VAL+1, "%d", nprocs);
+		ADIOI_Info_set(info, "cb_nodes", value);
+		fd->hints->cb_nodes = nprocs;
+	    }
 	} /* if (ok_to_override_cb_nodes) */
 
-	ADIOI_Info_get(users_info, "ind_wr_buffer_size", MPI_MAX_INFO_VAL, 
-		     value, &flag);
-	if (flag && ((intval = atoi(value)) > 0)) {
-	    ADIOI_Info_set(info, "ind_wr_buffer_size", value);
-	    fd->hints->ind_wr_buffer_size = intval;
-	}
+	ADIOI_Info_check_and_install_int(fd, users_info, "ind_wr_buffer_size",
+		&(fd->hints->ind_wr_buffer_size), myname, error_code);
+	ADIOI_Info_check_and_install_int(fd, users_info, "ind_rd_buffer_size",
+		&(fd->hints->ind_rd_buffer_size), myname, error_code);
 
-	ADIOI_Info_get(users_info, "ind_rd_buffer_size", MPI_MAX_INFO_VAL, 
-		     value, &flag);
-	if (flag && ((intval = atoi(value)) > 0)) {
-	    ADIOI_Info_set(info, "ind_rd_buffer_size", value);
-	    fd->hints->ind_rd_buffer_size = intval;
-	}
+	if (fd->hints->cb_config_list == NULL) {
+	    /* only set cb_config_list if it isn't already set.  Note that
+	     * since we set it below, this ensures that the cb_config_list hint
+	     * will be set at file open time either by the user or to the
+	     * default */
+	    /* if it has been set already, we ignore it the second time.
+	     * otherwise we would get an error if someone used the same info
+	     * value with a cb_config_list value in it in a couple of calls,
+	     * which would be irritating. */
+	    ADIOI_Info_check_and_install_str(fd, users_info, "cb_config_list",
+		&(fd->hints->cb_config_list), myname, error_code);
 
-	ADIOI_Info_get(users_info, "cb_config_list", MPI_MAX_INFO_VAL,
-		     value, &flag);
-	if (flag) {
-	    if (fd->hints->cb_config_list == NULL) {
-		/* only set cb_config_list if it isn't already set.
-		 * Note that since we set it below, this ensures that
-		 * the cb_config_list hint will be set at file open time
-		 * either by the user or to the default
-		 */
-	    	ADIOI_Info_set(info, "cb_config_list", value);
-		len = (strlen(value)+1) * sizeof(char);
-		fd->hints->cb_config_list = ADIOI_Malloc(len);
-		if (fd->hints->cb_config_list == NULL) {
-                    *error_code = MPIO_Err_create_code(*error_code,
-                                                       MPIR_ERR_RECOVERABLE,
-                                                       myname,
-                                                       __LINE__,
-                                                       MPI_ERR_OTHER,
-                                                       "**nomem2",0);
-                    return;
-		}
-		ADIOI_Strncpy(fd->hints->cb_config_list, value, len);
-	    }
-	    /* if it has been set already, we ignore it the second time. 
-	     * otherwise we would get an error if someone used the same
-	     * info value with a cb_config_list value in it in a couple
-	     * of calls, which would be irritating. */
-	}
-	ADIOI_Info_get(users_info, "romio_min_fdomain_size", MPI_MAX_INFO_VAL,
-			value, &flag);
-	if ( flag && ((intval = atoi(value)) > 0) ) {
-		ADIOI_Info_set(info, "romio_min_fdomain_size", value);
-		fd->hints->min_fdomain_size = intval;
-	}
-  /* Now we use striping unit in common code so we should
-     process hints for it. */
-	ADIOI_Info_get(users_info, "striping_unit", MPI_MAX_INFO_VAL,
-			value, &flag);
-	if ( flag && ((intval = atoi(value)) > 0) ) {
-		ADIOI_Info_set(info, "striping_unit", value);
-		fd->hints->striping_unit = intval;
 	}
+	ADIOI_Info_check_and_install_int(fd, users_info, "romio_min_fdomain_size",
+		&(fd->hints->min_fdomain_size), myname, error_code);
+
+	/* Now we use striping unit in common code so we should
+	   process hints for it. */
+	ADIOI_Info_check_and_install_int(fd, users_info, "striping_unit", 
+		&(fd->hints->striping_unit), myname, error_code);
     }
 
+    /* Begin hint post-processig: some hints take precidence over or conflict
+     * with others, or aren't supported by some file systems */
+
     /* handle cb_config_list default value here; avoids an extra
      * free/alloc and insures it is always set
      */
diff --git a/src/mpi/romio/adio/common/hint_fns.c b/src/mpi/romio/adio/common/hint_fns.c
new file mode 100644
index 0000000..560b614
--- /dev/null
+++ b/src/mpi/romio/adio/common/hint_fns.c
@@ -0,0 +1,183 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/* 
+ *
+ *   Copyright (C) 2013 UChicago/Argonne, LLC
+ *   See COPYRIGHT notice in top-level directory.
+ */
+
+#include "adio.h"
+#include "hint_fns.h"
+
+
+int ADIOI_Info_check_and_install_int(ADIO_File fd, MPI_Info info, const char *key, 
+	int *local_cache, char *funcname, int *error_code)
+{
+    int intval, tmp_val, flag; 
+    char *value;
+
+    value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));
+    if (value == NULL) {
+        *error_code = MPIO_Err_create_code(*error_code,
+                                           MPIR_ERR_RECOVERABLE,
+                                           funcname,
+                                           __LINE__,
+                                           MPI_ERR_OTHER,
+                                           "**nomem2",0);
+        return -1;
+    }
+
+    ADIOI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag);
+    if (flag) {
+	intval = atoi(value);
+	tmp_val = intval;
+
+	MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
+	/* --BEGIN ERROR HANDLING-- */
+	if (tmp_val != intval) {
+	    MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(funcname,
+		    key, 
+		    error_code);
+	    return -1;
+	}
+	/* --END ERROR HANDLING-- */
+
+	ADIOI_Info_set(fd->info, key, value);
+	/* some file systems do not cache hints in the fd struct */
+	if (local_cache != NULL) *local_cache = intval;
+    }
+    ADIOI_Free(value);
+    return 0;
+}
+
+int ADIOI_Info_check_and_install_enabled(ADIO_File fd, MPI_Info info, const char *key, 
+	int *local_cache, char *funcname, int *error_code)
+{
+    int tmp_val, flag;
+    char *value;
+
+    value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));
+    if (value == NULL) {
+        *error_code = MPIO_Err_create_code(*error_code,
+                                           MPIR_ERR_RECOVERABLE,
+                                           funcname,
+                                           __LINE__,
+                                           MPI_ERR_OTHER,
+                                           "**nomem2",0);
+        return -1;
+    }
+
+    ADIOI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag);
+    if (flag) {
+	if (!strcmp(value, "enable") || !strcmp(value, "ENABLE")) {
+	    ADIOI_Info_set(fd->info, key, value);
+	    *local_cache = ADIOI_HINT_ENABLE;
+	}
+	else if (!strcmp(value, "disable") || !strcmp(value, "DISABLE")) {
+	    ADIOI_Info_set(fd->info, key, value);
+	    *local_cache = ADIOI_HINT_DISABLE;
+	}
+	else if (!strcmp(value, "automatic") || !strcmp(value, "AUTOMATIC"))
+	{
+	    ADIOI_Info_set(fd->info, key, value);
+	    *local_cache = ADIOI_HINT_AUTO;
+	}
+
+	tmp_val = *local_cache;
+
+	MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
+	/* --BEGIN ERROR HANDLING-- */
+	if (tmp_val != *local_cache) {
+	    MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(funcname,
+		    key,
+		    error_code);
+	    return -1;
+	}
+	/* --END ERROR HANDLING-- */
+    }
+    ADIOI_Free(value);
+    return 0;
+}
+int ADIOI_Info_check_and_install_true(ADIO_File fd, MPI_Info info, const char *key, 
+	int *local_cache, char *funcname, int *error_code)
+{
+    int flag, tmp_val;
+    char *value;
+
+    value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));
+    if (value == NULL) {
+        *error_code = MPIO_Err_create_code(*error_code,
+                                           MPIR_ERR_RECOVERABLE,
+                                           funcname,
+                                           __LINE__,
+                                           MPI_ERR_OTHER,
+                                           "**nomem2",0);
+        return -1;
+    }
+
+    ADIOI_Info_get(info, key, MPI_MAX_INFO_VAL, value, &flag);
+    if (flag) {
+	if (!strcmp(value, "true") || !strcmp(value, "TRUE")) {
+	    ADIOI_Info_set(fd->info, key, value);
+	    *local_cache = 1;
+	}
+	else if (!strcmp(value, "false") || !strcmp(value, "FALSE")) {
+	    ADIOI_Info_set(fd->info, key, value);
+	    *local_cache = 0;
+	}
+	tmp_val = *local_cache;
+
+	MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
+	/* --BEGIN ERROR HANDLING-- */
+	if (tmp_val != *local_cache) {
+	    MPIO_ERR_CREATE_CODE_INFO_NOT_SAME(funcname,
+		    key,
+		    error_code);
+	    return -1;
+	}
+	/* --END ERROR HANDLING-- */
+    }
+
+    ADIOI_Free(value);
+    return 0;
+}
+int ADIOI_Info_check_and_install_str(ADIO_File fd, MPI_Info info, const char *key, 
+	char **local_cache, char *funcname, int *error_code)
+{
+    int flag, len;
+    char *value;
+
+    value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));
+    if (value == NULL) {
+        *error_code = MPIO_Err_create_code(*error_code,
+                                           MPIR_ERR_RECOVERABLE,
+                                           funcname,
+                                           __LINE__,
+                                           MPI_ERR_OTHER,
+                                           "**nomem2",0);
+        return -1;
+    }
+
+    ADIOI_Info_get(info, key, MPI_MAX_INFO_VAL,
+	    value, &flag);
+    if (flag) {
+	ADIOI_Info_set(fd->info, "cb_config_list", value);
+	len = (strlen(value)+1) * sizeof(char);
+	*local_cache = ADIOI_Malloc(len);
+	if (*local_cache == NULL) {
+	    *error_code = MPIO_Err_create_code(*error_code,
+		    MPIR_ERR_RECOVERABLE,
+		    funcname,
+		    __LINE__,
+		    MPI_ERR_OTHER,
+		    "**nomem2",0);
+	    return -1;
+	}
+	ADIOI_Strncpy(*local_cache, value, len);
+    }
+    /* if it has been set already, we ignore it the second time. 
+     * otherwise we would get an error if someone used the same
+     * info value with a cb_config_list value in it in a couple
+     * of calls, which would be irritating. */
+    ADIOI_Free(value);
+    return 0;
+}
diff --git a/src/mpi/romio/adio/include/hint_fns.h b/src/mpi/romio/adio/include/hint_fns.h
new file mode 100644
index 0000000..7c20177
--- /dev/null
+++ b/src/mpi/romio/adio/include/hint_fns.h
@@ -0,0 +1,23 @@
+/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
+/*
+ *
+ *  (C) 2013 UChicago/Argonne LLC
+ *      See COPYRIGHT in top-level directory.
+ */
+
+#ifndef _HINT_FNS_H
+#define _HINT_FNS_H
+
+int ADIOI_Info_check_and_install_int(ADIO_File fd, MPI_Info info, const char *key,
+	        int *local_cache, char *funcname, int *error_code);
+
+int ADIOI_Info_check_and_install_enabled(ADIO_File fd, MPI_Info info, const char *key,
+	        int *local_cache, char *funcname, int *error_code);
+
+int ADIOI_Info_check_and_install_true(ADIO_File fd, MPI_Info info, const char *key,
+	        int *local_cache, char *funcname, int *error_code);
+
+int ADIOI_Info_check_and_install_str(ADIO_File fd, MPI_Info info, const char *key,
+	        char **local_cache, char *funcname, int *error_code);
+
+#endif

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

Summary of changes:
 src/mpi/romio/adio/ad_bg/ad_bg_hints.c         |  338 +++----------------
 src/mpi/romio/adio/ad_bgl/ad_bgl_hints.c       |  346 +++----------------
 src/mpi/romio/adio/ad_lustre/ad_lustre_hints.c |   56 +---
 src/mpi/romio/adio/ad_panfs/ad_panfs_hints.c   |  111 ++-----
 src/mpi/romio/adio/ad_pvfs2/ad_pvfs2_hints.c   |  192 +----------
 src/mpi/romio/adio/common/Makefile.mk          |    3 +-
 src/mpi/romio/adio/common/ad_hints.c           |  434 +++++-------------------
 src/mpi/romio/adio/common/hint_fns.c           |  183 ++++++++++
 src/mpi/romio/adio/include/hint_fns.h          |   23 ++
 src/mpi/romio/mpi-io/mpiu_external32.c         |    1 -
 src/mpi/romio/test/aggregation1.c              |    3 +-
 src/mpi/romio/test/aggregation2.c              |    2 +-
 src/mpi/romio/test/async-multiple.c            |    4 +-
 src/mpi/romio/test/async.c                     |    4 +-
 src/mpi/romio/test/coll_test.c                 |    4 +-
 src/mpi/romio/test/external32.c                |    4 +-
 src/mpi/romio/test/file_info.c                 |   19 +-
 src/mpi/romio/test/noncontig_coll2.c           |    8 +-
 src/mpi/romio/test/ordered_fp.c                |    4 +-
 src/mpi/romio/test/shared_fp.c                 |    4 +-
 src/mpi/romio/test/simple.c                    |    2 +-
 21 files changed, 480 insertions(+), 1265 deletions(-)
 create mode 100644 src/mpi/romio/adio/common/hint_fns.c
 create mode 100644 src/mpi/romio/adio/include/hint_fns.h


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list