1
1

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.

This commit was SVN r28053.
Этот коммит содержится в:
Ralph Castain 2013-02-13 01:53:12 +00:00
родитель 504a6d036f
Коммит 744ed49b2d
17 изменённых файлов: 22 добавлений и 107 удалений

Просмотреть файл

@ -30,8 +30,6 @@
#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"

Просмотреть файл

@ -26,7 +26,6 @@
#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"
@ -213,7 +212,6 @@ static void allgather_recv(int status, orte_process_name_t* sender,
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);
@ -232,7 +230,6 @@ static void allgather_recv(int status, orte_process_name_t* sender,
*/
opal_condition_broadcast(&coll->cond);
}
OPAL_THREAD_UNLOCK(&coll->lock);
}
static int hier_allgather(opal_buffer_t *sbuf, opal_buffer_t *rbuf)
@ -309,12 +306,10 @@ 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))) {
@ -335,29 +330,23 @@ static int hier_allgather(opal_buffer_t *sbuf, opal_buffer_t *rbuf)
/* 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!
@ -372,14 +361,10 @@ static int hier_allgather(opal_buffer_t *sbuf, opal_buffer_t *rbuf)
/* 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);

Просмотреть файл

@ -10,7 +10,7 @@
* 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$
*
@ -126,7 +126,6 @@ struct orte_iof_base_t {
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;
};

Просмотреть файл

@ -204,7 +204,6 @@ int orte_iof_base_open(void)
/* 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? */

Просмотреть файл

@ -11,7 +11,7 @@
* 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$
*
@ -113,7 +113,6 @@ static int init(void)
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;
@ -474,6 +473,9 @@ int hnp_ft_event(int state) {
}
/* 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;
@ -487,8 +489,6 @@ static void stdin_write_handler(int fd, short event, void *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))) {
@ -512,7 +512,7 @@ static void stdin_write_handler(int fd, short event, void *cbdata)
/* 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,
@ -539,7 +539,7 @@ static void stdin_write_handler(int fd, short event, void *cbdata)
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",
@ -582,10 +582,6 @@ CHECK:
opal_event_add(mca_iof_hnp_component.stdinev->ev, 0);
}
}
DEPART:
/* unlock and go */
OPAL_THREAD_UNLOCK(&mca_iof_hnp_component.lock);
}
/**

Просмотреть файл

@ -64,7 +64,6 @@ struct orte_iof_hnp_component_t {
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;

Просмотреть файл

@ -10,7 +10,7 @@
* 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$
*
@ -100,8 +100,6 @@ void orte_iof_hnp_read_local_handler(int fd, short event, void *cbdata)
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));
@ -120,7 +118,6 @@ void orte_iof_hnp_read_local_handler(int fd, short event, void *cbdata)
/* non-blocking, retry */
if (EAGAIN == errno || EINTR == errno) {
opal_event_add(rev->ev, 0);
OPAL_THREAD_UNLOCK(&mca_iof_hnp_component.lock);
return;
}
@ -146,7 +143,6 @@ void orte_iof_hnp_read_local_handler(int fd, short event, void *cbdata)
*/
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 */
@ -178,7 +174,6 @@ void orte_iof_hnp_read_local_handler(int fd, short event, void *cbdata)
OPAL_OUTPUT_VERBOSE((1, orte_iof_base.iof_output,
"buffer backed up - holding"));
OPAL_THREAD_UNLOCK(&mca_iof_hnp_component.lock);
return;
}
}
@ -223,7 +218,6 @@ void orte_iof_hnp_read_local_handler(int fd, short event, void *cbdata)
}
}
/* nothing more to do */
OPAL_THREAD_UNLOCK(&mca_iof_hnp_component.lock);
return;
}
@ -295,7 +289,6 @@ void orte_iof_hnp_read_local_handler(int fd, short event, void *cbdata)
break;
}
}
OPAL_THREAD_UNLOCK(&mca_iof_hnp_component.lock);
return;
}
@ -336,6 +329,5 @@ void orte_iof_hnp_read_local_handler(int fd, short event, void *cbdata)
/* re-add the event */
opal_event_add(rev->ev, 0);
OPAL_THREAD_UNLOCK(&mca_iof_hnp_component.lock);
return;
}

Просмотреть файл

