Commits

Ralph Castain committed 6eea07c

Begin cleanup of the thread_lock calls in ORTE. We'll ignore the ones in the rml/oob for now as that code block is being rewritten anyway.

Comments (0)

Files changed (17)

orte/mca/grpcomm/base/base.h

 
 #include "opal/class/opal_list.h"
 #include "opal/mca/mca.h"
-#include "opal/threads/mutex.h"
-#include "opal/threads/condition.h"
 #include "opal/mca/hwloc/hwloc.h"
 
 #include "orte/mca/odls/odls_types.h"

orte/mca/grpcomm/hier/grpcomm_hier_module.c

 #include <fcntl.h>
 
 #include "opal/dss/dss.h"
-#include "opal/mca/paffinity/paffinity.h"
 #include "opal/runtime/opal.h"
 
 #include "orte/mca/errmgr/errmgr.h"
     orte_grpcomm_collective_t *coll = (orte_grpcomm_collective_t*)cbdata;
     int rc;
     
-    OPAL_THREAD_LOCK(&coll->lock);
     /* xfer the data */
     if (ORTE_SUCCESS != (rc = opal_dss.copy_payload(&coll->results, buffer))) {
         ORTE_ERROR_LOG(rc);
          */
         opal_condition_broadcast(&coll->cond);
     }
-    OPAL_THREAD_UNLOCK(&coll->lock);
 }
 
 static int hier_allgather(opal_buffer_t *sbuf, opal_buffer_t *rbuf)
         }
 
         /* setup the collective */
-        OPAL_THREAD_LOCK(&allgather.lock);
         allgather.recvd = 0;
         /* reset the collector */
         OBJ_DESTRUCT(&allgather.results);
         OBJ_CONSTRUCT(&allgather.results, opal_buffer_t);
-        OPAL_THREAD_UNLOCK(&allgather.lock);
         
         /* send our data to the local_rank=0 proc on this node */
         if (0 > (rc = orte_rml.send_buffer(&my_local_rank_zero_proc, sbuf, ORTE_RML_TAG_ALLGATHER, 0))) {
         /* wait to complete - we will receive a single message
          * sent from our local_rank=0 peer
          */
-        OPAL_THREAD_LOCK(&allgather.lock);
-        while (allgather.recvd < 1) {
-            opal_condition_wait(&allgather.cond, &allgather.lock);
-        }
+
         /* copy payload to the caller's buffer */
         if (ORTE_SUCCESS != (rc = opal_dss.copy_payload(rbuf, &allgather.results))) {
             ORTE_ERROR_LOG(rc);
         }
-        OPAL_THREAD_UNLOCK(&allgather.lock);
         
         
     } else {
         /* I am local_rank = 0 on this node! */
 
         /* setup the collective */
-        OPAL_THREAD_LOCK(&allgather.lock);
         allgather.recvd = 0;
         /* reset the collector */
         OBJ_DESTRUCT(&allgather.results);
         OBJ_CONSTRUCT(&allgather.results, opal_buffer_t);
         /* seed with my data */
         opal_dss.copy_payload(&allgather.results, sbuf);
-        OPAL_THREAD_UNLOCK(&allgather.lock);
 
         /* wait to receive their data. Be sure to do this in
          * a manner that allows us to return without being in a recv!
         /* wait to complete - we need to receive input from every
          * local peer (excluding myself)
          */
-        OPAL_THREAD_LOCK(&allgather.lock);
-        while (allgather.recvd < num_local_peers) {
-            opal_condition_wait(&allgather.cond, &allgather.lock);
-        }
+
         /* xfer to the tmp buf in case another allgather comes along */
         OBJ_CONSTRUCT(&tmp_buf, opal_buffer_t);
         opal_dss.copy_payload(&tmp_buf, &allgather.results);
-        OPAL_THREAD_UNLOCK(&allgather.lock);
         
         /* cancel the lingering recv */
         orte_rml.recv_cancel(ORTE_NAME_WILDCARD, ORTE_RML_TAG_ALLGATHER);

orte/mca/iof/base/base.h

  * Copyright (c) 2004-2005 The Regents of the University of California.
  *                         All rights reserved.
  * Copyright (c) 2008      Cisco Systems, Inc.  All rights reserved.
- * Copyright (c) 2012      Los Alamos National Security, LLC.
+ * Copyright (c) 2012-2013 Los Alamos National Security, LLC.
  *                         All rights reserved.
  * $COPYRIGHT$
  * 
     size_t                  output_limit;
     char                    *input_files;
     opal_list_t             iof_components_opened;
-    opal_mutex_t            iof_write_output_lock;
     orte_iof_sink_t         *iof_write_stdout;
     orte_iof_sink_t         *iof_write_stderr;
 };

