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

Service Account noreply at mpich.org
Sat Sep 26 19:47:39 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  6dd87a93860d292800dd7edec1c9a04838802492 (commit)
       via  e9c739759a499c1592049d56e92690b09486d101 (commit)
      from  1def98d77ed0c9cf977695d7461a87cd1983bbb7 (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/6dd87a93860d292800dd7edec1c9a04838802492

commit 6dd87a93860d292800dd7edec1c9a04838802492
Author: Rob Latham <robl at mcs.anl.gov>
Date:   Thu Sep 24 15:23:38 2015 -0500

    Revert "sync ROMIO locations that touch global state"
    
    This reverts commit d484022edb5f865760b063b9908895bdbfbef7fb.
    
    We are switching back to ROMIO taking the global lock on function
    entry/exit.
    
    Signed-off-by: Pavan Balaji <balaji at anl.gov>
    
    Conflicts:
    
    	src/mpi/romio/adio/common/flatten.c

diff --git a/src/mpi/romio/adio/common/ad_end.c b/src/mpi/romio/adio/common/ad_end.c
index 5aef802..ea4dfeb 100644
--- a/src/mpi/romio/adio/common/ad_end.c
+++ b/src/mpi/romio/adio/common/ad_end.c
@@ -61,8 +61,6 @@ void ADIO_End(int *error_code)
 int ADIOI_End_call(MPI_Comm comm, int keyval, void *attribute_val, void
 		  *extra_state)
 {
-    /* though we are touching global variables here, only one thread can call
-     * MPI_Finalize so we can be less carefuil w. r. t. critical sections */
     int error_code;
 
     ADIOI_UNREFERENCED_ARG(comm);
diff --git a/src/mpi/romio/adio/common/cb_config_list.c b/src/mpi/romio/adio/common/cb_config_list.c
index 508722a..626709f 100644
--- a/src/mpi/romio/adio/common/cb_config_list.c
+++ b/src/mpi/romio/adio/common/cb_config_list.c
@@ -133,7 +133,6 @@ int ADIOI_cb_gather_name_array(MPI_Comm comm,
     ADIO_cb_name_array array = NULL;
     int alloc_size;
 
-    MPIR_Ext_cs_enter(ADIO_THREAD_MUTEX);
     if (ADIOI_cb_config_list_keyval == MPI_KEYVAL_INVALID) {
         /* cleaned up by ADIOI_End_call */
 	MPI_Keyval_create((MPI_Copy_function *) ADIOI_cb_copy_name_array, 
@@ -145,11 +144,9 @@ int ADIOI_cb_gather_name_array(MPI_Comm comm,
         if (found) {
             ADIOI_Assert(array != NULL);
 	    *arrayp = array;
-	    MPIR_Ext_cs_exit(ADIO_THREAD_MUTEX);
 	    return 0;
 	}
     }
-    MPIR_Ext_cs_exit(ADIO_THREAD_MUTEX);
 
     MPI_Comm_size(dupcomm, &commsize);
     MPI_Comm_rank(dupcomm, &commrank);
diff --git a/src/mpi/romio/adio/common/flatten.c b/src/mpi/romio/adio/common/flatten.c
index 743f09f..ac31007 100644
--- a/src/mpi/romio/adio/common/flatten.c
+++ b/src/mpi/romio/adio/common/flatten.c
@@ -25,8 +25,6 @@ void ADIOI_Flatten_datatype(MPI_Datatype datatype)
     int is_contig;
     ADIOI_Flatlist_node *flat, *prev=0;
 
-    MPIR_Ext_cs_enter(ADIO_THREAD_MUTEX);
-
     /* check if necessary to flatten. */
  
     /* is it entirely contiguous? */
@@ -34,7 +32,7 @@ void ADIOI_Flatten_datatype(MPI_Datatype datatype)
   #ifdef FLATTEN_DEBUG 
   DBG_FPRINTF(stderr,"ADIOI_Flatten_datatype:: is_contig %#X\n",is_contig);
   #endif
-    if (is_contig) goto fn_exit;
+    if (is_contig) return;
 
     /* has it already been flattened? */
     flat = ADIOI_Flatlist;
@@ -43,7 +41,7 @@ void ADIOI_Flatten_datatype(MPI_Datatype datatype)
       #ifdef FLATTEN_DEBUG 
       DBG_FPRINTF(stderr,"ADIOI_Flatten_datatype:: found datatype %#X\n", datatype);
       #endif
-		goto fn_exit;
+		return;
 	}
 	else {
 	    prev = flat;
@@ -100,10 +98,6 @@ void ADIOI_Flatten_datatype(MPI_Datatype datatype)
              );
   }
 #endif
-
-  fn_exit:
-    MPIR_Ext_cs_exit(ADIO_THREAD_MUTEX);
-
 }
 
 /* ADIOI_Flatten()
@@ -1187,7 +1181,6 @@ void ADIOI_Optimize_flattened(ADIOI_Flatlist_node *flat_type)
 void ADIOI_Delete_flattened(MPI_Datatype datatype)
 {
     ADIOI_Flatlist_node *flat, *prev;
-    MPIR_Ext_cs_enter(ADIO_THREAD_MUTEX);
 
     prev = flat = ADIOI_Flatlist;
     while (flat && (flat->type != datatype)) {
@@ -1200,16 +1193,13 @@ void ADIOI_Delete_flattened(MPI_Datatype datatype)
 	if (flat->indices) ADIOI_Free(flat->indices);
 	ADIOI_Free(flat);
     }
-    MPIR_Ext_cs_exit(ADIO_THREAD_MUTEX);
 }
 
 ADIOI_Flatlist_node * ADIOI_Flatten_and_find(MPI_Datatype datatype)
 {
     ADIOI_Flatlist_node *node;
-    MPIR_Ext_cs_enter(ADIO_THREAD_MUTEX);
     ADIOI_Flatten_datatype(datatype);
     node = ADIOI_Flatlist;
     while (node->type != datatype) node = node->next;
-    MPIR_Ext_cs_exit(ADIO_THREAD_MUTEX);
     return node;
 }
diff --git a/src/mpi/romio/mpi-io/glue/mpich/mpio_file.c b/src/mpi/romio/mpi-io/glue/mpich/mpio_file.c
index 0aabe27..6f6c902 100644
--- a/src/mpi/romio/mpi-io/glue/mpich/mpio_file.c
+++ b/src/mpi/romio/mpi-io/glue/mpich/mpio_file.c
@@ -69,7 +69,6 @@ MPI_Fint MPIO_File_c2f(MPI_File fh)
     if (fh->fortran_handle != -1)
 	return fh->fortran_handle;
 
-    MPIR_Ext_cs_enter(ADIO_THREAD_MUTEX);
     if (!ADIOI_Ftable) {
 	ADIOI_Ftable_max = 1024;
 	ADIOI_Ftable = (MPI_File *)
@@ -88,7 +87,6 @@ MPI_Fint MPIO_File_c2f(MPI_File fh)
     ADIOI_Ftable_ptr++;
     ADIOI_Ftable[ADIOI_Ftable_ptr] = fh;
     fh->fortran_handle = ADIOI_Ftable_ptr;
-    MPIR_Ext_cs_exit(ADIO_THREAD_MUTEX);
     return (MPI_Fint) ADIOI_Ftable_ptr;
 #endif
 }

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

commit e9c739759a499c1592049d56e92690b09486d101
Author: Rob Latham <robl at mcs.anl.gov>
Date:   Thu Sep 24 15:19:46 2015 -0500

    Revert "Initial draft of ROMIO managed thread locks."
    
    This reverts commit 78413c55c4820a50cd31f0df6ec009891ff42917.
    
    Reducing ROMIO's thread granularity is still a good idea but we ar
    missing one or more spots where ROMIO diddles with state outside a
    mutex, and after a week we cannot find it.  Try agian after the release.
    
    Signed-off-by: Pavan Balaji <balaji at anl.gov>
    
    Conflicts:
    
    	src/glue/romio/glue_romio.c
    	src/include/glue_romio.h.in
    	src/mpi/romio/adio/common/ad_iread_coll.c
    	src/mpi/romio/adio/common/ad_iwrite_coll.c
    	src/mpi/romio/mpi-io/mpioimpl.h

diff --git a/src/glue/romio/glue_romio.c b/src/glue/romio/glue_romio.c
index 5de161f..fa327ab 100644
--- a/src/glue/romio/glue_romio.c
+++ b/src/glue/romio/glue_romio.c
@@ -35,52 +35,24 @@ int MPIR_Ext_assert_fail(const char *cond, const char *file_name, int line_num)
     return MPIR_Assert_fail(cond, file_name, line_num);
 }
 
-void MPIR_Ext_thread_mutex_create(void **mutex_p_p)
-{
-    int err;
-    MPID_Thread_mutex_t *m;
-
-    m = (MPID_Thread_mutex_t *) MPIU_Malloc(sizeof(MPID_Thread_mutex_t));
-    MPID_Thread_mutex_create(m, &err);
-    MPIU_Assert(err == 0);
-
-    *mutex_p_p = (void *) m;
-}
-
-void MPIR_Ext_thread_mutex_destroy(void *mutex_p)
-{
-    int err;
-    MPID_Thread_mutex_t *m = (MPID_Thread_mutex_t *) mutex_p;
-
-    MPID_Thread_mutex_destroy(m, &err);
-    MPIU_Assert(err == 0);
-
-    MPIU_Free(mutex_p);
-}
-
 /* These two routines export the GLOBAL CS_ENTER/EXIT macros as functions so
  * that ROMIO can use them.  These routines only support the GLOBAL granularity
  * of MPICH threading; other accommodations must be made for finer-grained
  * threading strategies. */
-void MPIR_Ext_cs_enter(void *mutex_p)
-{
-    MPID_THREAD_CS_ENTER(GLOBAL, *((MPID_Thread_mutex_t *) mutex_p));
-}
-
-void MPIR_Ext_cs_exit(void *mutex_p)
+void MPIR_Ext_cs_enter(void)
 {
-    MPID_THREAD_CS_EXIT(GLOBAL, *((MPID_Thread_mutex_t *) mutex_p));
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_ALLFUNC_MUTEX);
 }
 
-void MPIR_Ext_cs_yield(void *mutex_p)
+void MPIR_Ext_cs_exit(void)
 {
-    MPID_THREAD_CS_YIELD(GLOBAL, *((MPID_Thread_mutex_t *) mutex_p));
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_ALLFUNC_MUTEX);
 }
 
 /* This routine is for a thread to yield control when the thread is waiting for
  * the completion of communication inside a ROMIO routine but the progress
  * engine is blocked by another thread. */
