1
1

Remove stale code associated with OPAL_THREADS_HAVE_DIFFERENT_PIDS. In the past, we have supported the case of really, really old Linux kernels where threads have different pids. However, when we updated the event library, we didn't also update that support code. In addition, when we dropped progress thread support, we didn't remove areas of the code that could no longer be compiled (i.e., were protected by "if progress thread && if have different pids).

There was no compelling reason to support such old kernels. Accordingly, convert the test to print a nice error message indicating we no longer support old kernels (but indicate that earlier OMPI versions do) and error out. Remove all code that was protected by "if have different pids" since it can no longer be compiled.

This commit was SVN r24531.
Этот коммит содержится в:
Ralph Castain 2011-03-15 21:05:03 +00:00
родитель 7eede54b39
Коммит d5dfe05521
8 изменённых файлов: 37 добавлений и 405 удалений

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

@ -9,7 +9,7 @@ dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
@ -26,8 +26,9 @@ AC_DEFUN([OMPI_CHECK_PTHREAD_PIDS],[
# Sets:
# OPAL_THREADS_HAVE_DIFFERENT_PIDS (variable)
#
# Test for Linux-like threads in the system. We will need to handle things like
# getpid() differently in the case of a Linux-like threads model.
# Test for Linux-like threads in the system. OPAL no longer supports
# systems with different PIDs for threads in the same process, so error
# out if we detect that case.
#
AC_MSG_CHECKING([if threads have different pids (pthreads on linux)])
@ -65,8 +66,29 @@ void *checkpid(void *arg) {
[MSG=yes OPAL_THREADS_HAVE_DIFFERENT_PIDS=1],
[case $host in
*-linux*)
MSG="cross compiling - assuming yes"
# We don't know exactly when (and I really don't feel like
# checking, because this is such a small case), but somewhere
# along the line, Linux stopped using different PIDs for
# threads. So rule that if we're <=2.6.9 (i.e., RHEL4), then
# the PIDs are different. If above that version, they're the
# same.
linux_ver=`uname -a | awk '{ print [$]3 }'`
linux_ver_major=`echo $linux_ver | cut -d. -f1`
linux_ver_minor=`echo $linux_ver | cut -d. -f2`
linux_ver_rel=`echo $linux_ver | cut -d. -f3 | cut -d- -f1`
OPAL_THREADS_HAVE_DIFFERENT_PIDS=1
MSG="cross compiling - assuming yes"
if test "$linux_ver_major" -gt 2; then
OPAL_THREADS_HAVE_DIFFERENT_PIDS=0
MSG="cross compiling and Linux version >= 2.x.x - assuming no"
elif test "$linux_ver_major" -eq 2 -a "$linux_ver_minor" -gt 6; then
MSG="cross compiling and Linux version >= 2.6.x - assuming no"
elif test "$linux_ver_major" -eq 2 -a "$linux_ver_minor" -eq 6 -a "$linux_ver_rel" -gt 9; then
MSG="cross compiling and Linux version >= 2.6.9 - assuming no"
fi
;;
*)
MSG="cross compiling - assuming no"
@ -81,7 +103,15 @@ LDFLAGS="$LDFLAGS_save"
LIBS="$LIBS_save"
AC_MSG_RESULT([$MSG])
AC_DEFINE_UNQUOTED(OPAL_THREADS_HAVE_DIFFERENT_PIDS, $OPAL_THREADS_HAVE_DIFFERENT_PIDS)
AS_IF([test "$OPAL_THREADS_HAVE_DIFFERENT_PIDS" = "1"],
[AC_MSG_WARN([This version of Open MPI only supports when threads have])
AC_MSG_WARN([the same PID. Please use an older version of Open MPI])
AC_MSG_WARN([if you need support on systems with different PIDs for])
AC_MSG_WARN([threads in the same process. Open MPI 1.4.x supports such])
AC_MSG_WARN([ systems, as does at least some versions the Open MPI])
AC_MSG_WARN([1.5.x series.])
AC_MSG_ERROR([Cannot continue])
])
#
# if pthreads is not available, then the system does not have an insane threads

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

@ -117,13 +117,9 @@ AC_MSG_RESULT($THREAD_TYPE)
#
# Blah - this should be made better, but I don't know how...
#
AH_TEMPLATE([OPAL_THREADS_HAVE_DIFFERENT_PIDS],
[Do threads have different pids (pthreads on linux)])
if test "$THREAD_TYPE" = "solaris"; then
AC_DEFINE(OPAL_HAVE_SOLARIS_THREADS, 1)
AC_DEFINE(OPAL_HAVE_POSIX_THREADS, 0)
AC_DEFINE(OPAL_THREADS_HAVE_DIFFERENT_PIDS, 0)
THREAD_CFLAGS="$STHREAD_CFLAGS"
THREAD_FFLAGS="$STHREAD_FFLAGS"
@ -148,7 +144,6 @@ elif test "$THREAD_TYPE" = "posix"; then
else
AC_DEFINE(OPAL_HAVE_SOLARIS_THREADS, 0)
AC_DEFINE(OPAL_HAVE_POSIX_THREADS, 0)
AC_DEFINE(OPAL_THREADS_HAVE_DIFFERENT_PIDS, 0)
TRHEAD_CFLAGS=
THREAD_FFLAGS=

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

@ -97,10 +97,6 @@
#define rindex(a,b) strrchr((a),(b))
#if OPAL_HAVE_POSIX_THREADS && OPAL_THREADS_HAVE_DIFFERENT_PIDS && ORTE_ENABLE_PROGRESS_THREADS
static int orte_plm_process_launch_threaded(orte_jobid_t jobid);
#endif
/*
* Interface
*/
@ -112,11 +108,7 @@ static int orte_plm_process_signal_job(orte_jobid_t, int32_t);
orte_plm_base_module_t orte_plm_process_module = {
orte_plm_process_init,
orte_plm_base_set_hnp_name,
#if OPAL_HAVE_POSIX_THREADS && OPAL_THREADS_HAVE_DIFFERENT_PIDS && ORTE_ENABLE_PROGRESS_THREADS
orte_plm_process_launch_threaded,
#else
orte_plm_process_launch,
#endif
NULL,
orte_plm_base_orted_terminate_job,
orte_plm_process_terminate_orteds,
@ -1426,80 +1418,6 @@ int orte_plm_process_finalize(void)
return rc;
}
/**
* Handle threading issues.
*/
#if OPAL_HAVE_POSIX_THREADS && OPAL_THREADS_HAVE_DIFFERENT_PIDS && ORTE_ENABLE_PROGRESS_THREADS
struct orte_plm_process_stack_t {
opal_condition_t cond;
opal_mutex_t mutex;
bool complete;
orte_jobid_t jobid;
int rc;
};
typedef struct orte_plm_process_stack_t orte_plm_process_stack_t;
static void orte_plm_process_stack_construct(orte_plm_process_stack_t* stack)
{
OBJ_CONSTRUCT(&stack->mutex, opal_mutex_t);
OBJ_CONSTRUCT(&stack->cond, opal_condition_t);
stack->rc = 0;
stack->complete = false;
}
static void orte_plm_process_stack_destruct(orte_plm_process_stack_t* stack)
{
OBJ_DESTRUCT(&stack->mutex);
OBJ_DESTRUCT(&stack->cond);
}
static OBJ_CLASS_INSTANCE(
orte_plm_process_stack_t,
opal_object_t,
orte_plm_process_stack_construct,
orte_plm_process_stack_destruct);
static void orte_plm_process_launch_cb(int fd, short event, void* args)
{
orte_plm_process_stack_t *stack = (orte_plm_process_stack_t*)args;
OPAL_THREAD_LOCK(&stack->mutex);
stack->rc = orte_plm_process_launch(stack->jobid);
stack->complete = true;
opal_condition_signal(&stack->cond);
OPAL_THREAD_UNLOCK(&stack->mutex);
}
static int orte_plm_process_launch_threaded(orte_jobid_t jobid)
{
struct timeval tv = { 0, 0 };
opal_event_t event;
struct orte_plm_process_stack_t stack;
OBJ_CONSTRUCT(&stack, orte_plm_process_stack_t);
stack.jobid = jobid;
if( opal_event_progress_thread() ) {
stack.rc = orte_plm_process_launch( jobid );
} else {
opal_event_evtimer_set(opal_event_base, &event, orte_plm_process_launch_cb, &stack);
opal_event_evtimer_add(&event, &tv);
OPAL_THREAD_LOCK(&stack.mutex);
while (stack.complete == false) {
opal_condition_wait(&stack.cond, &stack.mutex);
}
OPAL_THREAD_UNLOCK(&stack.mutex);
}
OBJ_DESTRUCT(&stack);
return stack.rc;
}
#endif
static void set_handler_default(int sig)
{
OPAL_TRACE(1);

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

@ -91,10 +91,6 @@
#include "orte/mca/plm/base/plm_private.h"
#include "orte/mca/plm/rsh/plm_rsh.h"
#if OPAL_HAVE_POSIX_THREADS && OPAL_THREADS_HAVE_DIFFERENT_PIDS && ORTE_ENABLE_PROGRESS_THREADS
static int orte_plm_rsh_launch_threaded(orte_job_t *jdata);
#endif
static void ssh_child(int argc, char **argv,
orte_vpid_t vpid, int proc_vpid_index)
__opal_attribute_noreturn__;
@ -104,11 +100,7 @@ static int remote_spawn(opal_buffer_t *launch);
orte_plm_base_module_t orte_plm_rsh_module = {
orte_plm_rsh_init,
orte_plm_base_set_hnp_name,
#if OPAL_HAVE_POSIX_THREADS && OPAL_THREADS_HAVE_DIFFERENT_PIDS && ORTE_ENABLE_PROGRESS_THREADS
orte_plm_rsh_launch_threaded,
#else
orte_plm_rsh_launch,
#endif
remote_spawn,
orte_plm_base_orted_terminate_job,
orte_plm_rsh_terminate_orteds,
@ -1512,79 +1504,6 @@ int orte_plm_rsh_finalize(void)
}
/**
* Handle threading issues.
*/
#if OPAL_HAVE_POSIX_THREADS && OPAL_THREADS_HAVE_DIFFERENT_PIDS && ORTE_ENABLE_PROGRESS_THREADS
struct orte_plm_rsh_stack_t {
opal_condition_t cond;
opal_mutex_t mutex;
bool complete;
orte_jobid_t jobid;
int rc;
};
typedef struct orte_plm_rsh_stack_t orte_plm_rsh_stack_t;
static void orte_plm_rsh_stack_construct(orte_plm_rsh_stack_t* stack)
{
OBJ_CONSTRUCT(&stack->mutex, opal_mutex_t);
OBJ_CONSTRUCT(&stack->cond, opal_condition_t);
stack->rc = 0;
stack->complete = false;
}
static void orte_plm_rsh_stack_destruct(orte_plm_rsh_stack_t* stack)
{
OBJ_DESTRUCT(&stack->mutex);
OBJ_DESTRUCT(&stack->cond);
}
static OBJ_CLASS_INSTANCE(
orte_plm_rsh_stack_t,
opal_object_t,
orte_plm_rsh_stack_construct,
orte_plm_rsh_stack_destruct);
static void orte_plm_rsh_launch_cb(int fd, short event, void* args)
{
orte_plm_rsh_stack_t *stack = (orte_plm_rsh_stack_t*)args;
OPAL_THREAD_LOCK(&stack->mutex);
stack->rc = orte_plm_rsh_launch(stack->jobid);
stack->complete = true;
opal_condition_signal(&stack->cond);
OPAL_THREAD_UNLOCK(&stack->mutex);
}
static int orte_plm_rsh_launch_threaded(orte_jobid_t jobid)
{
struct timeval tv = { 0, 0 };
opal_event_t event;
struct orte_plm_rsh_stack_t stack;
OBJ_CONSTRUCT(&stack, orte_plm_rsh_stack_t);
stack.jobid = jobid;
if( opal_event_progress_thread() ) {
stack.rc = orte_plm_rsh_launch( jobid );
} else {
opal_evtimer_set(opal_event_base, &event, orte_plm_rsh_launch_cb, &stack);
opal_evtimer_add(&event, &tv);
OPAL_THREAD_LOCK(&stack.mutex);
while (stack.complete == false) {
opal_condition_wait(&stack.cond, &stack.mutex);
}
OPAL_THREAD_UNLOCK(&stack.mutex);
}
OBJ_DESTRUCT(&stack);
return stack.rc;
}
#endif
static void set_handler_default(int sig)
{
struct sigaction act;

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

@ -90,20 +90,12 @@
#include "orte/mca/plm/base/plm_private.h"
#include "orte/mca/plm/rshd/plm_rshd.h"
#if OPAL_HAVE_POSIX_THREADS && OPAL_THREADS_HAVE_DIFFERENT_PIDS && ORTE_ENABLE_PROGRESS_THREADS
static int orte_plm_rshd_launch_threaded(orte_job_t *jdata);
#endif
static void ssh_child(char *cmd, char **argv) __opal_attribute_noreturn__;
orte_plm_base_module_t orte_plm_rshd_module = {
orte_plm_rshd_init,
orte_plm_base_set_hnp_name,
#if OPAL_HAVE_POSIX_THREADS && OPAL_THREADS_HAVE_DIFFERENT_PIDS && ORTE_ENABLE_PROGRESS_THREADS
orte_plm_rshd_launch_threaded,
#else
orte_plm_rshd_launch,
#endif
NULL,
orte_plm_rshd_terminate_job,
orte_plm_rshd_terminate_orteds,
@ -421,79 +413,6 @@ int orte_plm_rshd_finalize(void)
}
/**
* Handle threading issues.
*/
#if OPAL_HAVE_POSIX_THREADS && OPAL_THREADS_HAVE_DIFFERENT_PIDS && ORTE_ENABLE_PROGRESS_THREADS
struct orte_plm_rshd_stack_t {
opal_condition_t cond;
opal_mutex_t mutex;
bool complete;
orte_jobid_t jobid;
int rc;
};
typedef struct orte_plm_rshd_stack_t orte_plm_rshd_stack_t;
static void orte_plm_rshd_stack_construct(orte_plm_rshd_stack_t* stack)
{
OBJ_CONSTRUCT(&stack->mutex, opal_mutex_t);
OBJ_CONSTRUCT(&stack->cond, opal_condition_t);
stack->rc = 0;
stack->complete = false;
}
static void orte_plm_rshd_stack_destruct(orte_plm_rshd_stack_t* stack)
{
OBJ_DESTRUCT(&stack->mutex);
OBJ_DESTRUCT(&stack->cond);
}
static OBJ_CLASS_INSTANCE(
orte_plm_rshd_stack_t,
opal_object_t,
orte_plm_rshd_stack_construct,
orte_plm_rshd_stack_destruct);
static void orte_plm_rshd_launch_cb(int fd, short event, void* args)
{
orte_plm_rshd_stack_t *stack = (orte_plm_rshd_stack_t*)args;
OPAL_THREAD_LOCK(&stack->mutex);
stack->rc = orte_plm_rshd_launch(stack->jobid);
stack->complete = true;
opal_condition_signal(&stack->cond);
OPAL_THREAD_UNLOCK(&stack->mutex);
}
static int orte_plm_rshd_launch_threaded(orte_jobid_t jobid)
{
struct timeval tv = { 0, 0 };
opal_event_t event;
struct orte_plm_rshd_stack_t stack;
OBJ_CONSTRUCT(&stack, orte_plm_rshd_stack_t);
stack.jobid = jobid;
if( opal_event_progress_thread() ) {
stack.rc = orte_plm_rshd_launch( jobid );
} else {
opal_evtimer_set(opal_event_base, &event, orte_plm_rshd_launch_cb, &stack);
opal_evtimer_add(&event, &tv);
OPAL_THREAD_LOCK(&stack.mutex);
while (stack.complete == false) {
opal_condition_wait(&stack.cond, &stack.mutex);
}
OPAL_THREAD_UNLOCK(&stack.mutex);
}
OBJ_DESTRUCT(&stack);
return stack.rc;
}
#endif
static void set_handler_default(int sig)
{
struct sigaction act;

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

@ -79,19 +79,10 @@
static int orte_plm_submit_init(void);
#if OPAL_HAVE_POSIX_THREADS && OPAL_THREADS_HAVE_DIFFERENT_PIDS && ORTE_ENABLE_PROGRESS_THREADS
static int orte_plm_submit_launch_threaded(orte_jobid_t jobid);
#endif
orte_plm_base_module_t orte_plm_submit_module = {
orte_plm_submit_init,
orte_plm_base_set_hnp_name,
#if OPAL_HAVE_POSIX_THREADS && OPAL_THREADS_HAVE_DIFFERENT_PIDS && ORTE_ENABLE_PROGRESS_THREADS
orte_plm_submit_launch_threaded,
#else
orte_plm_submit_launch,
#endif
NULL,
orte_plm_base_orted_terminate_job,
orte_plm_submit_terminate_orteds,
@ -977,79 +968,6 @@ int orte_plm_submit_finalize(void)
}
/**
* Handle threading issues.
*/
#if OPAL_HAVE_POSIX_THREADS && OPAL_THREADS_HAVE_DIFFERENT_PIDS && ORTE_ENABLE_PROGRESS_THREADS
struct orte_plm_submit_stack_t {
opal_condition_t cond;
opal_mutex_t mutex;
bool complete;
orte_jobid_t jobid;
int rc;
};
typedef struct orte_plm_submit_stack_t orte_plm_submit_stack_t;
static void orte_plm_submit_stack_construct(orte_plm_submit_stack_t* stack)
{
OBJ_CONSTRUCT(&stack->mutex, opal_mutex_t);
OBJ_CONSTRUCT(&stack->cond, opal_condition_t);
stack->rc = 0;
stack->complete = false;
}
static void orte_plm_submit_stack_destruct(orte_plm_submit_stack_t* stack)
{
OBJ_DESTRUCT(&stack->mutex);
OBJ_DESTRUCT(&stack->cond);
}
static OBJ_CLASS_INSTANCE(
orte_plm_submit_stack_t,
opal_object_t,
orte_plm_submit_stack_construct,
orte_plm_submit_stack_destruct);
static void orte_plm_submit_launch_cb(int fd, short event, void* args)
{
orte_plm_submit_stack_t *stack = (orte_plm_submit_stack_t*)args;
OPAL_THREAD_LOCK(&stack->mutex);
stack->rc = orte_plm_submit_launch(stack->jobid);
stack->complete = true;
opal_condition_signal(&stack->cond);
OPAL_THREAD_UNLOCK(&stack->mutex);
}
static int orte_plm_submit_launch_threaded(orte_jobid_t jobid)
{
struct timeval tv = { 0, 0 };
opal_event_t event;
struct orte_plm_submit_stack_t stack;
OBJ_CONSTRUCT(&stack, orte_plm_submit_stack_t);
stack.jobid = jobid;
if( opal_event_progress_thread() ) {
stack.rc = orte_plm_submit_launch( jobid );
} else {
opal_evtimer_set(opal_event_base, &event, orte_plm_submit_launch_cb, &stack);
opal_evtimer_add(&event, &tv);
OPAL_THREAD_LOCK(&stack.mutex);
while (stack.complete == false) {
opal_condition_wait(&stack.cond, &stack.mutex);
}
OPAL_THREAD_UNLOCK(&stack.mutex);
}
OBJ_DESTRUCT(&stack);
return stack.rc;
}
#endif
static void set_handler_default(int sig)
{
struct sigaction act;

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

@ -241,10 +241,6 @@ static int register_callback(pid_t pid, orte_wait_fn_t callback,
void *data);
static int unregister_callback(pid_t pid);
void orte_wait_signal_callback(int fd, short event, void *arg);
static pid_t internal_waitpid(pid_t pid, int *status, int options);
#if OPAL_THREADS_HAVE_DIFFERENT_PIDS
static void internal_waitpid_callback(int fd, short event, void *arg);
#endif
/*********************************************************************
*
@ -418,7 +414,7 @@ orte_waitpid(pid_t wpid, int *status, int options)
} else {
/* non-blocking - return what waitpid would */
ret = internal_waitpid(wpid, status, options);
ret = waitpid(wpid, status, options);
}
cleanup:
@ -641,7 +637,7 @@ do_waitall(int options)
if (!cb_enabled) return;
while (1) {
int status;
pid_t ret = internal_waitpid(-1, &status, WNOHANG);
pid_t ret = waitpid(-1, &status, WNOHANG);
pending_pids_item_t *pending;
registered_cb_item_t *cb;
@ -718,64 +714,6 @@ unregister_callback(pid_t pid)
static pid_t
internal_waitpid(pid_t pid, int *status, int options)
{
#if OPAL_THREADS_HAVE_DIFFERENT_PIDS
waitpid_callback_data_t data;
struct timeval tv;
opal_event_t ev;
if (opal_event_progress_thread()) {
/* I already am the progress thread. no need to event me */
return waitpid(pid, status, options);
}
data.done = false;
data.pid = pid;
data.options = options;
OBJ_CONSTRUCT(&(data.mutex), opal_mutex_t);
OBJ_CONSTRUCT(&(data.cond), opal_condition_t);
OPAL_THREAD_LOCK(&(data.mutex));
tv.tv_sec = 0;
tv.tv_usec = 0;
opal_event_evtimer_set(opal_event_base, &ev, internal_waitpid_callback, &data);
opal_evtimer_add(&ev, &tv);
while (data.done == false) {
opal_condition_wait(&(data.cond), &(data.mutex));
}
OPAL_THREAD_UNLOCK(&(data.mutex));
OBJ_DESTRUCT(&(data.cond));
OBJ_DESTRUCT(&(data.mutex));
*status = data.status;
return data.ret;
#else
return waitpid(pid, status, options);
#endif
}
#if OPAL_THREADS_HAVE_DIFFERENT_PIDS
static void
internal_waitpid_callback(int fd, short event, void *arg)
{
waitpid_callback_data_t *data = (waitpid_callback_data_t*) arg;
data->ret = waitpid(data->pid, &(data->status), data->options);
data->done = true;
opal_condition_signal(&(data->cond));
}
#endif
#elif defined(__WINDOWS__)
/*********************************************************************

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

@ -45,11 +45,6 @@ int main(int argc, char *argv[])
pid_t pid, ret;
int status = -1;
#if OPAL_ENABLE_PROGRESS_THREADS && OPAL_THREADS_HAVE_DIFFERENT_PIDS
printf("test not properly configured when threads have different pids\n");
return 77;
#endif
orte_init(true);
pid = fork();