orte/mca/iof/base/iof_base_open.c

     
     /* Initialize globals */
     OBJ_CONSTRUCT(&orte_iof_base.iof_components_opened, opal_list_t);
-    OBJ_CONSTRUCT(&orte_iof_base.iof_write_output_lock, opal_mutex_t);
     orte_iof_base.output_limit = UINT_MAX;
 
     /* did the user request we print output to files? */

orte/mca/iof/hnp/iof_hnp.c

  *                         All rights reserved.
  * Copyright (c) 2007      Sun Microsystems, Inc.  All rights reserved.
  * Copyright (c) 2007      Cisco Systems, Inc.  All rights reserved.
- * Copyright (c) 2011-2012 Los Alamos National Security, LLC.  All rights
+ * Copyright (c) 2011-2013 Los Alamos National Security, LLC.  All rights
  *                         reserved. 
  * $COPYRIGHT$
  * 
         return rc;
     }
     
-    OBJ_CONSTRUCT(&mca_iof_hnp_component.lock, opal_mutex_t);
     OBJ_CONSTRUCT(&mca_iof_hnp_component.sinks, opal_list_t);
     OBJ_CONSTRUCT(&mca_iof_hnp_component.procs, opal_list_t);
     mca_iof_hnp_component.stdinev = NULL;
 }
 
 
+/* this function is called by the event library and thus
+ * can access information global to the state machine
+ */
 static void stdin_write_handler(int fd, short event, void *cbdata)
 {
     orte_iof_sink_t *sink = (orte_iof_sink_t*)cbdata;
                          ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
                          wev->fd));
     
-    /* lock us up to protect global operations */
-    OPAL_THREAD_LOCK(&mca_iof_hnp_component.lock);
     wev->pending = false;
     
     while (NULL != (item = opal_list_remove_first(&wev->outputs))) {
             /* just leave - we don't want to restart the
              * read event!
              */
-            goto DEPART;
+            return;
         }
         num_written = write(wev->fd, output->data, output->numbytes);
         OPAL_OUTPUT_VERBOSE((1, orte_iof_base.iof_output,
                                  ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), wev->fd));
             OBJ_RELEASE(wev);
             sink->wev = NULL;
-            goto DEPART;
+            return;
         } else if (num_written < output->numbytes) {
             OPAL_OUTPUT_VERBOSE((1, orte_iof_base.iof_output,
                                  "%s hnp:stdin:write:handler incomplete write %d - adjusting data",
             opal_event_add(mca_iof_hnp_component.stdinev->ev, 0);
         }
     }
-
-DEPART:
-    /* unlock and go */
-    OPAL_THREAD_UNLOCK(&mca_iof_hnp_component.lock);
 }
 
 /**

orte/mca/iof/hnp/iof_hnp.h

     opal_list_t procs;
     orte_iof_read_event_t *stdinev;
     opal_event_t stdinsig;
-    opal_mutex_t lock;
 };
 typedef struct orte_iof_hnp_component_t orte_iof_hnp_component_t;
 

orte/mca/iof/hnp/iof_hnp_read.c

  * Copyright (c) 2004-2005 The Regents of the University of California.
  *                         All rights reserved.
  * Copyright (c) 2007-2012 Cisco Systems, Inc.  All rights reserved.
- * Copyright (c) 2011-2012 Los Alamos National Security, LLC.  All rights
+ * Copyright (c) 2011-2013 Los Alamos National Security, LLC.  All rights
  *                         reserved. 
  * $COPYRIGHT$
  * 
     int rc;
     orte_ns_cmp_bitmask_t mask;
     
-    OPAL_THREAD_LOCK(&mca_iof_hnp_component.lock);
-    
     /* read up to the fragment size */
 #if !defined(__WINDOWS__)
     numbytes = read(fd, data, sizeof(data));
         /* non-blocking, retry */
         if (EAGAIN == errno || EINTR == errno) {
             opal_event_add(rev->ev, 0);
-            OPAL_THREAD_UNLOCK(&mca_iof_hnp_component.lock);
             return;
         } 
 
          */
         if (orte_job_term_ordered) {
             OBJ_RELEASE(mca_iof_hnp_component.stdinev);
-            OPAL_THREAD_UNLOCK(&mca_iof_hnp_component.lock);
             return;
         }
         /* cycle through our list of sinks */
 
                         OPAL_OUTPUT_VERBOSE((1, orte_iof_base.iof_output,
                                              "buffer backed up - holding"));