-void MPIR_Ext_cs_yield_global(void)
+void MPIR_Ext_cs_yield(void)
 {
     /* TODO: check whether the progress engine is blocked */
     MPID_THREAD_CS_YIELD(GLOBAL, MPIR_THREAD_GLOBAL_ALLFUNC_MUTEX);
diff --git a/src/include/glue_romio.h.in b/src/include/glue_romio.h.in
index d2b97a9..9623833 100644
--- a/src/include/glue_romio.h.in
+++ b/src/include/glue_romio.h.in
@@ -51,12 +51,9 @@ extern int MPIR_Ext_dbg_romio_verbose_enabled;
  * glue code that cannot be initialized statically */
 int MPIR_Ext_init(void);
 
-void MPIR_Ext_thread_mutex_create(void **mutex_p_p);
-void MPIR_Ext_thread_mutex_destroy(void *mutex_p);
-void MPIR_Ext_cs_enter(void *mutex_p);
-void MPIR_Ext_cs_exit(void *mutex_p);
-void MPIR_Ext_cs_yield(void *mutex_p);
-void MPIR_Ext_cs_yield_global(void);
+void MPIR_Ext_cs_enter(void);
+void MPIR_Ext_cs_exit(void);
+void MPIR_Ext_cs_yield(void);
 
 /* to facilitate error checking */
 int MPIR_Ext_datatype_iscommitted(MPI_Datatype datatype);
diff --git a/src/mpi/romio/adio/common/ad_end.c b/src/mpi/romio/adio/common/ad_end.c
index 2350f0a..5aef802 100644
--- a/src/mpi/romio/adio/common/ad_end.c
+++ b/src/mpi/romio/adio/common/ad_end.c
@@ -78,8 +78,5 @@ int ADIOI_End_call(MPI_Comm comm, int keyval, void *attribute_val, void
         MPI_Keyval_free(&ADIOI_cb_config_list_keyval);
 
     ADIO_End(&error_code);
-
-    MPIR_Ext_thread_mutex_destroy((void *) ADIO_THREAD_MUTEX);
-
     return error_code;
 }
diff --git a/src/mpi/romio/adio/common/ad_iread_coll.c b/src/mpi/romio/adio/common/ad_iread_coll.c
index 6cf85e9..2ec23fb 100644
--- a/src/mpi/romio/adio/common/ad_iread_coll.c
+++ b/src/mpi/romio/adio/common/ad_iread_coll.c
@@ -1332,7 +1332,7 @@ static int ADIOI_GEN_irc_wait_fn(int count, void **array_of_states,
 
             /* If the progress engine is blocked, we have to yield for another
              * thread to be able to unblock the progress engine. */
-            MPIR_EXT_CS_YIELD_GLOBAL();
+            MPIR_Ext_cs_yield();
         }
     }
 
diff --git a/src/mpi/romio/adio/common/ad_iwrite_coll.c b/src/mpi/romio/adio/common/ad_iwrite_coll.c
index 3cb86ad..d275f78 100644
--- a/src/mpi/romio/adio/common/ad_iwrite_coll.c
+++ b/src/mpi/romio/adio/common/ad_iwrite_coll.c
@@ -1557,7 +1557,7 @@ static int ADIOI_GEN_iwc_wait_fn(int count, void **array_of_states,
 
             /* If the progress engine is blocked, we have to yield for another
              * thread to be able to unblock the progress engine. */
-            MPIR_EXT_CS_YIELD_GLOBAL();
+            MPIR_Ext_cs_yield();
         }
     }
 
diff --git a/src/mpi/romio/adio/include/adioi.h b/src/mpi/romio/adio/include/adioi.h
index f715be7..0cc219e 100644
--- a/src/mpi/romio/adio/include/adioi.h
+++ b/src/mpi/romio/adio/include/adioi.h
@@ -1087,6 +1087,4 @@ ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
 
 #endif
 
-extern void *ADIO_THREAD_MUTEX;
-
 #endif  /* ADIOI_INCLUDE */