@ -10,7 +10,7 @@
* 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$
*
@ -106,7 +106,6 @@ static int init(void)
}
/* 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;
@ -282,12 +281,10 @@ static int orted_close(const orte_process_name_t* peer,
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);
@ -305,7 +302,6 @@ static int orted_close(const orte_process_name_t* peer,
break;
}
}
OPAL_THREAD_UNLOCK(&mca_iof_orted_component.lock);
return ORTE_SUCCESS;
}
@ -315,7 +311,6 @@ static int finalize(void)
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);
}
@ -326,8 +321,6 @@ static int finalize(void)
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;
}
@ -353,8 +346,6 @@ static void stdin_write_handler(int fd, short event, void *cbdata)
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))) {
@ -368,7 +359,7 @@ static void stdin_write_handler(int fd, short event, void *cbdata)
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,
@ -400,7 +391,7 @@ static void stdin_write_handler(int fd, short event, void *cbdata)
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",
@ -436,8 +427,4 @@ CHECK:
orte_iof_orted_send_xonxoff(ORTE_IOF_XON);
}
}
DEPART:
/* unlock and go */
OPAL_THREAD_UNLOCK(&mca_iof_orted_component.lock);
}

Просмотреть файл

@ -63,7 +63,6 @@ struct orte_iof_orted_component_t {
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;

Просмотреть файл

@ -10,7 +10,7 @@
* 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$
*
@ -66,8 +66,6 @@ void orte_iof_orted_read_handler(int fd, short event, void *cbdata)
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__)
@ -92,7 +90,6 @@ void orte_iof_orted_read_handler(int fd, short event, void *cbdata)
if (EAGAIN == errno || EINTR == errno) {
/* non-blocking, retry */
opal_event_add(rev->ev, 0);
OPAL_THREAD_UNLOCK(&mca_iof_orted_component.lock);
return;
}
@ -169,7 +166,6 @@ void orte_iof_orted_read_handler(int fd, short event, void *cbdata)
/* re-add the event */
opal_event_add(rev->ev, 0);
OPAL_THREAD_UNLOCK(&mca_iof_orted_component.lock);
return;
CLEAN_RETURN:
@ -214,6 +210,5 @@ void orte_iof_orted_read_handler(int fd, short event, void *cbdata)
if (NULL != buf) {
OBJ_RELEASE(buf);
}
OPAL_THREAD_UNLOCK(&mca_iof_orted_component.lock);
return;
}

Просмотреть файл

@ -10,7 +10,7 @@
* 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$
*
@ -84,7 +84,6 @@ static int init(void)
}
OBJ_CONSTRUCT(&mca_iof_tool_component.lock, opal_mutex_t);
mca_iof_tool_component.closed = false;
return ORTE_SUCCESS;
@ -232,9 +231,6 @@ static int finalize(void)
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)) {
@ -273,12 +269,9 @@ static int finalize(void)
}
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;
}

Просмотреть файл

@ -42,7 +42,6 @@ BEGIN_C_DECLS
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;

Просмотреть файл

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007 Los Alamos National Security, LLC.
* Copyright (c) 2007-2013 Los Alamos National Security, LLC.
* All rights reserved.
* $COPYRIGHT$
*
@ -17,7 +17,6 @@
#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"
@ -37,8 +36,6 @@ ORTE_DECLSPEC int orte_routed_base_close(void);
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;

Просмотреть файл

@ -1,5 +1,5 @@
/*
* 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.
@ -79,8 +79,6 @@ OBJ_CLASS_INSTANCE(orte_routed_jobfam_t, opal_object_t,
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;
@ -102,8 +100,6 @@ orte_routed_base_open(void)
/* 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 */
@ -200,8 +196,6 @@ orte_routed_base_close(void)
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);

Просмотреть файл

@ -14,7 +14,6 @@
#include "orte_config.h"
#include "orte/constants.h"
#include "opal/threads/condition.h"
#include "opal/dss/dss_types.h"
#include "opal/util/output.h"
@ -71,17 +70,8 @@ orte_routed_module_t orte_routed_direct_module = {
#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;
}
@ -96,10 +86,6 @@ static int finalize(void)
}
}
/* destruct the global condition and lock */
OBJ_DESTRUCT(&cond);
OBJ_DESTRUCT(&lock);
return ORTE_SUCCESS;
}

Просмотреть файл

@ -12,7 +12,7 @@
* 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$
*
@ -1051,7 +1051,6 @@ static int init_globals(void)
{
/* 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;

Просмотреть файл

@ -10,7 +10,7 @@
* 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$
*
@ -23,7 +23,6 @@
#define ORTERUN_ORTERUN_H
#include "orte_config.h"
#include "opal/threads/mutex.h"
BEGIN_C_DECLS
@ -50,7 +49,6 @@ struct orterun_globals_t {
bool set_cwd_to_session_dir;
char *path;
char *preload_files;
opal_mutex_t lock;
bool sleep;
char *ompi_server;
bool wait_for_server;