-                        OPAL_THREAD_UNLOCK(&mca_iof_hnp_component.lock);
                         return;
                     }
                 }
             }
         }
         /* nothing more to do */
-        OPAL_THREAD_UNLOCK(&mca_iof_hnp_component.lock);
         return;
     }
     
                 break;
             }
         }
-        OPAL_THREAD_UNLOCK(&mca_iof_hnp_component.lock);
         return;
     }
     
     /* re-add the event */
     opal_event_add(rev->ev, 0);
 
-    OPAL_THREAD_UNLOCK(&mca_iof_hnp_component.lock);
     return;
 }

orte/mca/iof/orted/iof_orted.c

  * Copyright (c) 2004-2005 The Regents of the University of California.
  *                         All rights reserved.
  * Copyright (c) 2007      Cisco Systems, Inc.  All rights reserved.
- * Copyright (c) 2011-2012 Los Alamos National Security, LLC.  All rights
+ * Copyright (c) 2011-2013 Los Alamos National Security, LLC.  All rights
  *                         reserved. 
  * $COPYRIGHT$
  * 
     }
     
     /* setup the local global variables */
-    OBJ_CONSTRUCT(&mca_iof_orted_component.lock, opal_mutex_t);
     OBJ_CONSTRUCT(&mca_iof_orted_component.sinks, opal_list_t);
     OBJ_CONSTRUCT(&mca_iof_orted_component.procs, opal_list_t);
     mca_iof_orted_component.xoff = false;
     opal_list_item_t *item, *next_item;
     orte_iof_sink_t* sink;
     orte_ns_cmp_bitmask_t mask;
-
-    OPAL_THREAD_LOCK(&mca_iof_orted_component.lock);
     
-    for(item = opal_list_get_first(&mca_iof_orted_component.sinks);
-        item != opal_list_get_end(&mca_iof_orted_component.sinks);
-        item = next_item ) {
+    for (item = opal_list_get_first(&mca_iof_orted_component.sinks);
+         item != opal_list_get_end(&mca_iof_orted_component.sinks);
+         item = next_item ) {
         sink = (orte_iof_sink_t*)item;
         next_item = opal_list_get_next(item);
         
             break;
         }
     }
-    OPAL_THREAD_UNLOCK(&mca_iof_orted_component.lock);
 
     return ORTE_SUCCESS;
 }
     int rc;
     opal_list_item_t *item;
     
-    OPAL_THREAD_LOCK(&mca_iof_orted_component.lock);
     while ((item = opal_list_remove_first(&mca_iof_orted_component.sinks)) != NULL) {
         OBJ_RELEASE(item);
     }
     OBJ_DESTRUCT(&mca_iof_orted_component.procs);
     /* Cancel the RML receive */
     rc = orte_rml.recv_cancel(ORTE_NAME_WILDCARD, ORTE_RML_TAG_IOF_PROXY);
-    OPAL_THREAD_UNLOCK(&mca_iof_orted_component.lock);
-    OBJ_DESTRUCT(&mca_iof_orted_component.lock);
     return rc;
 }
 
                          ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
                          wev->fd));
     
-    /* lock us up to protect global operations */
-    OPAL_THREAD_LOCK(&mca_iof_orted_component.lock);
     wev->pending = false;
     
     while (NULL != (item = opal_list_remove_first(&wev->outputs))) {
                                  ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), wev->fd));
             OBJ_RELEASE(wev);
             sink->wev = NULL;
-            goto DEPART;
+            return;
         }
         num_written = write(wev->fd, output->data, output->numbytes);
         OPAL_OUTPUT_VERBOSE((1, orte_iof_base.iof_output,
                 mca_iof_orted_component.xoff = true;
                 orte_iof_orted_send_xonxoff(ORTE_IOF_XOFF);
             }
-            goto DEPART;
+            return;
         } else if (num_written < output->numbytes) {
             OPAL_OUTPUT_VERBOSE((1, orte_iof_base.iof_output,
                                  "%s orted:stdin:write:handler incomplete write %d - adjusting data",
             orte_iof_orted_send_xonxoff(ORTE_IOF_XON);
         }
     }
-    
-DEPART:
-    /* unlock and go */
-    OPAL_THREAD_UNLOCK(&mca_iof_orted_component.lock);
 }

