1
1

Continue clean up of thread options started in r22841, 22842, and 22849.

No need for any CMRs to 1.5... that was already done in CMR 2728.

This commit was SVN r24545.

The following SVN revision numbers were found above:
  r22841 --> open-mpi/ompi@b400b84162
Этот коммит содержится в:
Eugene Loh 2011-03-18 21:36:35 +00:00
родитель c34eed80c6
Коммит 2770a12beb
39 изменённых файлов: 125 добавлений и 127 удалений

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

@ -381,9 +381,10 @@ MPI Functionality and Features
- MPI_THREAD_MULTIPLE support is included, but is only lightly tested.
It likely does not work for thread-intensive applications. Note
that *only* the MPI point-to-point communication functions for the
BTL's listed above are considered thread safe. Other support
functions (e.g., MPI attributes) have not been certified as safe
when simultaneously used by multiple threads.
BTL's listed earlier (search for "MPI_THREAD_MULTIPLE support") are
considered thread safe. Other support functions (e.g., MPI attributes)
have not been certified as safe when simultaneously used by multiple
threads.
Note that Open MPI's thread support is in a fairly early stage; the
above devices are likely to *work*, but the latency is likely to be
@ -804,18 +805,17 @@ for a full list); a summary of the more commonly used ones follows:
--with-threads; this is currently disabled by default. Enabling
this feature will automatically --enable-opal-multi-threads.
--enable-opal-multi-threads
Enables thread lock support in the OPAL and ORTE layers. Does
not enable MPI_THREAD_MULTIPLE - see above option for that feature.
This is currently disabled by default.
--with-fca=<directory>
Specify the directory where the Voltaire FCA library and
header files are located.
FCA is the support library for Voltaire QDR switches.
--enable-opal-multi-threads
Enables thread lock support in the OPAL and ORTE layers. Does
not enable MPI_THREAD_MULTIPLE - see above option for that feature.
This is currently disabled by default.
--disable-mpi-cxx
Disable building the C++ MPI bindings. Note that this does *not*
disable the C++ checks during configure; some of Open MPI's tools

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

@ -200,15 +200,15 @@ OMPI_DEF_OPT(OPAL_ENABLE_MEM_PROFILE "Whether we want the memory profiling or no
OMPI_DEF_OPT(OMPI_ENABLE_MPI_PROFILING "Whether we want MPI profiling or not." ON)
OMPI_DEF_OPT(OMPI_ENABLE_THREAD_MULTIPLE "Enable MPI Thread Multiple." OFF)
OMPI_DEF_OPT(OMPI_ENABLE_THREAD_MULTIPLE "Enable MPI_THREAD_MULTIPLE." OFF)
OMPI_DEF(OMPI_ENABLE_PROGRESS_THREADS 0 "Hardcode the OMPI progress thread to be off." 0 1)
OMPI_DEF(OMPI_ENABLE_PROGRESS_THREADS 0 "Hardwire OMPI progress threads to be off." 0 1)
OMPI_DEF(ORTE_ENABLE_PROGRESS_THREADS 0 "Hardcode the ORTE progress thread to be off." 0 1)
OMPI_DEF(ORTE_ENABLE_PROGRESS_THREADS 0 "Hardwire ORTE progress threads to be off." 0 1)
OMPI_DEF_OPT(OPAL_ENABLE_MULTI_THREADS "Whether we should enable support for multiple user threads" OFF)
OMPI_DEF_OPT(OPAL_ENABLE_MULTI_THREADS "Whether we should enable OPAL thread support." OFF)
OMPI_DEF_OPT(OPAL_ENABLE_PTY_SUPPORT "Whether we should use progress threads rather than polling." OFF)
OMPI_DEF_OPT(OPAL_ENABLE_PTY_SUPPORT "Whether we should enable PTY support for STDIO forwarding." OFF)
OMPI_DEF_OPT ( OMPI_GROUP_SPARSE "Wether we want sparse process groups." OFF)

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

@ -30,23 +30,23 @@ AC_DEFUN([OMPI_CONFIG_THREADS],[
#
#
# Thread Multiple
# MPI_THREAD_MULTIPLE
#
# --enable-mpi-thread-multiple
# #if OMPI_ENABLE_THREAD_MULTIPLE == 0 /* Not available */
# #if OMPI_ENABLE_THREAD_MULTIPLE == 1 /* Available */
#
AC_MSG_CHECKING([if want MPI thread support])
AC_MSG_CHECKING([if want MPI_THREAD_MULTIPLE support])
AC_ARG_ENABLE([mpi_thread_multiple],
[AC_HELP_STRING([--enable-mpi-thread-multiple],
[Enable thread support for MPI applications (default: disabled)])],
[Enable MPI_THREAD_MULTIPLE support (default: disabled)])],
[enable_mpi_threads="$enableval"],
[enable_mpi_threads="undef"])
# if they did not want OPAL thread support, then they cannot have this option
if test "$enable_mpi_threads" = "yes" -a "$enable_opal_multi_threads" = "no"; then
AC_MSG_WARN(["failed"])
AC_MSG_WARN(["*** You have requested MPI thread multiple support but thread"])
AC_MSG_WARN(["*** You have requested MPI_THREAD_MULTIPLE support but thread"])
AC_MSG_WARN(["*** support was disabled within the OPAL code base by"])
AC_MSG_WARN(["*** --disable-opal-multi-threads on your configure command."])
AC_MSG_ERROR(["*** Can not continue."])
@ -66,7 +66,7 @@ elif test "$enable_mpi_threads" = "yes" -a "$enable_opal_multi_threads" = "undef
OPAL_ENABLE_MULTI_THREADS=1
enable_opal_multi_threads="yes"
AC_DEFINE_UNQUOTED([OPAL_ENABLE_MULTI_THREADS], [$OPAL_ENABLE_MULTI_THREADS],
[Whether we should enable support for multiple user threads])
[Whether we should enable thread support within the OPAL code base])
ompi_want_mpi_threads=1
OMPI_ENABLE_THREAD_MULTIPLE=1
AC_MSG_RESULT([Enabled - OPAL thread support automatically enabled])
@ -77,7 +77,7 @@ else
AC_MSG_RESULT([Disabled])
fi
AC_DEFINE_UNQUOTED([OMPI_ENABLE_THREAD_MULTIPLE], [$ompi_want_mpi_threads],
[Enable MPI Thread Multiple])
[Enable MPI_THREAD_MULTIPLE])
])dnl

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

