[mpich2-commits] r5494 - in mpich2/trunk/src: include mpi/comm

goodell at mcs.anl.gov goodell at mcs.anl.gov
Tue Oct 20 15:35:19 CDT 2009


Author: goodell
Date: 2009-10-20 15:35:19 -0500 (Tue, 20 Oct 2009)
New Revision: 5494

Modified:
   mpich2/trunk/src/include/mpiimplthread.h
   mpich2/trunk/src/mpi/comm/commutil.c
Log:
Move the CONTEXTID critical section macros to mpiimplthread.h.

This is necessary to permit non-ch3 devices (such as dcmfd) to override
the implementation of the critical section macro in mpidpre.h.  For
example, dcmfd may want to use a lockbox lock instead of a pthread
mutex when running on a BG/P.

No reviewer.

Modified: mpich2/trunk/src/include/mpiimplthread.h
===================================================================
--- mpich2/trunk/src/include/mpiimplthread.h	2009-10-20 20:35:18 UTC (rev 5493)
+++ mpich2/trunk/src/include/mpiimplthread.h	2009-10-20 20:35:19 UTC (rev 5494)
@@ -519,6 +519,15 @@
 #define MPIU_THREAD_CS_ENTER_PMI(_context)
 #define MPIU_THREAD_CS_EXIT_PMI(_context)
 
+#define MPIU_THREAD_CS_ENTER_CONTEXTID(_context)
+#define MPIU_THREAD_CS_EXIT_CONTEXTID(_context)
+/* FIXME this YIELD macro probably needs to be revisited */
+#define MPIU_THREAD_CS_YIELD_CONTEXTID(_context) \
+    MPID_Thread_mutex_unlock(&MPIR_ThreadInfo.global_mutex);\
+    MPID_Thread_yield();\
+    MPID_Thread_mutex_lock(&MPIR_ThreadInfo.global_mutex);
+
+
 #elif MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_PER_OBJECT
 /* There are multiple locks, one for each (major) object */
 
@@ -581,6 +590,17 @@
 #define MPIU_THREAD_CS_EXIT_PMI(_context) \
    MPIU_THREAD_CHECK_BEGIN MPIU_THREAD_CS_EXIT_LOCKNAME(global_mutex) MPIU_THREAD_CHECK_END
 
+#define MPIU_THREAD_CS_ENTER_CONTEXTID(_context) \
+   MPIU_THREAD_CHECK_BEGIN MPIU_THREAD_CS_ENTER_LOCKNAME(global_mutex) MPIU_THREAD_CHECK_END
+#define MPIU_THREAD_CS_EXIT_CONTEXTID(_context) \
+   MPIU_THREAD_CHECK_BEGIN MPIU_THREAD_CS_EXIT_LOCKNAME(global_mutex) MPIU_THREAD_CHECK_END
+/* FIXME this YIELD macro probably needs to be revisited */
+#define MPIU_THREAD_CS_YIELD_CONTEXTID(_context) \
+    MPIU_THREAD_CHECKDEPTH(global_mutex,1);\
+    MPID_Thread_mutex_unlock(&MPIR_ThreadInfo.global_mutex);\
+    MPID_Thread_yield();\
+    MPID_Thread_mutex_lock(&MPIR_ThreadInfo.global_mutex);
+
 #elif MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_LOCK_FREE
 /* Updates to shared data and access to shared services is handled without 
    locks where ever possible. */

Modified: mpich2/trunk/src/mpi/comm/commutil.c
===================================================================
--- mpich2/trunk/src/mpi/comm/commutil.c	2009-10-20 20:35:18 UTC (rev 5493)
+++ mpich2/trunk/src/mpi/comm/commutil.c	2009-10-20 20:35:19 UTC (rev 5494)
@@ -9,7 +9,7 @@
 
 /* This is the utility file for comm that contains the basic comm items
    and storage management */
-#ifndef MPID_COMM_PREALLOC 
+#ifndef MPID_COMM_PREALLOC
 #define MPID_COMM_PREALLOC 8
 #endif
 
@@ -20,40 +20,6 @@
 				      sizeof(MPID_Comm), MPID_Comm_direct,
                                       MPID_COMM_PREALLOC};
 
-/* Support for threading */
-
-#ifdef MPICH_IS_THREADED
-#if MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_GLOBAL
-/* There is a single, global lock, held for the duration of an MPI call */
-#define MPIU_THREAD_CS_ENTER_CONTEXTID(_context)
-#define MPIU_THREAD_CS_EXIT_CONTEXTID(_context)
-#define MPIU_THREAD_CS_YIELD_CONTEXTID(_context) \
-		MPID_Thread_mutex_unlock(&MPIR_ThreadInfo.global_mutex);\
-		MPID_Thread_yield();\
-		MPID_Thread_mutex_lock(&MPIR_ThreadInfo.global_mutex);
-
-#elif MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_PER_OBJECT
-/* There are multiple locks, one for each (major) object */
-#define MPIU_THREAD_CS_ENTER_CONTEXTID(_context) \
-   MPIU_THREAD_CHECK_BEGIN MPIU_THREAD_CS_ENTER_LOCKNAME(global_mutex) MPIU_THREAD_CHECK_END
-#define MPIU_THREAD_CS_EXIT_CONTEXTID(_context) \
-   MPIU_THREAD_CHECK_BEGIN MPIU_THREAD_CS_EXIT_LOCKNAME(global_mutex) MPIU_THREAD_CHECK_END
-#define MPIU_THREAD_CS_YIELD_CONTEXTID(_context) \
-    MPIU_THREAD_CHECKDEPTH(global_mutex,1);\
-		MPID_Thread_mutex_unlock(&MPIR_ThreadInfo.global_mutex);\
-		MPID_Thread_yield();\
-		MPID_Thread_mutex_lock(&MPIR_ThreadInfo.global_mutex);
-
-#elif MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_LOCK_FREE
-/* Updates to shared data and access to shared services is handled without 
-   locks where ever possible. */
-#error lock-free not yet implemented
-
-#else
-#error Unrecognized thread granularity
-#endif /* MPIU_THREAD_GRANULARITY */
-#endif /* MPICH_IS_THREADED */
-
 /* utility function to pretty print a context ID for debugging purposes, see
  * mpiimpl.h for more info on the various fields */
 static void MPIR_Comm_dump_context_id(MPIR_Context_id_t context_id, char *out_str, int len)



More information about the mpich2-commits mailing list