diff --git a/src/mpi/romio/mpi-io/close.c b/src/mpi/romio/mpi-io/close.c
index 57b2019..3f2b0b1 100644
--- a/src/mpi/romio/mpi-io/close.c
+++ b/src/mpi/romio/mpi-io/close.c
@@ -44,6 +44,8 @@ int MPI_File_close(MPI_File *fh)
     HPMP_IO_WSTART(fl_xmpi, BLKMPIFILECLOSE, TRDTBLOCK, *adio_fh);
 #endif /* MPI_hpux */
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(*fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -88,6 +90,7 @@ int MPI_File_close(MPI_File *fh)
 #endif /* MPI_hpux */
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
     return error_code;
 fn_fail:
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/romio/mpi-io/delete.c b/src/mpi/romio/mpi-io/delete.c
index d9a3e0f..47b52a0 100644
--- a/src/mpi/romio/mpi-io/delete.c
+++ b/src/mpi/romio/mpi-io/delete.c
@@ -48,6 +48,8 @@ int MPI_File_delete(ROMIO_CONST char *filename, MPI_Info info)
 
     MPIU_UNREFERENCED_ARG(info);
 
+    ROMIO_THREAD_CS_ENTER();
+
     MPIR_MPIOInit(&error_code);
     if (error_code != MPI_SUCCESS) goto fn_exit;
 
@@ -88,5 +90,6 @@ int MPI_File_delete(ROMIO_CONST char *filename, MPI_Info info)
 #endif /* MPI_hpux */
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/fsync.c b/src/mpi/romio/mpi-io/fsync.c
index 03a2138..7b2ef12 100644
--- a/src/mpi/romio/mpi-io/fsync.c
+++ b/src/mpi/romio/mpi-io/fsync.c
@@ -45,6 +45,7 @@ int MPI_File_sync(MPI_File fh)
     HPMP_IO_START(fl_xmpi, BLKMPIFILESYNC, TRDTBLOCK, adio_fh,
 		  MPI_DATATYPE_NULL, -1);
 #endif /* MPI_hpux */
+    ROMIO_THREAD_CS_ENTER();
 
     adio_fh = MPIO_File_resolve(fh);
     /* --BEGIN ERROR HANDLING-- */
@@ -70,5 +71,6 @@ int MPI_File_sync(MPI_File fh)
 #endif /* MPI_hpux */
  
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/get_errh.c b/src/mpi/romio/mpi-io/get_errh.c
index e51c851..7962e33 100644
--- a/src/mpi/romio/mpi-io/get_errh.c
+++ b/src/mpi/romio/mpi-io/get_errh.c
@@ -44,6 +44,8 @@ int MPI_File_get_errhandler(MPI_File mpi_fh, MPI_Errhandler *errhandler)
     static char myname[] = "MPI_FILE_GET_ERRHANDLER";
     MPID_THREADPRIV_DECL;
 
+    ROMIO_THREAD_CS_ENTER();
+
     if (mpi_fh == MPI_FILE_NULL) {
 	*errhandler = ADIOI_DFLT_ERR_HANDLER;
     }
@@ -64,5 +66,6 @@ int MPI_File_get_errhandler(MPI_File mpi_fh, MPI_Errhandler *errhandler)
     }
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
     return MPI_SUCCESS;
 }
diff --git a/src/mpi/romio/mpi-io/get_group.c b/src/mpi/romio/mpi-io/get_group.c
index 75475c3..2b3077c 100644
--- a/src/mpi/romio/mpi-io/get_group.c
+++ b/src/mpi/romio/mpi-io/get_group.c
@@ -43,6 +43,8 @@ int MPI_File_get_group(MPI_File fh, MPI_Group *group)
     ADIO_File adio_fh;
     static char myname[] = "MPI_FILE_GET_GROUP";
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -57,5 +59,6 @@ int MPI_File_get_group(MPI_File fh, MPI_Group *group)
     error_code = MPI_Comm_group(adio_fh->comm, group);
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/get_info.c b/src/mpi/romio/mpi-io/get_info.c
index c3df84f..e923e2b 100644
--- a/src/mpi/romio/mpi-io/get_info.c
+++ b/src/mpi/romio/mpi-io/get_info.c
@@ -42,6 +42,8 @@ int MPI_File_get_info(MPI_File fh, MPI_Info *info_used)
     ADIO_File adio_fh;
     static char myname[] = "MPI_FILE_GET_INFO";
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -55,5 +57,6 @@ int MPI_File_get_info(MPI_File fh, MPI_Info *info_used)
     /* --END ERROR HANDLING-- */
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
     return  error_code;
 }
diff --git a/src/mpi/romio/mpi-io/get_view.c b/src/mpi/romio/mpi-io/get_view.c
index 38ed63c..46b0926 100644
--- a/src/mpi/romio/mpi-io/get_view.c
+++ b/src/mpi/romio/mpi-io/get_view.c
@@ -52,6 +52,8 @@ int MPI_File_get_view(MPI_File fh, MPI_Offset *disp, MPI_Datatype *etype,
     int i, j, k, combiner;
     MPI_Datatype copy_etype, copy_filetype;
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -94,5 +96,7 @@ int MPI_File_get_view(MPI_File fh, MPI_Offset *disp, MPI_Datatype *etype,
     }
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
+
     return MPI_SUCCESS;
 }
diff --git a/src/mpi/romio/mpi-io/ioreq_c2f.c b/src/mpi/romio/mpi-io/ioreq_c2f.c
index 1aaf002..d49ebcd 100644
--- a/src/mpi/romio/mpi-io/ioreq_c2f.c
+++ b/src/mpi/romio/mpi-io/ioreq_c2f.c
@@ -56,6 +56,7 @@ MPI_Fint MPIO_Request_c2f(MPIO_Request request)
 	    return (MPI_Fint) 0;
     }
 
+    ROMIO_THREAD_CS_ENTER();
     if (!ADIOI_Reqtable) {
 	ADIOI_Reqtable_max = 1024;
 	ADIOI_Reqtable = (MPIO_Request *)
@@ -74,6 +75,7 @@ MPI_Fint MPIO_Request_c2f(MPIO_Request request)
     ADIOI_Reqtable_ptr++;
     ADIOI_Reqtable[ADIOI_Reqtable_ptr] = request;
 
+    ROMIO_THREAD_CS_EXIT();
     return (MPI_Fint) ADIOI_Reqtable_ptr;
 #endif
 }
diff --git a/src/mpi/romio/mpi-io/ioreq_f2c.c b/src/mpi/romio/mpi-io/ioreq_f2c.c
index 4b47cda..a58e4a2 100644
--- a/src/mpi/romio/mpi-io/ioreq_f2c.c
+++ b/src/mpi/romio/mpi-io/ioreq_f2c.c
@@ -49,6 +49,8 @@ MPIO_Request MPIO_Request_f2c(MPI_Fint request)
     return (MPIO_Request) request;
 #else
 
+    ROMIO_THREAD_CS_ENTER();
+    
     if (!request) {
 	return MPIO_REQUEST_NULL;
     }
@@ -63,6 +65,7 @@ MPIO_Request MPIO_Request_f2c(MPI_Fint request)
     /* --END ERROR HANDLING-- */
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
     return ADIOI_Reqtable[request];
 #endif
 }
diff --git a/src/mpi/romio/mpi-io/iotest.c b/src/mpi/romio/mpi-io/iotest.c
index 89d2412..42bc8a3 100644
--- a/src/mpi/romio/mpi-io/iotest.c
+++ b/src/mpi/romio/mpi-io/iotest.c
@@ -56,6 +56,8 @@ int MPIO_Test(MPIO_Request *request, int *flag, MPI_Status *status)
     }
 #endif /* MPI_hpux */
 