@ -15,12 +15,12 @@
* #if conditionals). We also don't protect including <pthread.h>.
* That's because this component currently only compiles on Linux and
* Solaris, and both of these OS's have pthreads. Using the run-time
* conditionals gives us bettern compile-time checking, even of code
* conditionals gives us better compile-time checking, even of code
* that isn't activated.
*
* Note, too, that the functionality in this file does *not* require
* all the heavyweight OMPI thread infrastructure (e.g., from
* --enable-mpi-threads or --enable-progress-threads). All work that
* --enable-mpi-thread-multiple or --enable-progress-threads). All work that
* is done in a separate progress thread is very carefully segregated
* from that of the main thread, and communication back to the main
* thread

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

@ -24,7 +24,7 @@
OBJ_CLASS_INSTANCE(mca_mpool_base_selected_module_t, opal_list_item_t, NULL, NULL);
static bool mca_mpool_enable_progress_threads = true;
static bool mca_mpool_enable_mpi_threads = true;
static bool mca_mpool_enable_mpi_thread_multiple = true;
/**
* Function for weeding out mpool modules that don't want to run.
@ -34,10 +34,10 @@ static bool mca_mpool_enable_mpi_threads = true;
* will be closed and unloaded. The selected modules will be returned
* to the caller in a opal_list_t.
*/
int mca_mpool_base_init(bool enable_progress_threads, bool enable_mpi_threads)
int mca_mpool_base_init(bool enable_progress_threads, bool enable_mpi_thread_multiple)
{
mca_mpool_enable_progress_threads = enable_progress_threads;
mca_mpool_enable_mpi_threads = enable_mpi_threads;
mca_mpool_enable_mpi_thread_multiple = enable_mpi_thread_multiple;
return OMPI_SUCCESS;
}

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

