[mpich2-commits] r6667 - in mpich2/trunk/src: include mpi/errhan

goodell at mcs.anl.gov goodell at mcs.anl.gov
Mon May 17 17:47:57 CDT 2010


Author: goodell
Date: 2010-05-17 17:47:57 -0500 (Mon, 17 May 2010)
New Revision: 6667

Modified:
   mpich2/trunk/src/include/mpiimpl.h
   mpich2/trunk/src/mpi/errhan/add_error_class.c
   mpich2/trunk/src/mpi/errhan/dynerrutil.c
Log:
remove little-used, non-atomic macros

No reviewer.

Modified: mpich2/trunk/src/include/mpiimpl.h
===================================================================
--- mpich2/trunk/src/include/mpiimpl.h	2010-05-17 22:47:56 UTC (rev 6666)
+++ mpich2/trunk/src/include/mpiimpl.h	2010-05-17 22:47:57 UTC (rev 6667)
@@ -1909,47 +1909,8 @@
    smpd.  We may not want to export it.  */
 void MPIR_Err_print_stack(FILE *, int);
 
-
 /* ------------------------------------------------------------------------- */
-/* XXX DJG FIXME delete this? */
-/* FIXME: Merge these with the object refcount update routines (perhaps as
-   part of a general "atomic update" file */
-/*
- * Standardized general-purpose atomic update routines.  Some comments:
- * Setmax atomically implements *a_ptr = max(b,*a_ptr) .  This can
- * be implemented using compare-and-swap (form max, if new max is 
- * larger, compare-and-swap against old max.  if failure, restart).
- * Fetch_and_increment can be implemented in a similar way; for
- * example, in IA32, 
- * loop:
- *   mov eax, valptr
- *   mov oldvalptr, eax
- *   mov ebx, eax
- *   inc ebx
- *   lock: cmpxchg valptr, ebx
- *   jnz loop
- *
- * Implementations using LoadLink/StoreConditional are similar.
- *
- * Question: can we use the simple code for MPI_THREAD_SERIALIZED?
- * If not, do we want a separate set of definitions that can be used
- * in the code where serialized is ok.
- *
- * Currently, these are used only in the routines to create new error classes
- * and codes (src/mpi/errhan/dynerrutil.c and add_error_class.c).  
- * Note that MPI object reference counts are handled with their own routines.
- *
- * Because of the current use of these routines is within the SINGLE_CS
- * thread lock (for the THREAD_MULTIPLE case), we currently
- * do *not* include a separate Critical section for these operations.
- *
- */
-#define MPIR_Setmax(a_ptr,b) if (b>*(a_ptr)) { *(a_ptr) = b; }
-#define MPIR_Fetch_and_increment(count_ptr,value_ptr) \
-    { *value_ptr = *count_ptr; *count_ptr += 1; }
 
-/* ------------------------------------------------------------------------- */
-
 /* FIXME: Move these to the communicator block; make sure that all 
    objects have such hooks */
 #ifndef HAVE_DEV_COMM_HOOK

Modified: mpich2/trunk/src/mpi/errhan/add_error_class.c
===================================================================
--- mpich2/trunk/src/mpi/errhan/add_error_class.c	2010-05-17 22:47:56 UTC (rev 6666)
+++ mpich2/trunk/src/mpi/errhan/add_error_class.c	2010-05-17 22:47:57 UTC (rev 6667)
@@ -74,8 +74,12 @@
     MPIU_ERR_CHKANDJUMP(new_class<0,mpi_errno,MPI_ERR_OTHER,"**noerrclasses");
 
     *errorclass = ERROR_DYN_MASK | new_class;
-    MPIR_Setmax( &MPIR_Process.attrs.lastusedcode, *errorclass );
-    
+
+    /* FIXME why isn't this done in MPIR_Err_add_class? */
+    if (*errorclass > MPIR_Process.attrs.lastusedcode) {
+       MPIR_Process.attrs.lastusedcode = *errorclass;
+    }
+
     /* ... end of body of routine ... */
 
   fn_exit:

Modified: mpich2/trunk/src/mpi/errhan/dynerrutil.c
===================================================================
--- mpich2/trunk/src/mpi/errhan/dynerrutil.c	2010-05-17 22:47:56 UTC (rev 6666)
+++ mpich2/trunk/src/mpi/errhan/dynerrutil.c	2010-05-17 22:47:57 UTC (rev 6667)
@@ -202,7 +202,8 @@
 	MPIR_Init_err_dyncodes();
 	
     /* Get new class */
-    MPIR_Fetch_and_increment( &first_free_class, &new_class );
+    new_class = first_free_class;
+    ++first_free_class;
 
     /* --BEGIN ERROR HANDLING-- */
     if (new_class >= ERROR_MAX_NCLASS) {
@@ -243,7 +244,9 @@
 	MPIR_Init_err_dyncodes();
 
     /* Get the new code */
-    MPIR_Fetch_and_increment( &first_free_code, &new_code );
+    new_code = first_free_code;
+    ++first_free_code;
+
     /* --BEGIN ERROR HANDLING-- */
     if (new_code >= ERROR_MAX_NCODE) {
 	/* Fail if out of codes */



More information about the mpich2-commits mailing list