orte/mca/iof/orted/iof_orted.h

     orte_iof_base_component_t super;
     opal_list_t sinks;
     opal_list_t procs;
-    opal_mutex_t lock;
     bool xoff;
 };
 typedef struct orte_iof_orted_component_t orte_iof_orted_component_t;

orte/mca/iof/orted/iof_orted_read.c

  * Copyright (c) 2004-2005 The Regents of the University of California.
  *                         All rights reserved.
  * Copyright (c) 2007      Cisco Systems, Inc.  All rights reserved.
- * Copyright (c) 2011-2012 Los Alamos National Security, LLC.  All rights
+ * Copyright (c) 2011-2013 Los Alamos National Security, LLC.  All rights
  *                         reserved. 
  * $COPYRIGHT$
  * 
     opal_list_item_t *item;
     orte_iof_proc_t *proct;
     orte_ns_cmp_bitmask_t mask;
-
-    OPAL_THREAD_LOCK(&mca_iof_orted_component.lock);
     
     /* read up to the fragment size */
 #if !defined(__WINDOWS__)
             if (EAGAIN == errno || EINTR == errno) {
                 /* non-blocking, retry */
                 opal_event_add(rev->ev, 0);
-                OPAL_THREAD_UNLOCK(&mca_iof_orted_component.lock);
                 return;
             } 
 
     /* re-add the event */
     opal_event_add(rev->ev, 0);
 
-    OPAL_THREAD_UNLOCK(&mca_iof_orted_component.lock);
     return;
    
  CLEAN_RETURN:
     if (NULL != buf) {
         OBJ_RELEASE(buf);
     }
-    OPAL_THREAD_UNLOCK(&mca_iof_orted_component.lock);
     return;
 }

orte/mca/iof/tool/iof_tool.c

  * Copyright (c) 2004-2005 The Regents of the University of California.
  *                         All rights reserved.
  * Copyright (c) 2007      Cisco Systems, Inc.  All rights reserved.
- * Copyright (c) 2011-2012 Los Alamos National Security, LLC.  All rights
+ * Copyright (c) 2011-2013 Los Alamos National Security, LLC.  All rights
  *                         reserved. 
  * $COPYRIGHT$
  * 
         
     }
     
-    OBJ_CONSTRUCT(&mca_iof_tool_component.lock, opal_mutex_t);
     mca_iof_tool_component.closed = false;
     
     return ORTE_SUCCESS;
     int num_written;
     bool dump;
     
-    OPAL_THREAD_LOCK(&mca_iof_tool_component.lock);
-
-    OPAL_THREAD_LOCK(&orte_iof_base.iof_write_output_lock);
     /* check if anything is still trying to be written out */
     wev = orte_iof_base.iof_write_stdout->wev;
     if (!opal_list_is_empty(&wev->outputs)) {
         }
         OBJ_RELEASE(orte_iof_base.iof_write_stderr);
     }
-    OPAL_THREAD_UNLOCK(&orte_iof_base.iof_write_output_lock);
     
     /* Cancel the RML receive */
     rc = orte_rml.recv_cancel(ORTE_NAME_WILDCARD, ORTE_RML_TAG_IOF_PROXY);
-    OPAL_THREAD_UNLOCK(&mca_iof_tool_component.lock);
-    OBJ_DESTRUCT(&mca_iof_tool_component.lock);
     
     return rc;
 }

orte/mca/iof/tool/iof_tool.h

 struct orte_iof_tool_component_t { 
     orte_iof_base_component_t super;
     bool closed;
-    opal_mutex_t lock;
 };
 typedef struct orte_iof_tool_component_t orte_iof_tool_component_t;
 