+    ROMIO_THREAD_CS_ENTER();
+
     if (*request == MPIO_REQUEST_NULL) {
 	    error_code = MPI_SUCCESS;
 	    goto fn_exit;
@@ -87,6 +89,7 @@ int MPIO_Test(MPIO_Request *request, int *flag, MPI_Status *status)
 #endif /* MPI_hpux */
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
     return error_code;
 }
 #endif
diff --git a/src/mpi/romio/mpi-io/iotestall.c b/src/mpi/romio/mpi-io/iotestall.c
index bde51c9..24dd8b2 100644
--- a/src/mpi/romio/mpi-io/iotestall.c
+++ b/src/mpi/romio/mpi-io/iotestall.c
@@ -34,6 +34,7 @@ int MPIO_Testall(int count, MPIO_Request requests[], int *flag,
     int done, i, err; 
     MPID_THREADPRIV_DECL;
 
+    ROMIO_THREAD_CS_ENTER();
     if (count == 1)  {
 	    err = MPIO_Test( requests, flag, statuses );
 	    goto fn_exit;
@@ -70,6 +71,7 @@ int MPIO_Testall(int count, MPIO_Request requests[], int *flag,
 
     err = MPI_SUCCESS;
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
     return err;
 }
 
diff --git a/src/mpi/romio/mpi-io/iotestany.c b/src/mpi/romio/mpi-io/iotestany.c
index eaf4844..eac6197 100644
--- a/src/mpi/romio/mpi-io/iotestany.c
+++ b/src/mpi/romio/mpi-io/iotestany.c
@@ -34,6 +34,8 @@ int MPIO_Testany(int count, MPIO_Request requests[], int *index,
     int i, err; 
     MPID_THREADPRIV_DECL;
 
+    ROMIO_THREAD_CS_ENTER();
+
     if (count == 1) {
 	err = MPIO_Test( requests, flag, status );
 	if (!err) *index = 0;
@@ -74,5 +76,6 @@ int MPIO_Testany(int count, MPIO_Request requests[], int *index,
 
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
     return err;
 }
diff --git a/src/mpi/romio/mpi-io/iotestsome.c b/src/mpi/romio/mpi-io/iotestsome.c
index 01276d2..a7d7d4c 100644
--- a/src/mpi/romio/mpi-io/iotestsome.c
+++ b/src/mpi/romio/mpi-io/iotestsome.c
@@ -35,6 +35,8 @@ int MPIO_Testsome(int count, MPIO_Request requests[], int *outcount,
     int flag;
     MPID_THREADPRIV_DECL;
 
+    ROMIO_THREAD_CS_ENTER();
+
     if (count == 1) {
 	err = MPIO_Test( requests, &flag, statuses );
 	if (!err) {
@@ -78,5 +80,7 @@ int MPIO_Testsome(int count, MPIO_Request requests[], int *outcount,
     }
 
 fn_exit:
+
+    ROMIO_THREAD_CS_EXIT();
     return err;
 }
diff --git a/src/mpi/romio/mpi-io/iowait.c b/src/mpi/romio/mpi-io/iowait.c
index e1cdda6..4d383c8 100644
--- a/src/mpi/romio/mpi-io/iowait.c
+++ b/src/mpi/romio/mpi-io/iowait.c
@@ -56,6 +56,8 @@ int MPIO_Wait(MPIO_Request *request, MPI_Status *status)
     }
 #endif /* MPI_hpux */
 
+    ROMIO_THREAD_CS_ENTER();
+
     if (*request == MPIO_REQUEST_NULL) {
 	    error_code = MPI_SUCCESS;
 	    goto fn_exit;
@@ -88,6 +90,7 @@ int MPIO_Wait(MPIO_Request *request, MPI_Status *status)
 #endif /* MPI_hpux */
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
     return error_code;
 }
 #endif
diff --git a/src/mpi/romio/mpi-io/iowaitall.c b/src/mpi/romio/mpi-io/iowaitall.c
index 7e6ddf6..3e5e5b8 100644
--- a/src/mpi/romio/mpi-io/iowaitall.c
+++ b/src/mpi/romio/mpi-io/iowaitall.c
@@ -33,6 +33,8 @@ int MPIO_Waitall( int count, MPIO_Request requests[], MPI_Status statuses[] )
     int notdone, i, flag, err; 
     MPID_THREADPRIV_DECL;
 
+    ROMIO_THREAD_CS_ENTER();
+
     if (count == 1)  {
 	    err = MPIO_Wait(requests, statuses);
 	    goto fn_exit;
@@ -65,6 +67,8 @@ int MPIO_Waitall( int count, MPIO_Request requests[], MPI_Status statuses[] )
 
     err = MPI_SUCCESS;
 fn_exit:
+
+    ROMIO_THREAD_CS_EXIT();
     return err;
 }
 
diff --git a/src/mpi/romio/mpi-io/iowaitany.c b/src/mpi/romio/mpi-io/iowaitany.c
index cd53825..747aa5b 100644
--- a/src/mpi/romio/mpi-io/iowaitany.c
+++ b/src/mpi/romio/mpi-io/iowaitany.c
@@ -34,6 +34,8 @@ int MPIO_Waitany(int count, MPIO_Request requests[], int *index,
     int i, flag, err; 
     MPID_THREADPRIV_DECL;
 
+    ROMIO_THREAD_CS_ENTER();
+
     if (count == 1) {
 	err = MPIO_Wait( requests, status );
 	if (!err) *index = 0;
@@ -76,5 +78,7 @@ int MPIO_Waitany(int count, MPIO_Request requests[], int *index,
     } while (flag == 0);
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
+
     return err;
 }
diff --git a/src/mpi/romio/mpi-io/iowaitsome.c b/src/mpi/romio/mpi-io/iowaitsome.c
index 143384a..1bca9c6 100644
--- a/src/mpi/romio/mpi-io/iowaitsome.c
+++ b/src/mpi/romio/mpi-io/iowaitsome.c
@@ -34,6 +34,8 @@ int MPIO_Waitsome(int count, MPIO_Request requests[], int *outcount,
     int i, flag, err; 
     MPID_THREADPRIV_DECL;
 
+    ROMIO_THREAD_CS_ENTER();
+
     if (count == 1) {
 	err = MPIO_Wait( requests, statuses );
 	if (!err) {
@@ -74,5 +76,6 @@ int MPIO_Waitsome(int count, MPIO_Request requests[], int *outcount,
     } while (*outcount == 0);
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
     return err;
 }
diff --git a/src/mpi/romio/mpi-io/iread.c b/src/mpi/romio/mpi-io/iread.c
index 0ff2a3e..4b23a11 100644
--- a/src/mpi/romio/mpi-io/iread.c
+++ b/src/mpi/romio/mpi-io/iread.c
@@ -83,6 +83,8 @@ int MPIOI_File_iread(MPI_File fh, MPI_Offset offset, int file_ptr_type, void *bu
     ADIO_Offset off, bufsize;
     MPI_Offset nbytes=0;
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -152,6 +154,8 @@ int MPIOI_File_iread(MPI_File fh, MPI_Offset offset, int file_ptr_type, void *bu
 			   offset, request, &error_code); 
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
+
     return error_code;
 }
 #endif
diff --git a/src/mpi/romio/mpi-io/iread_all.c b/src/mpi/romio/mpi-io/iread_all.c
index f0959f8..afe44f6 100644
--- a/src/mpi/romio/mpi-io/iread_all.c
+++ b/src/mpi/romio/mpi-io/iread_all.c
@@ -89,6 +89,8 @@ int MPIOI_File_iread_all(MPI_File fh,
     ADIO_File adio_fh;
     void *xbuf=NULL, *e32_buf=NULL;
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -140,6 +142,8 @@ int MPIOI_File_iread_all(MPI_File fh,
     }
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
+
     return error_code;
 }
 #endif
diff --git a/src/mpi/romio/mpi-io/iread_sh.c b/src/mpi/romio/mpi-io/iread_sh.c
index 1fac1bc..bd64313 100644
--- a/src/mpi/romio/mpi-io/iread_sh.c
+++ b/src/mpi/romio/mpi-io/iread_sh.c
@@ -55,6 +55,8 @@ int MPI_File_iread_shared(MPI_File fh, void *buf, int count,
     ADIO_Offset off, shared_fp;
     MPI_Offset nbytes=0;
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -132,6 +134,7 @@ int MPI_File_iread_shared(MPI_File fh, void *buf, int count,
     /* --END ERROR HANDLING-- */
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
     return error_code;
 }
 #endif
diff --git a/src/mpi/romio/mpi-io/iwrite.c b/src/mpi/romio/mpi-io/iwrite.c
index 1103b09..ae6c6ae 100644
--- a/src/mpi/romio/mpi-io/iwrite.c
+++ b/src/mpi/romio/mpi-io/iwrite.c
@@ -90,6 +90,7 @@ int MPIOI_File_iwrite(MPI_File fh,
     ADIO_File adio_fh;
     MPI_Offset nbytes=0;
 
+    ROMIO_THREAD_CS_ENTER();
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -161,6 +162,7 @@ int MPIOI_File_iwrite(MPI_File fh,
 			   offset, request, &error_code);
     }
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
     return error_code;
 }
 #endif
diff --git a/src/mpi/romio/mpi-io/iwrite_all.c b/src/mpi/romio/mpi-io/iwrite_all.c
index a6de14d..9f486e7 100644
--- a/src/mpi/romio/mpi-io/iwrite_all.c
+++ b/src/mpi/romio/mpi-io/iwrite_all.c
@@ -84,6 +84,8 @@ int MPIOI_File_iwrite_all(MPI_File fh,
     void *e32buf=NULL;
     const void *xbuf=NULL;
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -129,6 +131,8 @@ int MPIOI_File_iwrite_all(MPI_File fh,
 
 fn_exit:
     if (e32buf != NULL) ADIOI_Free(e32buf);
+    ROMIO_THREAD_CS_EXIT();
+
     return error_code;
 }
 #endif
diff --git a/src/mpi/romio/mpi-io/iwrite_sh.c b/src/mpi/romio/mpi-io/iwrite_sh.c
index 67bdfd9..3f9612a 100644
--- a/src/mpi/romio/mpi-io/iwrite_sh.c
+++ b/src/mpi/romio/mpi-io/iwrite_sh.c
@@ -55,6 +55,8 @@ int MPI_File_iwrite_shared(MPI_File fh, ROMIO_CONST void *buf, int count,
     ADIO_Offset off, shared_fp;
     static char myname[] = "MPI_FILE_IWRITE_SHARED";
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -112,5 +114,7 @@ int MPI_File_iwrite_shared(MPI_File fh, ROMIO_CONST void *buf, int count,
 			   shared_fp, request, &error_code); 
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
+
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/mpioimpl.h b/src/mpi/romio/mpi-io/mpioimpl.h
index 452c2cb..074ad42 100644
--- a/src/mpi/romio/mpi-io/mpioimpl.h
+++ b/src/mpi/romio/mpi-io/mpioimpl.h
@@ -18,10 +18,9 @@
 #ifdef ROMIO_INSIDE_MPICH
 #include "glue_romio.h"
 
-#define ROMIO_THREAD_CS_ENTER(mutex) MPIR_Ext_cs_enter(mutex)
-#define ROMIO_THREAD_CS_EXIT(mutex) MPIR_Ext_cs_exit(mutex)
-#define ROMIO_THREAD_CS_YIELD(mutex) MPIR_Ext_cs_yield(mutex)
-#define MPIR_EXT_CS_YIELD_GLOBAL() MPIR_Ext_cs_yield_global()
+#define ROMIO_THREAD_CS_ENTER() MPIR_Ext_cs_enter()
+#define ROMIO_THREAD_CS_EXIT() MPIR_Ext_cs_exit()
+#define ROMIO_THREAD_CS_YIELD() MPIR_Ext_cs_yield()
 
 /* committed datatype checking support in ROMIO */
 #define MPIO_DATATYPE_ISCOMMITTED(dtype_, err_)        \
@@ -34,10 +33,9 @@
    error reporting features provided by MPICH must implement these 
    four functions.  Defining these as empty should not change the behavior 
    of correct programs */
-#define ROMIO_THREAD_CS_ENTER(mutex)
-#define ROMIO_THREAD_CS_EXIT(mutex)
-#define ROMIO_THREAD_CS_YIELD(mutex)
-#define MPIR_EXT_CS_YIELD_GLOBAL()
+#define ROMIO_THREAD_CS_ENTER()
+#define ROMIO_THREAD_CS_EXIT()
+#define ROMIO_THREAD_CS_YIELD()
 #define MPIO_DATATYPE_ISCOMMITTED(dtype_, err_) do {} while (0)
 #ifdef HAVE_WINDOWS_H
 #define MPIU_UNREFERENCED_ARG(a) a
diff --git a/src/mpi/romio/mpi-io/mpir-mpioinit.c b/src/mpi/romio/mpi-io/mpir-mpioinit.c
index a7f9d08..be78b45 100644
--- a/src/mpi/romio/mpi-io/mpir-mpioinit.c
+++ b/src/mpi/romio/mpi-io/mpir-mpioinit.c
@@ -13,7 +13,6 @@
 #endif
 
 extern int ADIO_Init_keyval;
-void *ADIO_THREAD_MUTEX = NULL;
 
 /* common code to stuff an attribute on a communicator for the purpose of
  * cleaning up in MPI_Finalize() */
@@ -49,9 +48,6 @@ void MPIR_MPIOInit(int * error_code) {
 
 	/* initialize ADIO */
         ADIO_Init( (int *)0, (char ***)0, error_code);
-
-        /* create mutexes */
-        MPIR_Ext_thread_mutex_create((void **) &ADIO_THREAD_MUTEX);
     }
     *error_code = MPI_SUCCESS;
 }
diff --git a/src/mpi/romio/mpi-io/open.c b/src/mpi/romio/mpi-io/open.c
index f100022..7cebb5a 100644
--- a/src/mpi/romio/mpi-io/open.c
+++ b/src/mpi/romio/mpi-io/open.c
@@ -59,6 +59,8 @@ int MPI_File_open(MPI_Comm comm, ROMIO_CONST char *filename, int amode,
     HPMP_IO_OPEN_START(fl_xmpi, comm);
 #endif /* MPI_hpux */
 
+    ROMIO_THREAD_CS_ENTER();
+
     /* --BEGIN ERROR HANDLING-- */
     MPIO_CHECK_COMM(comm, myname, error_code);
     MPIO_CHECK_INFO_ALL(info, error_code, comm);
@@ -196,6 +198,7 @@ int MPI_File_open(MPI_Comm comm, ROMIO_CONST char *filename, int amode,
 #endif /* MPI_hpux */
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
     return error_code;
 fn_fail:
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/romio/mpi-io/prealloc.c b/src/mpi/romio/mpi-io/prealloc.c
index c258295..1542e47 100644
--- a/src/mpi/romio/mpi-io/prealloc.c
+++ b/src/mpi/romio/mpi-io/prealloc.c
@@ -48,6 +48,8 @@ int MPI_File_preallocate(MPI_File fh, MPI_Offset size)
 		  adio_fh, MPI_DATATYPE_NULL, -1);
 #endif /* MPI_hpux */
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -97,6 +99,8 @@ int MPI_File_preallocate(MPI_File fh, MPI_Offset size)
 
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
+
     /* TODO: bcast result? */
     if (!mynod) return error_code;
     else return MPI_SUCCESS;
diff --git a/src/mpi/romio/mpi-io/read.c b/src/mpi/romio/mpi-io/read.c
index 05ed206..6f12914 100644
--- a/src/mpi/romio/mpi-io/read.c
+++ b/src/mpi/romio/mpi-io/read.c
@@ -79,6 +79,8 @@ int MPIOI_File_read(MPI_File fh,
     ADIO_Offset off, bufsize;
     void *xbuf=NULL, *e32_buf=NULL;
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -178,6 +180,8 @@ int MPIOI_File_read(MPI_File fh,
     }
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
+
     return error_code;
 }
 #endif
diff --git a/src/mpi/romio/mpi-io/read_all.c b/src/mpi/romio/mpi-io/read_all.c
index eed2606..e0b605d 100644
--- a/src/mpi/romio/mpi-io/read_all.c
+++ b/src/mpi/romio/mpi-io/read_all.c
@@ -80,6 +80,8 @@ int MPIOI_File_read_all(MPI_File fh,
     ADIO_File adio_fh;
     void *xbuf=NULL, *e32_buf=NULL;
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -133,6 +135,8 @@ int MPIOI_File_read_all(MPI_File fh,
     }
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
+
     return error_code;
 }
 #endif
diff --git a/src/mpi/romio/mpi-io/read_allb.c b/src/mpi/romio/mpi-io/read_allb.c
index 5e2b31a..2110f71 100644
--- a/src/mpi/romio/mpi-io/read_allb.c
+++ b/src/mpi/romio/mpi-io/read_allb.c
@@ -67,6 +67,8 @@ int MPIOI_File_read_all_begin(MPI_File fh,
     ADIO_File adio_fh;
     void *xbuf=NULL, *e32_buf=NULL;
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -130,6 +132,8 @@ int MPIOI_File_read_all_begin(MPI_File fh,
     }
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
+
     return error_code;
 }
 #endif
diff --git a/src/mpi/romio/mpi-io/read_alle.c b/src/mpi/romio/mpi-io/read_alle.c
index 1754b6c..e2853c1 100644
--- a/src/mpi/romio/mpi-io/read_alle.c
+++ b/src/mpi/romio/mpi-io/read_alle.c
@@ -60,6 +60,8 @@ int MPIOI_File_read_all_end(MPI_File fh,
 
     MPIU_UNREFERENCED_ARG(buf);
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -81,6 +83,8 @@ int MPIOI_File_read_all_end(MPI_File fh,
     adio_fh->split_coll_count = 0;
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
+
     return error_code;
 }
 #endif
diff --git a/src/mpi/romio/mpi-io/read_ord.c b/src/mpi/romio/mpi-io/read_ord.c
index 0560d89..be87763 100644
--- a/src/mpi/romio/mpi-io/read_ord.c
+++ b/src/mpi/romio/mpi-io/read_ord.c
@@ -53,6 +53,8 @@ int MPI_File_read_ordered(MPI_File fh, void *buf, int count,
     ADIO_Offset shared_fp=0;
     ADIO_File adio_fh;
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -102,6 +104,8 @@ int MPI_File_read_ordered(MPI_File fh, void *buf, int count,
     /* --END ERROR HANDLING-- */
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
+
     /* FIXME: Check for error code from ReadStridedColl? */
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/read_ordb.c b/src/mpi/romio/mpi-io/read_ordb.c
index 88fbc9b..5548bde 100644
--- a/src/mpi/romio/mpi-io/read_ordb.c
+++ b/src/mpi/romio/mpi-io/read_ordb.c
@@ -50,6 +50,8 @@ int MPI_File_read_ordered_begin(MPI_File fh, void *buf, int count,
     static char myname[] = "MPI_FILE_READ_ORDERED_BEGIN";
     void *xbuf=NULL, *e32_buf=NULL;
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -129,5 +131,7 @@ int MPI_File_read_ordered_begin(MPI_File fh, void *buf, int count,
     }
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
+
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/read_orde.c b/src/mpi/romio/mpi-io/read_orde.c
index 649d2e0..542f687 100644
--- a/src/mpi/romio/mpi-io/read_orde.c
+++ b/src/mpi/romio/mpi-io/read_orde.c
@@ -45,6 +45,8 @@ int MPI_File_read_ordered_end(MPI_File fh, void *buf, MPI_Status *status)
 
     MPIU_UNREFERENCED_ARG(buf);
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -67,5 +69,7 @@ int MPI_File_read_ordered_end(MPI_File fh, void *buf, MPI_Status *status)
     adio_fh->split_coll_count = 0;
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
+
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/read_sh.c b/src/mpi/romio/mpi-io/read_sh.c
index 34e76b0..8ebbf87 100644
--- a/src/mpi/romio/mpi-io/read_sh.c
+++ b/src/mpi/romio/mpi-io/read_sh.c
@@ -52,6 +52,8 @@ int MPI_File_read_shared(MPI_File fh, void *buf, int count,
     ADIO_File adio_fh;
     void *xbuf=NULL, *e32_buf=NULL;
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -147,5 +149,7 @@ int MPI_File_read_shared(MPI_File fh, void *buf, int count,
 	ADIOI_Free(e32_buf);
     }
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
+
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/register_datarep.c b/src/mpi/romio/mpi-io/register_datarep.c
index 53ebe3c..3895872 100644
--- a/src/mpi/romio/mpi-io/register_datarep.c
+++ b/src/mpi/romio/mpi-io/register_datarep.c
@@ -62,6 +62,8 @@ int MPI_Register_datarep(ROMIO_CONST char *datarep,
     ADIOI_Datarep *adio_datarep;
     static char myname[] = "MPI_REGISTER_DATAREP";
 
+    ROMIO_THREAD_CS_ENTER();
+
     /* --BEGIN ERROR HANDLING-- */
     /* check datarep name (use strlen instead of strnlen because
        strnlen is not portable) */
@@ -137,5 +139,7 @@ int MPI_Register_datarep(ROMIO_CONST char *datarep,
     error_code = MPI_SUCCESS;
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
+
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/seek.c b/src/mpi/romio/mpi-io/seek.c
index 78602b1..c68394a 100644
--- a/src/mpi/romio/mpi-io/seek.c
+++ b/src/mpi/romio/mpi-io/seek.c
@@ -49,6 +49,8 @@ int MPI_File_seek(MPI_File fh, MPI_Offset offset, int whence)
     HPMP_IO_START(fl_xmpi, BLKMPIFILESEEK, TRDTBLOCK, adio_fh, MPI_DATATYPE_NULL, -1);
 #endif /* MPI_hpux */
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -132,5 +134,6 @@ int MPI_File_seek(MPI_File fh, MPI_Offset offset, int whence)
     error_code = MPI_SUCCESS;
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/seek_sh.c b/src/mpi/romio/mpi-io/seek_sh.c
index 18396a5..d3ce1ab 100644
--- a/src/mpi/romio/mpi-io/seek_sh.c
+++ b/src/mpi/romio/mpi-io/seek_sh.c
@@ -41,6 +41,8 @@ int MPI_File_seek_shared(MPI_File fh, MPI_Offset offset, int whence)
     MPI_Offset curr_offset, eof_offset, tmp_offset;
     ADIO_File adio_fh;
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -176,5 +178,7 @@ int MPI_File_seek_shared(MPI_File fh, MPI_Offset offset, int whence)
     error_code = MPI_SUCCESS;
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
+
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/set_atom.c b/src/mpi/romio/mpi-io/set_atom.c
index 7cd5c5f..00be9fc 100644
--- a/src/mpi/romio/mpi-io/set_atom.c
+++ b/src/mpi/romio/mpi-io/set_atom.c
@@ -41,6 +41,8 @@ int MPI_File_set_atomicity(MPI_File fh, int flag)
     ADIO_Fcntl_t *fcntl_struct;
     ADIO_File adio_fh;
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -84,5 +86,6 @@ int MPI_File_set_atomicity(MPI_File fh, int flag)
     ADIOI_Free(fcntl_struct);
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/set_errh.c b/src/mpi/romio/mpi-io/set_errh.c
index 046ecf9..d943787 100644
--- a/src/mpi/romio/mpi-io/set_errh.c
+++ b/src/mpi/romio/mpi-io/set_errh.c
@@ -42,6 +42,8 @@ int MPI_File_set_errhandler(MPI_File mpi_fh, MPI_Errhandler errhandler)
     ADIO_File fh;
     MPID_THREADPRIV_DECL;
 
+    ROMIO_THREAD_CS_ENTER();
+
     if (mpi_fh == MPI_FILE_NULL) {
 	ADIOI_DFLT_ERR_HANDLER = errhandler;
     }
@@ -69,5 +71,6 @@ int MPI_File_set_errhandler(MPI_File mpi_fh, MPI_Errhandler errhandler)
     }
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/set_info.c b/src/mpi/romio/mpi-io/set_info.c
index 4eb1405..2c898fe 100644
--- a/src/mpi/romio/mpi-io/set_info.c
+++ b/src/mpi/romio/mpi-io/set_info.c
@@ -40,6 +40,8 @@ int MPI_File_set_info(MPI_File fh, MPI_Info info)
     static char myname[] = "MPI_FILE_SET_INFO";
     ADIO_File adio_fh;
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -56,6 +58,8 @@ fn_exit:
 	error_code = MPIO_Err_return_file(adio_fh, error_code);
     /* --END ERROR HANDLING-- */
 
+    ROMIO_THREAD_CS_EXIT();
+
     return error_code;
 fn_fail:
     goto fn_exit;
diff --git a/src/mpi/romio/mpi-io/set_size.c b/src/mpi/romio/mpi-io/set_size.c
index 26a8b4d..b658929 100644
--- a/src/mpi/romio/mpi-io/set_size.c
+++ b/src/mpi/romio/mpi-io/set_size.c
@@ -48,6 +48,8 @@ int MPI_File_set_size(MPI_File fh, MPI_Offset size)
 		  MPI_DATATYPE_NULL, -1);
 #endif /* MPI_hpux */
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -97,5 +99,7 @@ int MPI_File_set_size(MPI_File fh, MPI_Offset size)
 #endif /* MPI_hpux */
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
+
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/set_view.c b/src/mpi/romio/mpi-io/set_view.c
index e5fc2ef..4d98fdd 100644
--- a/src/mpi/romio/mpi-io/set_view.c
+++ b/src/mpi/romio/mpi-io/set_view.c
@@ -48,6 +48,8 @@ int MPI_File_set_view(MPI_File fh, MPI_Offset disp, MPI_Datatype etype,
     ADIO_Offset shared_fp, byte_off;
     ADIO_File adio_fh;
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -191,6 +193,8 @@ int MPI_File_set_view(MPI_File fh, MPI_Offset disp, MPI_Datatype etype,
 	adio_fh->is_external32 = 1;
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
+
     return error_code;
 fn_fail:
 	/* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/romio/mpi-io/write.c b/src/mpi/romio/mpi-io/write.c
index 8aa22d1..eb9a77f 100644
--- a/src/mpi/romio/mpi-io/write.c
+++ b/src/mpi/romio/mpi-io/write.c
@@ -80,6 +80,8 @@ int MPIOI_File_write(MPI_File fh,
     void *e32buf=NULL;
     const void *xbuf=NULL;
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -177,6 +179,8 @@ int MPIOI_File_write(MPI_File fh,
 
 fn_exit:
     if (e32buf!= NULL) ADIOI_Free(e32buf);
+    ROMIO_THREAD_CS_EXIT();
+
     return error_code;
 }
 #endif
diff --git a/src/mpi/romio/mpi-io/write_all.c b/src/mpi/romio/mpi-io/write_all.c
index e48fe98..6f17cc3 100644
--- a/src/mpi/romio/mpi-io/write_all.c
+++ b/src/mpi/romio/mpi-io/write_all.c
@@ -81,6 +81,8 @@ int MPIOI_File_write_all(MPI_File fh,
     void *e32buf=NULL;
     const void *xbuf=NULL;
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -125,6 +127,8 @@ int MPIOI_File_write_all(MPI_File fh,
 
 fn_exit:
     if (e32buf != NULL) ADIOI_Free(e32buf);
+    ROMIO_THREAD_CS_EXIT();
+
     return error_code;
 }
 #endif
diff --git a/src/mpi/romio/mpi-io/write_allb.c b/src/mpi/romio/mpi-io/write_allb.c
index 40b2fe9..e184723 100644
--- a/src/mpi/romio/mpi-io/write_allb.c
+++ b/src/mpi/romio/mpi-io/write_allb.c
@@ -67,6 +67,8 @@ int MPIOI_File_write_all_begin(MPI_File fh,
     void *e32buf=NULL;
     const void *xbuf=NULL;
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -123,6 +125,8 @@ int MPIOI_File_write_all_begin(MPI_File fh,
 
 fn_exit:
     if ( e32buf != NULL) ADIOI_Free(e32buf);
+    ROMIO_THREAD_CS_EXIT();
+
     return error_code;
 }
 #endif
diff --git a/src/mpi/romio/mpi-io/write_alle.c b/src/mpi/romio/mpi-io/write_alle.c
index 5699858..6dc7f6d 100644
--- a/src/mpi/romio/mpi-io/write_alle.c
+++ b/src/mpi/romio/mpi-io/write_alle.c
@@ -59,6 +59,8 @@ int MPIOI_File_write_all_end(MPI_File fh,
 
     MPIU_UNREFERENCED_ARG(buf);
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -86,6 +88,8 @@ int MPIOI_File_write_all_end(MPI_File fh,
     error_code = MPI_SUCCESS;
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
+
     return error_code;
 }
 #endif
diff --git a/src/mpi/romio/mpi-io/write_ord.c b/src/mpi/romio/mpi-io/write_ord.c
index 17b8d21..eb72734 100644
--- a/src/mpi/romio/mpi-io/write_ord.c
+++ b/src/mpi/romio/mpi-io/write_ord.c
@@ -56,6 +56,8 @@ int MPI_File_write_ordered(MPI_File fh, ROMIO_CONST void *buf, int count,
     void *e32buf=NULL;
     const void *xbuf;
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -118,6 +120,7 @@ int MPI_File_write_ordered(MPI_File fh, ROMIO_CONST void *buf, int count,
 
 fn_exit:
     if (e32buf != NULL) ADIOI_Free(e32buf);
+    ROMIO_THREAD_CS_EXIT();
 
     /* FIXME: Check for error code from WriteStridedColl? */
     return error_code;
diff --git a/src/mpi/romio/mpi-io/write_ordb.c b/src/mpi/romio/mpi-io/write_ordb.c
index 829f13e..8b5a302 100644
--- a/src/mpi/romio/mpi-io/write_ordb.c
+++ b/src/mpi/romio/mpi-io/write_ordb.c
@@ -52,6 +52,8 @@ int MPI_File_write_ordered_begin(MPI_File fh, ROMIO_CONST void *buf, int count,
     void *e32buf = NULL;
     const void *xbuf=NULL;
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -123,6 +125,8 @@ int MPI_File_write_ordered_begin(MPI_File fh, ROMIO_CONST void *buf, int count,
     /* --END ERROR HANDLING-- */
 
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
+
     /* FIXME: Check for error code from WriteStridedColl? */
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/write_orde.c b/src/mpi/romio/mpi-io/write_orde.c
index 4d294b8..8cfdba2 100644
--- a/src/mpi/romio/mpi-io/write_orde.c
+++ b/src/mpi/romio/mpi-io/write_orde.c
@@ -45,6 +45,8 @@ int MPI_File_write_ordered_end(MPI_File fh, ROMIO_CONST void *buf, MPI_Status *s
 
     MPIU_UNREFERENCED_ARG(buf);
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -66,6 +68,8 @@ int MPI_File_write_ordered_end(MPI_File fh, ROMIO_CONST void *buf, MPI_Status *s
 #endif
     adio_fh->split_coll_count = 0;
 
+
 fn_exit:
+    ROMIO_THREAD_CS_EXIT();
     return MPI_SUCCESS;
 }
diff --git a/src/mpi/romio/mpi-io/write_sh.c b/src/mpi/romio/mpi-io/write_sh.c
index ce6444b..ed8e1c1 100644
--- a/src/mpi/romio/mpi-io/write_sh.c
+++ b/src/mpi/romio/mpi-io/write_sh.c
@@ -54,6 +54,8 @@ int MPI_File_write_shared(MPI_File fh, ROMIO_CONST void *buf, int count,
     void *e32buf = NULL;
     const void *xbuf = NULL;
 
+    ROMIO_THREAD_CS_ENTER();
+
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -142,5 +144,6 @@ int MPI_File_write_shared(MPI_File fh, ROMIO_CONST void *buf, int count,
 
 fn_exit:
     if (e32buf != NULL) ADIOI_Free(e32buf);
+    ROMIO_THREAD_CS_EXIT();
     return error_code;
 }

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

Summary of changes:
 src/glue/romio/glue_romio.c                 |   38 +++-----------------------
 src/include/glue_romio.h.in                 |    9 ++----
 src/mpi/romio/adio/common/ad_end.c          |    5 ---
 src/mpi/romio/adio/common/ad_iread_coll.c   |    2 +-
 src/mpi/romio/adio/common/ad_iwrite_coll.c  |    2 +-
 src/mpi/romio/adio/common/cb_config_list.c  |    3 --
 src/mpi/romio/adio/common/flatten.c         |   14 +--------
 src/mpi/romio/adio/include/adioi.h          |    2 -
 src/mpi/romio/mpi-io/close.c                |    3 ++
 src/mpi/romio/mpi-io/delete.c               |    3 ++
 src/mpi/romio/mpi-io/fsync.c                |    2 +
 src/mpi/romio/mpi-io/get_errh.c             |    3 ++
 src/mpi/romio/mpi-io/get_group.c            |    3 ++
 src/mpi/romio/mpi-io/get_info.c             |    3 ++
 src/mpi/romio/mpi-io/get_view.c             |    4 +++
 src/mpi/romio/mpi-io/glue/mpich/mpio_file.c |    2 -
 src/mpi/romio/mpi-io/ioreq_c2f.c            |    2 +
 src/mpi/romio/mpi-io/ioreq_f2c.c            |    3 ++
 src/mpi/romio/mpi-io/iotest.c               |    3 ++
 src/mpi/romio/mpi-io/iotestall.c            |    2 +
 src/mpi/romio/mpi-io/iotestany.c            |    3 ++
 src/mpi/romio/mpi-io/iotestsome.c           |    4 +++
 src/mpi/romio/mpi-io/iowait.c               |    3 ++
 src/mpi/romio/mpi-io/iowaitall.c            |    4 +++
 src/mpi/romio/mpi-io/iowaitany.c            |    4 +++
 src/mpi/romio/mpi-io/iowaitsome.c           |    3 ++
 src/mpi/romio/mpi-io/iread.c                |    4 +++
 src/mpi/romio/mpi-io/iread_all.c            |    4 +++
 src/mpi/romio/mpi-io/iread_sh.c             |    3 ++
 src/mpi/romio/mpi-io/iwrite.c               |    2 +
 src/mpi/romio/mpi-io/iwrite_all.c           |    4 +++
 src/mpi/romio/mpi-io/iwrite_sh.c            |    4 +++
 src/mpi/romio/mpi-io/mpioimpl.h             |   14 ++++-----
 src/mpi/romio/mpi-io/mpir-mpioinit.c        |    4 ---
 src/mpi/romio/mpi-io/open.c                 |    3 ++
 src/mpi/romio/mpi-io/prealloc.c             |    4 +++
 src/mpi/romio/mpi-io/read.c                 |    4 +++
 src/mpi/romio/mpi-io/read_all.c             |    4 +++
 src/mpi/romio/mpi-io/read_allb.c            |    4 +++
 src/mpi/romio/mpi-io/read_alle.c            |    4 +++
 src/mpi/romio/mpi-io/read_ord.c             |    4 +++
 src/mpi/romio/mpi-io/read_ordb.c            |    4 +++
 src/mpi/romio/mpi-io/read_orde.c            |    4 +++
 src/mpi/romio/mpi-io/read_sh.c              |    4 +++
 src/mpi/romio/mpi-io/register_datarep.c     |    4 +++
 src/mpi/romio/mpi-io/seek.c                 |    3 ++
 src/mpi/romio/mpi-io/seek_sh.c              |    4 +++
 src/mpi/romio/mpi-io/set_atom.c             |    3 ++
 src/mpi/romio/mpi-io/set_errh.c             |    3 ++
 src/mpi/romio/mpi-io/set_info.c             |    4 +++
 src/mpi/romio/mpi-io/set_size.c             |    4 +++
 src/mpi/romio/mpi-io/set_view.c             |    4 +++
 src/mpi/romio/mpi-io/write.c                |    4 +++
 src/mpi/romio/mpi-io/write_all.c            |    4 +++
 src/mpi/romio/mpi-io/write_allb.c           |    4 +++
 src/mpi/romio/mpi-io/write_alle.c           |    4 +++
 src/mpi/romio/mpi-io/write_ord.c            |    3 ++
 src/mpi/romio/mpi-io/write_ordb.c           |    4 +++
 src/mpi/romio/mpi-io/write_orde.c           |    4 +++
 src/mpi/romio/mpi-io/write_sh.c             |    3 ++
 60 files changed, 189 insertions(+), 77 deletions(-)


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list