@ -38,7 +38,7 @@
static int example_component_open(void);
static int example_component_close(void);
static int example_component_init_query(bool enable_progress_threads,
bool enable_mpi_threads);
bool enable_mpi_thread_multiple);
static struct ompi_op_base_module_1_0_0_t *
example_component_op_query(struct ompi_op_t *op, int *priority);
static int example_component_register(void);
@ -168,7 +168,7 @@ static int example_component_register(void)
* Query whether this component wants to be used in this process.
*/
static int example_component_init_query(bool enable_progress_threads,
bool enable_mpi_threads)
bool enable_mpi_thread_multiple)
{
opal_output(ompi_op_base_output, "example component init query");
@ -184,9 +184,9 @@ static int example_component_init_query(bool enable_progress_threads,
the MPI_Op component selection process.
The input parameters enable_progress_threads and
enable_mpi_threads also tell the component the following:
enable_mpi_thread_multiple also tell the component the following:
- If enable_process_threads==true, then the component is
- If enable_progress_threads==true, then the component is
allowed to have a progress thread in the background that is
supported by the OMPI infrastructure (i.e., all of OMPI's
locks and whatnot are active in this build). Note that the
@ -199,7 +199,7 @@ static int example_component_init_query(bool enable_progress_threads,
multi-threaded safe and whether multi-threading sync/IPC
mechanisms in the OMPI code base are active.
- If enable_mpi_threads==true, the MPI_THREAD_MULTIPLE is
- If enable_mpi_thread_multiple==true, then MPI_THREAD_MULTIPLE is
active.
Note that a component can uses these values to deactivate
@ -223,7 +223,7 @@ static int example_component_init_query(bool enable_progress_threads,
be called in the future for each intrinsic MPI_Op). Otherwise,
return OMPI_ERR_NOT_SUPPORTED (indicating that this component
will be closed and discarded). */
if (mca_op_example_component.hardware_available && !enable_mpi_threads) {
if (mca_op_example_component.hardware_available && !enable_mpi_thread_multiple) {
return OMPI_SUCCESS;
}
return OMPI_ERR_NOT_SUPPORTED;

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

@ -37,7 +37,7 @@
static inline int32_t
create_send_tag(ompi_osc_pt2pt_module_t *module)
{
#if OPAL_HAVE_THREAD_SUPPORT && OPAL_HAVE_ATOMIC_CMPSET_32
#if OPAL_ENABLE_MULTI_THREADS && OPAL_HAVE_ATOMIC_CMPSET_32
int32_t newval, oldval;
do {
oldval = module->p2p_tag_counter;

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

@ -42,7 +42,7 @@
static inline int32_t
create_send_tag(ompi_osc_rdma_module_t *module)
{
#if OPAL_HAVE_THREAD_SUPPORT && OPAL_HAVE_ATOMIC_CMPSET_32
#if OPAL_ENABLE_MULTI_THREADS && OPAL_HAVE_ATOMIC_CMPSET_32
int32_t newval, oldval;
do {
oldval = module->m_tag_counter;

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

@ -32,7 +32,7 @@ struct mca_pml_bfo_comm_proc_t {
opal_object_t super;
uint16_t expected_sequence; /**< send message sequence number - receiver side */
struct ompi_proc_t* ompi_proc;
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
volatile int32_t send_sequence; /**< send side sequence number */
#else
int32_t send_sequence; /**< send side sequence number */
@ -50,7 +50,7 @@ typedef struct mca_pml_bfo_comm_proc_t mca_pml_bfo_comm_proc_t;
*/
struct mca_pml_comm_t {
opal_object_t super;
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
volatile uint32_t recv_sequence; /**< recv request sequence number - receiver side */
#else
uint32_t recv_sequence; /**< recv request sequence number - receiver side */

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

@ -194,7 +194,7 @@ recv_request_pml_complete(mca_pml_bfo_recv_request_t *recvreq)
static inline bool
recv_request_pml_complete_check(mca_pml_bfo_recv_request_t *recvreq)
{
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
opal_atomic_rmb();
#endif
if(recvreq->req_match_received &&
@ -241,7 +241,7 @@ static inline void recv_req_matched(mca_pml_bfo_recv_request_t *req,
#if PML_BFO
req->req_msgseq = hdr->hdr_seq;
#endif /* PML_BFO */
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
opal_atomic_wmb();
#endif
if(req->req_recv.req_bytes_packed > 0) {

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

@ -263,7 +263,7 @@ send_request_pml_complete(mca_pml_bfo_send_request_t *sendreq)
static inline bool
send_request_pml_complete_check(mca_pml_bfo_send_request_t *sendreq)
{
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
opal_atomic_rmb();
#endif
/* if no more events are expected for the request and the whole message is

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

@ -31,7 +31,7 @@ struct mca_pml_csum_comm_proc_t {
opal_object_t super;
uint16_t expected_sequence; /**< send message sequence number - receiver side */
struct ompi_proc_t* ompi_proc;
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
volatile int32_t send_sequence; /**< send side sequence number */
#else
int32_t send_sequence; /**< send side sequence number */
@ -49,7 +49,7 @@ typedef struct mca_pml_csum_comm_proc_t mca_pml_csum_comm_proc_t;
*/
struct mca_pml_comm_t {
opal_object_t super;
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
volatile uint32_t recv_sequence; /**< recv request sequence number - receiver side */
#else
uint32_t recv_sequence; /**< recv request sequence number - receiver side */

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

@ -180,7 +180,7 @@ recv_request_pml_complete(mca_pml_csum_recv_request_t *recvreq)
static inline bool
recv_request_pml_complete_check(mca_pml_csum_recv_request_t *recvreq)
{
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
opal_atomic_rmb();
#endif
if(recvreq->req_match_received &&
@ -220,7 +220,7 @@ static inline void recv_req_matched(mca_pml_csum_recv_request_t *req,
req->req_recv.req_base.req_ompi.req_status.MPI_SOURCE = hdr->hdr_src;
req->req_recv.req_base.req_ompi.req_status.MPI_TAG = hdr->hdr_tag;
req->req_match_received = true;
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
opal_atomic_wmb();
#endif
if(req->req_recv.req_bytes_packed > 0) {

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

@ -257,7 +257,7 @@ send_request_pml_complete(mca_pml_csum_send_request_t *sendreq)
static inline bool
send_request_pml_complete_check(mca_pml_csum_send_request_t *sendreq)
{
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
opal_atomic_rmb();
#endif
/* if no more events are expected for the request and the whole message is

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

@ -32,7 +32,7 @@ BEGIN_C_DECLS
struct mca_pml_dr_comm_proc_t {
opal_object_t super;
uint16_t expected_sequence; /**< send message sequence number - receiver side */
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
volatile int32_t send_sequence; /**< send side sequence number */
#else
int32_t send_sequence; /**< send side sequence number */
@ -54,7 +54,7 @@ typedef struct mca_pml_dr_comm_proc_t mca_pml_dr_comm_proc_t;
*/
struct mca_pml_comm_t {
opal_object_t super;
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
volatile uint32_t recv_sequence; /**< recv request sequence number - receiver side */
#else
uint32_t recv_sequence; /**< recv request sequence number - receiver side */

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

@ -43,7 +43,7 @@ struct mca_pml_dr_send_request_t {
mca_pml_base_send_request_t req_send;
mca_pml_dr_comm_proc_t* req_proc;
mca_pml_dr_endpoint_t* req_endpoint;
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
volatile int32_t req_state;
volatile int32_t req_lock;
#else

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

@ -31,7 +31,7 @@ struct mca_pml_ob1_comm_proc_t {
opal_object_t super;
uint16_t expected_sequence; /**< send message sequence number - receiver side */
struct ompi_proc_t* ompi_proc;
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
volatile int32_t send_sequence; /**< send side sequence number */
#else
int32_t send_sequence; /**< send side sequence number */
@ -49,7 +49,7 @@ typedef struct mca_pml_ob1_comm_proc_t mca_pml_ob1_comm_proc_t;
*/
struct mca_pml_comm_t {
opal_object_t super;
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
volatile uint32_t recv_sequence; /**< recv request sequence number - receiver side */
#else
uint32_t recv_sequence; /**< recv request sequence number - receiver side */

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

@ -179,7 +179,7 @@ recv_request_pml_complete(mca_pml_ob1_recv_request_t *recvreq)
static inline bool
recv_request_pml_complete_check(mca_pml_ob1_recv_request_t *recvreq)
{
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
opal_atomic_rmb();
#endif
if(recvreq->req_match_received &&
@ -219,7 +219,7 @@ static inline void recv_req_matched(mca_pml_ob1_recv_request_t *req,
req->req_recv.req_base.req_ompi.req_status.MPI_SOURCE = hdr->hdr_src;
req->req_recv.req_base.req_ompi.req_status.MPI_TAG = hdr->hdr_tag;
req->req_match_received = true;
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
opal_atomic_wmb();
#endif
if(req->req_recv.req_bytes_packed > 0) {

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

@ -254,7 +254,7 @@ send_request_pml_complete(mca_pml_ob1_send_request_t *sendreq)
static inline bool
send_request_pml_complete_check(mca_pml_ob1_send_request_t *sendreq)
{
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
opal_atomic_rmb();
#endif
/* if no more events are expected for the request and the whole message is

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

@ -25,7 +25,7 @@ static int mca_pml_v_component_open(void);
static int mca_pml_v_component_close(void);
static int mca_pml_v_component_parasite_close(void);
static mca_pml_base_module_t *mca_pml_v_component_init(int* priority, bool enable_threads, bool enable_progress_threads);
static mca_pml_base_module_t *mca_pml_v_component_init(int* priority, bool enable_progress_threads, bool enable_mpi_thread_multiple);
static int mca_pml_v_component_finalize(void);
static int mca_pml_v_component_parasite_finalize(void);
@ -56,7 +56,7 @@ mca_pml_base_component_2_0_0_t mca_pml_v_component =
};
static bool pml_v_enable_progress_treads = OMPI_ENABLE_PROGRESS_THREADS;
static bool pml_v_enable_mpi_threads = OMPI_ENABLE_THREAD_MULTIPLE;
static bool pml_v_enable_mpi_thread_multiple = OMPI_ENABLE_THREAD_MULTIPLE;
/*******************************************************************************
* MCA level functions - parasite setup
@ -161,12 +161,12 @@ static int mca_pml_v_component_parasite_close(void)
*/
static mca_pml_base_module_t *mca_pml_v_component_init(int *priority,
bool enable_progress_threads,
bool enable_mpi_threads)
bool enable_mpi_thread_multiple)
{
V_OUTPUT_VERBOSE(1, "init: I'm not supposed to be here until BTL loading stuff gets fixed!? That's strange...");
pml_v_enable_progress_treads = enable_progress_threads;
pml_v_enable_mpi_threads = enable_mpi_threads;
pml_v_enable_mpi_thread_multiple = enable_mpi_thread_multiple;
/* I NEVER want to be the selected PML, so I report less than possible
* priority and a NULL module
@ -202,7 +202,7 @@ static int mca_pml_v_enable(bool enable)
/* Check if a protocol have been selected during init */
if(! mca_vprotocol_base_selected())
mca_vprotocol_base_select(pml_v_enable_progress_treads,
pml_v_enable_mpi_threads);
pml_v_enable_mpi_thread_multiple);
/* Check if we succeeded selecting a protocol */
if(mca_vprotocol_base_selected()) {

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

@ -124,7 +124,7 @@ opening files, reading standard input, or writing to standard output.
.SH MPI_THREAD_MULTIPLE Support
.
MPI_THREAD_MULTIPLE support is included if Open MPI was configured
with the --enable-thread-multiple configure switch. You can check the
with the --enable-mpi-thread-multiple configure switch. You can check the
output of
.BR ompi_info (1)
to see if Open MPI has MPI_THREAD_MULTIPLE support:

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

@ -238,7 +238,7 @@ int ompi_request_default_wait_all( size_t count,
*/
OPAL_THREAD_LOCK(&ompi_request_lock);
ompi_request_waiting++;
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
/*
* confirm the status of the pending requests. We have to do it before
* taking the condition or otherwise we can miss some requests completion (the
@ -251,7 +251,7 @@ int ompi_request_default_wait_all( size_t count,
completed++;
}
}
#endif /* OPAL_HAVE_THREAD_SUPPORT */
#endif /* OPAL_ENABLE_MULTI_THREADS */
while( completed != count ) {
/* check number of pending requests */
size_t start = ompi_request_completed;

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

@ -376,7 +376,7 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided)
this value. */
ompi_mpi_thread_requested = requested;
if (OPAL_HAVE_THREAD_SUPPORT == 0) {
if (OPAL_ENABLE_MULTI_THREADS == 0) {
ompi_mpi_thread_provided = *provided = MPI_THREAD_SINGLE;
ompi_mpi_main_thread = NULL;
} else if (OMPI_ENABLE_THREAD_MULTIPLE == 1) {

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

@ -572,9 +572,9 @@ void ompi_info_do_config(bool want_all)
f77 = strdup("no");
}
if (OPAL_HAVE_SOLARIS_THREADS || OPAL_HAVE_POSIX_THREADS) {
asprintf(&threads, "%s (mpi: %s, progress: %s)", OPAL_HAVE_SOLARIS_THREADS ? "solaris" :
(OPAL_HAVE_POSIX_THREADS ? "posix" : "type unknown"),
if (OPAL_HAVE_SOLARIS_THREADS || OPAL_HAVE_POSIX_THREADS) { /* should just test OPAL_HAVE_THREADS */
asprintf(&threads, "%s (MPI_THREAD_MULTIPLE: %s, progress: %s)", OPAL_HAVE_SOLARIS_THREADS ? "solaris" :
(OPAL_HAVE_POSIX_THREADS ? "posix" : "type unknown"), /* "type unknown" can presumably never happen */
OMPI_ENABLE_THREAD_MULTIPLE ? "yes" : "no",
OMPI_ENABLE_PROGRESS_THREADS ? "yes" : "no");
} else {

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

@ -24,9 +24,9 @@
#include "opal_config.h"
#include "opal/class/opal_list.h"
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
#include "opal/sys/atomic.h"
#endif /* OPAL_HAVE_THREAD_SUPPORT */
#endif /* OPAL_ENABLE_MULTI_THREADS */
BEGIN_C_DECLS
@ -68,7 +68,7 @@ static inline bool opal_atomic_lifo_is_empty( opal_atomic_lifo_t* lifo )
static inline opal_list_item_t* opal_atomic_lifo_push( opal_atomic_lifo_t* lifo,
opal_list_item_t* item )
{
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
do {
item->opal_list_next = lifo->opal_lifo_head;
opal_atomic_wmb();
@ -84,7 +84,7 @@ static inline opal_list_item_t* opal_atomic_lifo_push( opal_atomic_lifo_t* lifo,
item->opal_list_next = lifo->opal_lifo_head;
lifo->opal_lifo_head = item;
return (opal_list_item_t*)item->opal_list_next;
#endif /* OPAL_HAVE_THREAD_SUPPORT */
#endif /* OPAL_ENABLE_MULTI_THREADS */
}
/* Retrieve one element from the LIFO. If we reach the ghost element then the LIFO
@ -93,7 +93,7 @@ static inline opal_list_item_t* opal_atomic_lifo_push( opal_atomic_lifo_t* lifo,
static inline opal_list_item_t* opal_atomic_lifo_pop( opal_atomic_lifo_t* lifo )
{
opal_list_item_t* item;
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
while((item = lifo->opal_lifo_head) != &(lifo->opal_lifo_ghost))
{
opal_atomic_rmb();
@ -109,7 +109,7 @@ static inline opal_list_item_t* opal_atomic_lifo_pop( opal_atomic_lifo_t* lifo )
#else
item = lifo->opal_lifo_head;
lifo->opal_lifo_head = (opal_list_item_t*)item->opal_list_next;
#endif /* OPAL_HAVE_THREAD_SUPPORT */
#endif /* OPAL_ENABLE_MULTI_THREADS */
if( item == &(lifo->opal_lifo_ghost) ) return NULL;
item->opal_list_next = NULL;
return item;

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

@ -122,9 +122,9 @@
#include <stdlib.h>
#endif /* HAVE_STDLIB_H */
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
#include "opal/sys/atomic.h"
#endif /* OPAL_HAVE_THREAD_SUPPORT */
#endif /* OPAL_ENABLE_MULTI_THREADS */
BEGIN_C_DECLS
@ -492,7 +492,7 @@ static inline opal_object_t *opal_obj_new(opal_class_t * cls)
static inline int opal_obj_update(opal_object_t *object, int inc) __opal_attribute_always_inline__;
static inline int opal_obj_update(opal_object_t *object, int inc)
{
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
return opal_atomic_add_32(&(object->obj_reference_count), inc );
#else
object->obj_reference_count += inc;

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

@ -68,8 +68,6 @@
/* Do we have posix or solaris thread lib */
#define OPAL_HAVE_THREADS (OPAL_HAVE_POSIX_THREADS || OPAL_HAVE_SOLARIS_THREADS)
/* Do we have thread support? */
#define OPAL_HAVE_THREAD_SUPPORT OPAL_ENABLE_MULTI_THREADS
/*
* BEGIN_C_DECLS should be used at the beginning of your declarations,

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

@ -45,9 +45,9 @@ int opal_progress_spin_count = 10000;
/*
* Local variables
*/
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
static opal_atomic_lock_t progress_lock;
#endif /* OPAL_HAVE_THREAD_SUPPORT */
#endif /* OPAL_ENABLE_MULTI_THREADS */
/* callbacks to progress */
static opal_progress_callback_t *callbacks = NULL;
@ -71,7 +71,7 @@ static int32_t event_progress_delta = 0;
static int32_t num_event_users = 0;
/* How deep are we in opal_progress recursion? */
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
volatile
#endif
uint32_t opal_progress_recursion_depth_counter = 0;
@ -99,9 +99,9 @@ opal_progress_init(void)
#endif
/* reentrant issues */
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
opal_atomic_init(&progress_lock, OPAL_ATOMIC_UNLOCKED);
#endif /* OPAL_HAVE_THREAD_SUPPORT */
#endif /* OPAL_ENABLE_MULTI_THREADS */
/* set the event tick rate */
opal_progress_set_event_poll_rate(10000);
@ -131,7 +131,7 @@ int
opal_progress_finalize(void)
{
/* free memory associated with the callbacks */
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
opal_atomic_lock(&progress_lock);
#endif
@ -142,7 +142,7 @@ opal_progress_finalize(void)
callbacks = NULL;
}
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
opal_atomic_unlock(&progress_lock);
#endif
@ -167,7 +167,7 @@ opal_progress(void)
size_t i;
int events = 0;
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
opal_atomic_add(&opal_progress_recursion_depth_counter, 1);
#else
++opal_progress_recursion_depth_counter;
@ -221,7 +221,7 @@ opal_progress(void)
#endif /* defined(__WINDOWS__) */
}
#endif /* defined(__WINDOWS__) || defined(HAVE_SCHED_YIELD) */
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
opal_atomic_add(&opal_progress_recursion_depth_counter, -1);
#else
--opal_progress_recursion_depth_counter;
@ -336,7 +336,7 @@ opal_progress_register(opal_progress_callback_t cb)
int ret = OPAL_SUCCESS;
size_t index;
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
opal_atomic_lock(&progress_lock);
#endif
@ -361,7 +361,7 @@ opal_progress_register(opal_progress_callback_t cb)
cleanup:
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
opal_atomic_unlock(&progress_lock);
#endif
@ -374,7 +374,7 @@ opal_progress_unregister(opal_progress_callback_t cb)
size_t i;
int ret = OPAL_ERR_NOT_FOUND;
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
opal_atomic_lock(&progress_lock);
#endif
@ -402,7 +402,7 @@ opal_progress_unregister(opal_progress_callback_t cb)
callbacks_len--;
}
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
opal_atomic_unlock(&progress_lock);
#endif

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

@ -207,7 +207,7 @@ static inline bool opal_progress_spin(volatile bool* complete)
* function.
*/
OPAL_DECLSPEC extern
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
volatile
#endif
uint32_t opal_progress_recursion_depth_counter;

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

@ -67,7 +67,7 @@ static inline int opal_condition_wait(opal_condition_t *c, opal_mutex_t *m)
int rc = 0;
c->c_waiting++;
#if OPAL_ENABLE_DEBUG && !OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_DEBUG && !OPAL_ENABLE_MULTI_THREADS
if (opal_mutex_check_locks && 0 == m->m_lock_debug) { \
opal_output(0, "Warning -- mutex not locked in condition_wait"); \
} \
@ -75,9 +75,9 @@ static inline int opal_condition_wait(opal_condition_t *c, opal_mutex_t *m)
#endif
if (opal_using_threads()) {
#if OPAL_HAVE_POSIX_THREADS && OPAL_HAVE_THREAD_SUPPORT
#if OPAL_HAVE_POSIX_THREADS && OPAL_ENABLE_MULTI_THREADS
rc = pthread_cond_wait(&c->c_cond, &m->m_lock_pthread);
#elif OPAL_HAVE_SOLARIS_THREADS && OPAL_HAVE_THREAD_SUPPORT
#elif OPAL_HAVE_SOLARIS_THREADS && OPAL_ENABLE_MULTI_THREADS
rc = cond_wait(&c->c_cond, &m->m_lock_solaris);
#else
if (c->c_signaled) {
@ -102,7 +102,7 @@ static inline int opal_condition_wait(opal_condition_t *c, opal_mutex_t *m)
}
}
#if OPAL_ENABLE_DEBUG && !OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_DEBUG && !OPAL_ENABLE_MULTI_THREADS
m->m_lock_debug++;
#endif
@ -119,7 +119,7 @@ static inline int opal_condition_timedwait(opal_condition_t *c,
struct timeval absolute;
int rc = 0;
#if OPAL_ENABLE_DEBUG && !OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_DEBUG && !OPAL_ENABLE_MULTI_THREADS
if (opal_mutex_check_locks && 0 == m->m_lock_debug) { \
opal_output(0, "Warning -- mutex not locked in condition_wait"); \
} \
@ -128,9 +128,9 @@ static inline int opal_condition_timedwait(opal_condition_t *c,
c->c_waiting++;
if (opal_using_threads()) {
#if OPAL_HAVE_POSIX_THREADS && OPAL_HAVE_THREAD_SUPPORT
#if OPAL_HAVE_POSIX_THREADS && OPAL_ENABLE_MULTI_THREADS
rc = pthread_cond_timedwait(&c->c_cond, &m->m_lock_pthread, abstime);
#elif OPAL_HAVE_SOLARIS_THREADS && OPAL_HAVE_THREAD_SUPPORT
#elif OPAL_HAVE_SOLARIS_THREADS && OPAL_ENABLE_MULTI_THREADS
/* deal with const-ness */
timestruc_t to;
to.tv_sec = abstime->tv_sec;
@ -165,7 +165,7 @@ static inline int opal_condition_timedwait(opal_condition_t *c,
}
}
#if OPAL_ENABLE_DEBUG && !OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_DEBUG && !OPAL_ENABLE_MULTI_THREADS
m->m_lock_debug++;
#endif
@ -178,11 +178,11 @@ static inline int opal_condition_signal(opal_condition_t *c)
{
if (c->c_waiting) {
c->c_signaled++;
#if OPAL_HAVE_POSIX_THREADS && OPAL_HAVE_THREAD_SUPPORT
#if OPAL_HAVE_POSIX_THREADS && OPAL_ENABLE_MULTI_THREADS
if(opal_using_threads()) {
pthread_cond_signal(&c->c_cond);
}
#elif OPAL_HAVE_SOLARIS_THREADS && OPAL_HAVE_THREAD_SUPPORT
#elif OPAL_HAVE_SOLARIS_THREADS && OPAL_ENABLE_MULTI_THREADS
if(opal_using_threads()) {
cond_signal(&c->c_cond);
}
@ -194,7 +194,7 @@ static inline int opal_condition_signal(opal_condition_t *c)
static inline int opal_condition_broadcast(opal_condition_t *c)
{
c->c_signaled = c->c_waiting;
#if OPAL_HAVE_POSIX_THREADS && OPAL_HAVE_THREAD_SUPPORT
#if OPAL_HAVE_POSIX_THREADS && OPAL_ENABLE_MULTI_THREADS
if (opal_using_threads()) {
if( 1 == c->c_waiting ) {
pthread_cond_signal(&c->c_cond);
@ -202,7 +202,7 @@ static inline int opal_condition_broadcast(opal_condition_t *c)
pthread_cond_broadcast(&c->c_cond);
}
}
#elif OPAL_HAVE_SOLARIS_THREADS && OPAL_HAVE_THREAD_SUPPORT
#elif OPAL_HAVE_SOLARIS_THREADS && OPAL_ENABLE_MULTI_THREADS
if (opal_using_threads()) {
cond_broadcast(&c->c_cond);
}

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

@ -35,11 +35,11 @@ bool opal_mutex_check_locks = false;
static void opal_mutex_construct(opal_mutex_t *m)
{
InterlockedExchange(&m->m_lock, 0);
#if !OPAL_HAVE_THREAD_SUPPORT && OPAL_ENABLE_DEBUG
#if !OPAL_ENABLE_MULTI_THREADS && OPAL_ENABLE_DEBUG
m->m_lock_debug = 0;
m->m_lock_file = NULL;
m->m_lock_line = 0;
#endif /* !OPAL_HAVE_THREAD_SUPPORT && OPAL_ENABLE_DEBUG */
#endif /* !OPAL_ENABLE_MULTI_THREADS && OPAL_ENABLE_DEBUG */
}
static void opal_mutex_destruct(opal_mutex_t *m)
@ -77,7 +77,7 @@ static void opal_mutex_construct(opal_mutex_t *m)
mutex_init(&m->m_lock_solaris, USYNC_THREAD, NULL);
#endif
#if OPAL_ENABLE_DEBUG && !OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_DEBUG && !OPAL_ENABLE_MULTI_THREADS
m->m_lock_debug = 0;
m->m_lock_file = NULL;
m->m_lock_line = 0;

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

@ -27,9 +27,9 @@
#include "opal_config.h"
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
#include "opal/sys/atomic.h"
#endif /* OPAL_HAVE_THREAD_SUPPORT */
#endif /* OPAL_ENABLE_MULTI_THREADS */
#if OPAL_ENABLE_DEBUG
#include "opal/util/output.h"
#endif
@ -174,7 +174,7 @@ BEGIN_C_DECLS
*/
static inline bool opal_set_using_threads(bool have)
{
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
opal_uses_threads = have;
#else
have = have; /* just shut up the compiler */
@ -198,7 +198,7 @@ static inline bool opal_set_using_threads(bool have)
* process, return immediately.
*/
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
#define OPAL_THREAD_LOCK(mutex) \
do { \
if (opal_using_threads()) { \
@ -239,7 +239,7 @@ static inline bool opal_set_using_threads(bool have)
*
* Returns 0 if mutex was locked, non-zero otherwise.
*/
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
#define OPAL_THREAD_TRYLOCK(mutex) (opal_using_threads() ? opal_mutex_trylock(mutex) : 0)
#elif OPAL_ENABLE_DEBUG
static inline int
@ -283,7 +283,7 @@ opal_thread_debug_trylock(opal_mutex_t *mutex, const char *file, int line)
* If there is no possibility that multiple threads are running in the
* process, return immediately without modifying the mutex.
*/
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
#define OPAL_THREAD_UNLOCK(mutex) \
do { \
if (opal_using_threads()) { \
@ -326,7 +326,7 @@ opal_thread_debug_trylock(opal_mutex_t *mutex, const char *file, int line)
* process, invoke the action without acquiring the lock.
*/
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
#define OPAL_THREAD_SCOPED_LOCK(mutex, action) \
do { \
if(opal_using_threads()) { \
@ -360,21 +360,21 @@ opal_thread_debug_trylock(opal_mutex_t *mutex, const char *file, int line)
* indicates that threads are in use by the application or library.
*/
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
#define OPAL_THREAD_ADD32(x,y) \
(opal_using_threads() ? opal_atomic_add_32(x,y) : (*x += y))
#else
#define OPAL_THREAD_ADD32(x,y) (*x += y)
#endif
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
#define OPAL_THREAD_ADD64(x,y) \
(opal_using_threads() ? opal_atomic_add_64(x,y) : (*x += y))
#else
#define OPAL_THREAD_ADD64(x,y) (*x += y)
#endif
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
#define OPAL_THREAD_ADD_SIZE_T(x,y) \
(opal_using_threads() ? opal_atomic_add_size_t(x,y) : (*x += y))
#else
@ -383,7 +383,7 @@ opal_thread_debug_trylock(opal_mutex_t *mutex, const char *file, int line)
#define OPAL_CMPSET(x, y, z) ((*(x) == (y)) ? ((*(x) = (z)), 1) : 0)
#if OPAL_HAVE_THREAD_SUPPORT
#if OPAL_ENABLE_MULTI_THREADS
# if OPAL_HAVE_ATOMIC_CMPSET_32
# define OPAL_ATOMIC_CMPSET_32(x, y, z) \
(opal_using_threads() ? opal_atomic_cmpset_32(x, y, z) : OPAL_CMPSET(x, y, z))

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

@ -59,7 +59,7 @@ struct opal_mutex_t {
mutex_t m_lock_solaris;
#endif
#if !OPAL_HAVE_THREAD_SUPPORT && OPAL_ENABLE_DEBUG
#if !OPAL_ENABLE_MULTI_THREADS && OPAL_ENABLE_DEBUG
int m_lock_debug;
const char *m_lock_file;
int m_lock_line;

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

@ -14,12 +14,12 @@
* #if conditionals). We also don't protect including <pthread.h>.
* That's because this component currently only compiles on Linux and
* Solaris, and both of these OS's have pthreads. Using the run-time
* conditionals gives us bettern compile-time checking, even of code
* conditionals gives us better compile-time checking, even of code
* that isn't activated.
*
* Note, too, that the functionality in this file does *not* require
* all the heavyweight OMPI thread infrastructure (e.g., from
* --enable-mpi-threads or --enable-progress-threads). All work that
* --enable-mpi-thread-multiple or --enable-progress-threads). All work that
* is done in a separate progress thread is very carefully segregated
* from that of the main thread, and communication back to the main
* thread

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

@ -14,12 +14,12 @@
* #if conditionals). We also don't protect including <pthread.h>.
* That's because this component currently only compiles on Linux and
* Solaris, and both of these OS's have pthreads. Using the run-time
* conditionals gives us bettern compile-time checking, even of code
* conditionals gives us better compile-time checking, even of code
* that isn't activated.
*
* Note, too, that the functionality in this file does *not* require
* all the heavyweight OMPI thread infrastructure (e.g., from
* --enable-mpi-threads or --enable-progress-threads). All work that
* --enable-mpi-thread-multiple or --enable-progress-threads). All work that
* is done in a separate progress thread is very carefully segregated
* from that of the main thread, and communication back to the main
* thread

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

@ -403,7 +403,7 @@ orte_waitpid(pid_t wpid, int *status, int options)
from under it. Yes, it's spinning. No, we won't spin
for long. */
if (!OPAL_HAVE_THREAD_SUPPORT) {
if (!OPAL_ENABLE_MULTI_THREADS) {
opal_event_loop(opal_event_base, OPAL_EVLOOP_NONBLOCK);
}
}

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

@ -514,9 +514,9 @@ void orte_info_do_config(bool want_all)
symbol_visibility = OPAL_C_HAVE_VISIBILITY ? "yes" : "no";
/* setup strings that require allocation */
if (OPAL_HAVE_SOLARIS_THREADS || OPAL_HAVE_POSIX_THREADS) {
asprintf(&threads, "%s (mpi: %s, progress: %s)", OPAL_HAVE_SOLARIS_THREADS ? "solaris" :
(OPAL_HAVE_POSIX_THREADS ? "posix" : "type unknown"),
if (OPAL_HAVE_SOLARIS_THREADS || OPAL_HAVE_POSIX_THREADS) { /* should just test OPAL_HAVE_THREADS */
asprintf(&threads, "%s (OPAL: %s, progress: %s)", OPAL_HAVE_SOLARIS_THREADS ? "solaris" :
(OPAL_HAVE_POSIX_THREADS ? "posix" : "type unknown"), /* "type unknown" can presumably never happen */
OPAL_ENABLE_MULTI_THREADS ? "yes" : "no",
ORTE_ENABLE_PROGRESS_THREADS ? "yes" : "no");
} else {

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

@ -30,7 +30,7 @@
#include "opal/sys/atomic.h"
#if !OPAL_HAVE_THREAD_SUPPORT
#if !OPAL_ENABLE_MULTI_THREADS
/* If we don't have thread support, there's no point in running this
test */
@ -135,4 +135,4 @@ int main(int argc, char** argv)
return test_finalize();
}
#endif /* OPAL_HAVE_THREAD_SUPPORT */
#endif /* OPAL_ENABLE_MULTI_THREADS */

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

@ -13,7 +13,7 @@
#include "opal/sys/atomic.h"
#if !OPAL_HAVE_THREAD_SUPPORT
#if !OPAL_ENABLE_MULTI_THREADS
/* If we don't have thread support, there's no point in running this
test */
@ -73,4 +73,4 @@ int main(int argc, char** argv)
return test_finalize();
}
#endif /* OPAL_HAVE_THREAD_SUPPORT */
#endif /* OPAL_ENABLE_MULTI_THREADS */