orte/mca/routed/base/base.h

 /*
- * Copyright (c) 2007      Los Alamos National Security, LLC.
+ * Copyright (c) 2007-2013 Los Alamos National Security, LLC.
  *                         All rights reserved. 
  * $COPYRIGHT$
  * 
 
 #include "opal/class/opal_pointer_array.h"
 #include "opal/dss/dss_types.h"
-#include "opal/threads/threads.h"
 
 #include "orte/mca/rml/rml_types.h"
 #include "orte/mca/routed/routed.h"
 
 ORTE_DECLSPEC extern int orte_routed_base_output;
 ORTE_DECLSPEC extern opal_list_t orte_routed_base_components;
-ORTE_DECLSPEC extern opal_mutex_t orte_routed_base_lock;
-ORTE_DECLSPEC extern opal_condition_t orte_routed_base_cond;
 ORTE_DECLSPEC extern bool orte_routed_base_wait_sync;
 ORTE_DECLSPEC extern opal_pointer_array_t orte_routed_jobfams;
 

orte/mca/routed/base/routed_base_components.c

 /*
- * Copyright (c) 2007      Los Alamos National Security, LLC.
+ * Copyright (c) 2007-2013 Los Alamos National Security, LLC.
  *                         All rights reserved. 
  * Copyright (c) 2007      Sun Microsystems, Inc.  All rights reserved.
  * Copyright (c) 2004-2010 The Trustees of Indiana University.
 int orte_routed_base_output = -1;
 orte_routed_module_t orte_routed = {0};
 opal_list_t orte_routed_base_components;
-opal_mutex_t orte_routed_base_lock;
-opal_condition_t orte_routed_base_cond;
 bool orte_routed_base_wait_sync;
 opal_pointer_array_t orte_routed_jobfams;
 
     
     /* setup the output stream */
     orte_routed_base_output = opal_output_open(NULL);
-    OBJ_CONSTRUCT(&orte_routed_base_lock, opal_mutex_t);
-    OBJ_CONSTRUCT(&orte_routed_base_cond, opal_condition_t);
     orte_routed_base_wait_sync = false;
     
     /* Initialize globals */
     OBJ_DESTRUCT(&orte_routed_jobfams);
 
     OBJ_DESTRUCT(&orte_routed_base_components);
-    OBJ_DESTRUCT(&orte_routed_base_lock);
-    OBJ_DESTRUCT(&orte_routed_base_cond);
 
     /* Close the framework output */
     opal_output_close (orte_routed_base_output);

orte/mca/routed/direct/routed_direct.c

 #include "orte_config.h"
 #include "orte/constants.h"
 
-#include "opal/threads/condition.h"
 #include "opal/dss/dss_types.h"
 #include "opal/util/output.h"
 
 #endif
 };
 
-/* local globals */
-static opal_condition_t         cond;
-static opal_mutex_t             lock;
-
-
 static int init(void)
 {
-    /* setup the global condition and lock */
-    OBJ_CONSTRUCT(&cond, opal_condition_t);
-    OBJ_CONSTRUCT(&lock, opal_mutex_t);
-
     return ORTE_SUCCESS;
 }
 
         }
     }
     
-    /* destruct the global condition and lock */
-    OBJ_DESTRUCT(&cond);
-    OBJ_DESTRUCT(&lock);
-
     return ORTE_SUCCESS;
 }
 

orte/tools/orterun/orterun.c

  *                         All rights reserved.
  * Copyright (c) 2006-2012 Cisco Systems, Inc.  All rights reserved.
  * Copyright (c) 2007-2009 Sun Microsystems, Inc. All rights reserved.
- * Copyright (c) 2007-2012 Los Alamos National Security, LLC.  All rights
+ * Copyright (c) 2007-2013 Los Alamos National Security, LLC.  All rights
  *                         reserved. 
  * $COPYRIGHT$
  *
 {
     /* Only CONSTRUCT things once */
     if (!globals_init) {
-        OBJ_CONSTRUCT(&orterun_globals.lock, opal_mutex_t);
         orterun_globals.env_val =     NULL;
         orterun_globals.appfile =     NULL;
         orterun_globals.wdir =        NULL;

orte/tools/orterun/orterun.h

  * Copyright (c) 2004-2005 The Regents of the University of California.
  *                         All rights reserved.
  * Copyright (c) 2007-2011 Cisco Systems, Inc.  All rights reserved.
- * Copyright (c) 2012      Los Alamos National Security, LLC.
+ * Copyright (c) 2012-2013 Los Alamos National Security, LLC.
  *                         All rights reserved
  * $COPYRIGHT$
  * 
 #define ORTERUN_ORTERUN_H
 
 #include "orte_config.h"
-#include "opal/threads/mutex.h"
 
 BEGIN_C_DECLS
 
     bool set_cwd_to_session_dir;
     char *path;
     char *preload_files;
-    opal_mutex_t lock;
     bool sleep;
     char *ompi_server;
     bool wait_for_server;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.