diff --git a/config/opal_check_openfabrics.m4 b/config/opal_check_openfabrics.m4 index 6a1a92bf50..0f605928b3 100644 --- a/config/opal_check_openfabrics.m4 +++ b/config/opal_check_openfabrics.m4 @@ -81,21 +81,6 @@ AC_DEFUN([OPAL_CHECK_OPENFABRICS],[ ompi_check_openib_$1_save_LDFLAGS="$LDFLAGS" ompi_check_openib_$1_save_LIBS="$LIBS" - AS_IF([test "$ompi_check_openib_happy" = "yes"], - [AS_IF([test "$THREAD_TYPE" != "posix" -a "$memory_ptmalloc2_happy" = "yes"], - [AS_IF([test "$enable_ptmalloc2_internal" = "yes"], - [AC_MSG_WARN([POSIX threads are disabled, but]) - AC_MSG_WARN([--enable-ptmalloc2-internal was specified. This will]) - AC_MSG_WARN([cause memory corruption with OpenFabrics.]) - AC_MSG_WARN([Not building component.]) - ompi_check_openib_happy="no"], - [AC_MSG_WARN([POSIX threads are disabled, but the ptmalloc2 memory]) - AC_MSG_WARN([manager is being built. Compiling MPI applications with]) - AC_MSG_WARN([-lopenmpi-malloc will result in memory corruption; Open]) - AC_MSG_WARN([MPI will disable the openib BTL at run-time if such a]) - AC_MSG_WARN([combination is detected.]) - AC_MSG_WARN([You have been warned.])])])]) - AS_IF([test "$ompi_check_openib_happy" = "yes"], [AC_CHECK_HEADERS( fcntl.h sys/poll.h, diff --git a/config/opal_config_threads.m4 b/config/opal_config_threads.m4 index af5b2d8467..c07257a265 100644 --- a/config/opal_config_threads.m4 +++ b/config/opal_config_threads.m4 @@ -33,12 +33,8 @@ AC_DEFUN([OPAL_CONFIG_THREADS],[ # configure threads # -# create templates -AH_TEMPLATE([OPAL_HAVE_POSIX_THREADS], - [Do we have POSIX threads]) - # -# Check for thread types - add your type here... +# Check we have POSIX threads # OPAL_CONFIG_POSIX_THREADS(HAVE_POSIX_THREADS=1, HAVE_POSIX_THREADS=0) AC_MSG_CHECKING([for working POSIX threads package]) @@ -59,8 +55,6 @@ if test "$HAVE_POSIX_THREADS" = "0"; then AC_MSG_ERROR(["*** Can not continue"]) fi -AC_DEFINE(OPAL_HAVE_POSIX_THREADS, 1) - THREAD_CFLAGS="$PTHREAD_CFLAGS" THREAD_FCFLAGS="$PTHREAD_FCFLAGS" THREAD_CXXFLAGS="$PTHREAD_CXXFLAGS" @@ -71,9 +65,6 @@ THREAD_LIBS="$PTHREAD_LIBS" OPAL_CHECK_PTHREAD_PIDS -THREAD_TYPE = "posix" -AM_CONDITIONAL(OPAL_HAVE_POSIX_THREADS, 1) - AC_DEFINE_UNQUOTED([OPAL_ENABLE_MULTI_THREADS], [1], [Whether we should enable thread support within the OPAL code base]) diff --git a/ompi/include/ompi/memchecker.h b/ompi/include/ompi/memchecker.h index 9445390656..6ba22e6016 100644 --- a/ompi/include/ompi/memchecker.h +++ b/ompi/include/ompi/memchecker.h @@ -6,6 +6,8 @@ * reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2012-2013 Inria. All rights reserved. + * Copyright (c) 2014-2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Intel, Inc. All rights reserved. * * $COPYRIGHT$ @@ -185,7 +187,6 @@ static inline int memchecker_comm(MPI_Comm comm) opal_memchecker_base_isdefined (&comm->c_lock.super.cls_init_file_name, sizeof(const char *)); opal_memchecker_base_isdefined (&comm->c_lock.super.cls_init_lineno, sizeof(int)); #endif -#if OPAL_HAVE_POSIX_THREADS /* opal_memchecker_base_isdefined (&comm->c_lock.m_lock_pthread.__m_reserved, sizeof(int)); opal_memchecker_base_isdefined (&comm->c_lock.m_lock_pthread.__m_count, sizeof(int)); @@ -194,7 +195,6 @@ static inline int memchecker_comm(MPI_Comm comm) opal_memchecker_base_isdefined (&comm->c_lock.m_lock_pthread.__m_lock.__status, sizeof(long int)); opal_memchecker_base_isdefined (&comm->c_lock.m_lock_pthread.__m_lock.__spinlock, sizeof(int)); */ -#endif /* * The storage of a union has the size of the initialized member. * Here we check the whole union. diff --git a/ompi/mca/osc/sm/osc_sm.h b/ompi/mca/osc/sm/osc_sm.h index 376b966742..830cc63910 100644 --- a/ompi/mca/osc/sm/osc_sm.h +++ b/ompi/mca/osc/sm/osc_sm.h @@ -3,6 +3,8 @@ * Copyright (c) 2012 Sandia National Laboratories. All rights reserved. * Copyright (c) 2014 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -20,13 +22,11 @@ struct ompi_osc_sm_global_state_t { int use_barrier_for_fence; -#if OPAL_HAVE_POSIX_THREADS pthread_mutex_t mtx; pthread_cond_t cond; int sense; int32_t count; -#endif }; typedef struct ompi_osc_sm_global_state_t ompi_osc_sm_global_state_t; @@ -74,9 +74,7 @@ struct ompi_osc_sm_module_t { ompi_group_t *start_group; ompi_group_t *post_group; -#if OPAL_HAVE_POSIX_THREADS int my_sense; -#endif enum ompi_osc_sm_locktype_t *outstanding_locks; diff --git a/ompi/tools/ompi_info/param.c b/ompi/tools/ompi_info/param.c index 99c46ed899..6ebe70880c 100644 --- a/ompi/tools/ompi_info/param.c +++ b/ompi/tools/ompi_info/param.c @@ -11,7 +11,7 @@ * All rights reserved. * Copyright (c) 2007-2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2014 Research Organization for Information Science + * Copyright (c) 2014-2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -288,23 +288,19 @@ void ompi_info_do_config(bool want_all) fortran_have_ignore_tkr = strdup("no"); } - if (OPAL_HAVE_POSIX_THREADS) { /* should just test OPAL_HAVE_THREADS */ #if OMPI_RTE_ORTE - (void)asprintf(&threads, "%s (MPI_THREAD_MULTIPLE: %s, OPAL support: %s, OMPI progress: %s, ORTE progress: yes, Event lib: yes)", - (OPAL_HAVE_POSIX_THREADS ? "posix" : "type unknown"), /* "type unknown" can presumably never happen */ - OMPI_ENABLE_THREAD_MULTIPLE ? "yes" : "no", - OPAL_ENABLE_MULTI_THREADS ? "yes" : "no", - OPAL_ENABLE_PROGRESS_THREADS ? "yes" : "no"); + (void)asprintf(&threads, "%s (MPI_THREAD_MULTIPLE: %s, OPAL support: %s, OMPI progress: %s, ORTE progress: yes, Event lib: yes)", + "posix", + OMPI_ENABLE_THREAD_MULTIPLE ? "yes" : "no", + OPAL_ENABLE_MULTI_THREADS ? "yes" : "no", + OPAL_ENABLE_PROGRESS_THREADS ? "yes" : "no"); #else - (void)asprintf(&threads, "%s (MPI_THREAD_MULTIPLE: %s, OPAL support: %s, OMPI progress: %s, Event lib: yes)", - (OPAL_HAVE_POSIX_THREADS ? "posix" : "type unknown"), /* "type unknown" can presumably never happen */ - OMPI_ENABLE_THREAD_MULTIPLE ? "yes" : "no", - OPAL_ENABLE_MULTI_THREADS ? "yes" : "no", - OPAL_ENABLE_PROGRESS_THREADS ? "yes" : "no"); + (void)asprintf(&threads, "%s (MPI_THREAD_MULTIPLE: %s, OPAL support: %s, OMPI progress: %s, Event lib: yes)", + "posix", + OMPI_ENABLE_THREAD_MULTIPLE ? "yes" : "no", + OPAL_ENABLE_MULTI_THREADS ? "yes" : "no", + OPAL_ENABLE_PROGRESS_THREADS ? "yes" : "no"); #endif - } else { - threads = strdup("no"); - } (void)asprintf(&ft_support, "%s (checkpoint thread: %s)", OPAL_ENABLE_FT ? "yes" : "no", OPAL_ENABLE_FT_THREAD ? "yes" : "no"); diff --git a/opal/include/opal_config_bottom.h b/opal/include/opal_config_bottom.h index 3bdd2710b4..3cfc7f8b8a 100644 --- a/opal/include/opal_config_bottom.h +++ b/opal/include/opal_config_bottom.h @@ -13,6 +13,8 @@ * Copyright (c) 2009-2013 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2013 Mellanox Technologies, Inc. * All rights reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -68,9 +70,6 @@ * **********************************************************************/ -/* Do we have posix or solaris thread lib */ -#define OPAL_HAVE_THREADS (OPAL_HAVE_POSIX_THREADS) - /* * BEGIN_C_DECLS should be used at the beginning of your declarations, * so that C++ compilers don't mangle their names. Use END_C_DECLS at diff --git a/opal/mca/btl/openib/btl_openib.c b/opal/mca/btl/openib/btl_openib.c index 83a4e1a0ad..06319699c8 100644 --- a/opal/mca/btl/openib/btl_openib.c +++ b/opal/mca/btl/openib/btl_openib.c @@ -358,7 +358,6 @@ static int create_srq(mca_btl_openib_module_t *openib_btl) return OPAL_ERROR; } -#if OPAL_HAVE_THREADS { opal_mutex_t *lock = &mca_btl_openib_component.srq_manager.lock; opal_hash_table_t *srq_addr_table = &mca_btl_openib_component.srq_manager.srq_addr_table; @@ -375,7 +374,6 @@ static int create_srq(mca_btl_openib_module_t *openib_btl) } opal_mutex_unlock(lock); } -#endif rd_num = mca_btl_openib_component.qp_infos[qp].rd_num; rd_curr_num = openib_btl->qps[qp].u.srq_qp.rd_curr_num = mca_btl_openib_component.qp_infos[qp].u.srq_qp.rd_init; @@ -632,7 +630,6 @@ static int prepare_device_for_use (mca_btl_openib_device_t *device) OBJ_CONSTRUCT(&device->qps[qp_index].recv_free, ompi_free_list_t); } -#if OPAL_HAVE_THREADS if(mca_btl_openib_component.use_async_event_thread) { mca_btl_openib_async_cmd_t async_command; @@ -662,7 +659,6 @@ static int prepare_device_for_use (mca_btl_openib_device_t *device) device->thread.t_arg = device; device->progress = false; #endif -#endif #if HAVE_XRC /* if user configured to run with XRC qp and the device doesn't @@ -1617,7 +1613,6 @@ static int mca_btl_openib_finalize_resources(struct mca_btl_base_module_t* btl) MCA_BTL_OPENIB_CLEAN_PENDING_FRAGS( &openib_btl->qps[qp].u.srq_qp.pending_frags[1]); if (NULL != openib_btl->qps[qp].u.srq_qp.srq) { -#if OPAL_HAVE_THREADS opal_mutex_t *lock = &mca_btl_openib_component.srq_manager.lock; @@ -1633,7 +1628,6 @@ static int mca_btl_openib_finalize_resources(struct mca_btl_base_module_t* btl) rc = OPAL_ERROR; } opal_mutex_unlock(lock); -#endif if (0 != ibv_destroy_srq(openib_btl->qps[qp].u.srq_qp.srq)) { BTL_VERBOSE(("Failed to close SRQ %d", qp)); rc = OPAL_ERROR; diff --git a/opal/mca/btl/openib/btl_openib.h b/opal/mca/btl/openib/btl_openib.h index 3ae56e80a0..92e3d6a6eb 100644 --- a/opal/mca/btl/openib/btl_openib.h +++ b/opal/mca/btl/openib/btl_openib.h @@ -138,7 +138,6 @@ typedef enum { BTL_OPENIB_DT_ALL } btl_openib_device_type_t; -#if OPAL_HAVE_THREADS /* The structer for manage all BTL SRQs */ typedef struct mca_btl_openib_srq_manager_t { opal_mutex_t lock; @@ -147,7 +146,6 @@ typedef struct mca_btl_openib_srq_manager_t { pointers that associated with these SRQs */ opal_hash_table_t srq_addr_table; } mca_btl_openib_srq_manager_t; -#endif struct mca_btl_openib_component_t { mca_btl_base_component_2_0_0_t super; /**< base BTL component */ @@ -228,7 +226,6 @@ struct mca_btl_openib_component_t { int apm_lmc; int apm_ports; unsigned int buffer_alignment; /**< Preferred communication buffer alignment in Bytes (must be power of two) */ -#if OPAL_HAVE_THREADS int32_t error_counter; /**< Counts number on error events that we got on all devices */ int async_pipe[2]; /**< Pipe for comunication with async event thread */ int async_comp_pipe[2]; /**< Pipe for async thread comunication with main thread */ @@ -237,7 +234,6 @@ struct mca_btl_openib_component_t { mca_btl_openib_srq_manager_t srq_manager; /**< Hash table for all BTL SRQs */ #if BTL_OPENIB_FAILOVER_ENABLED bool port_error_failover; /**< Report port errors to speed up failover */ -#endif #endif /* declare as an int instead of btl_openib_device_type_t since there is no guarantee about the size of an enum. this value will be registered as an @@ -393,10 +389,8 @@ typedef struct mca_btl_openib_device_t { uint16_t hp_cq_polls; uint16_t eager_rdma_polls; bool pollme; -#if OPAL_HAVE_THREADS volatile bool got_fatal_event; volatile bool got_port_event; -#endif #if HAVE_XRC #if OPAL_HAVE_CONNECTX_XRC_DOMAINS struct ibv_xrcd *xrcd; diff --git a/opal/mca/btl/openib/btl_openib_async.c b/opal/mca/btl/openib/btl_openib_async.c index 9f95152608..64dad4f3aa 100644 --- a/opal/mca/btl/openib/btl_openib_async.c +++ b/opal/mca/btl/openib/btl_openib_async.c @@ -20,7 +20,6 @@ #include "opal_config.h" -#if OPAL_HAVE_THREADS #include #include #include @@ -720,5 +719,3 @@ int start_async_event_thread(void) return OPAL_SUCCESS; } - -#endif diff --git a/opal/mca/btl/openib/btl_openib_component.c b/opal/mca/btl/openib/btl_openib_component.c index 9640b3eaf4..987fb66632 100644 --- a/opal/mca/btl/openib/btl_openib_component.c +++ b/opal/mca/btl/openib/btl_openib_component.c @@ -101,9 +101,7 @@ #if BTL_OPENIB_FAILOVER_ENABLED #include "btl_openib_failover.h" #endif -#if OPAL_HAVE_THREADS #include "btl_openib_async.h" -#endif #include "connect/base.h" #include "btl_openib_ip.h" @@ -206,14 +204,12 @@ static int btl_openib_component_register(void) */ static int btl_openib_component_open(void) { -#if OPAL_HAVE_THREADS opal_mutex_t *lock = &mca_btl_openib_component.srq_manager.lock; opal_hash_table_t *srq_addr_table = &mca_btl_openib_component.srq_manager.srq_addr_table; /* Construct hash table that stores pointers to SRQs */ OBJ_CONSTRUCT(lock, opal_mutex_t); OBJ_CONSTRUCT(srq_addr_table, opal_hash_table_t); -#endif /* initialize state */ mca_btl_openib_component.ib_num_btls = 0; @@ -241,7 +237,6 @@ static int btl_openib_component_close(void) { int rc = OPAL_SUCCESS; -#if OPAL_HAVE_THREADS /* Tell the async thread to shutdown */ if (mca_btl_openib_component.use_async_event_thread && 0 != mca_btl_openib_component.async_thread) { @@ -265,7 +260,6 @@ static int btl_openib_component_close(void) OBJ_DESTRUCT(&mca_btl_openib_component.srq_manager.lock); OBJ_DESTRUCT(&mca_btl_openib_component.srq_manager.srq_addr_table); -#endif opal_btl_openib_connect_base_finalize(); opal_btl_openib_fd_finalize(); @@ -748,7 +742,6 @@ static int init_one_port(opal_list_t *btl_list, mca_btl_openib_device_t *device, lmc = mca_btl_openib_component.max_lmc; } -#if OPAL_HAVE_THREADS /* APM support -- only meaningful if async event support is enabled. If async events are not enabled, then there's nothing to listen for the APM event to load the new path, so it's not @@ -771,7 +764,6 @@ static int init_one_port(opal_list_t *btl_list, mca_btl_openib_device_t *device, opal_show_help("help-mpi-btl-openib.txt", "apm without lmc",true); } } -#endif for(lid = ib_port_attr->lid; lid < ib_port_attr->lid + lmc; lid += lmc_step){ @@ -892,12 +884,10 @@ static void device_construct(mca_btl_openib_device_t *device) device->xrc_fd = -1; #endif device->qps = NULL; -#if OPAL_HAVE_THREADS mca_btl_openib_component.async_pipe[0] = mca_btl_openib_component.async_pipe[1] = -1; mca_btl_openib_component.async_comp_pipe[0] = mca_btl_openib_component.async_comp_pipe[1] = -1; -#endif OBJ_CONSTRUCT(&device->device_lock, opal_mutex_t); OBJ_CONSTRUCT(&device->send_free_control, ompi_free_list_t); device->max_inline_data = 0; @@ -908,7 +898,6 @@ static void device_destruct(mca_btl_openib_device_t *device) { int i; -#if OPAL_HAVE_THREADS #if OPAL_ENABLE_PROGRESS_THREADS if(device->progress) { device->progress = false; @@ -939,7 +928,6 @@ static void device_destruct(mca_btl_openib_device_t *device) goto device_error; } } -#endif if(device->eager_rdma_buffers) { int i; @@ -2517,15 +2505,6 @@ btl_openib_component_init(int *num_btl_modules, OS's that support OpenFabrics that provide both FREE and MUNMAP support, so the following test is [currently] good enough... */ value = opal_mem_hooks_support_level(); -#if !OPAL_HAVE_THREADS - if ((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) == - ((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) & value)) { - opal_show_help("help-mpi-btl-openib.txt", - "ptmalloc2 with no threads", true, - opal_process_info.nodename); - goto no_btls; - } -#endif /* If we have a memory manager available, and opal_leave_pinned==-1, then unless the user explicitly set @@ -2698,9 +2677,7 @@ btl_openib_component_init(int *num_btl_modules, OBJ_CONSTRUCT(&btl_list, opal_list_t); OBJ_CONSTRUCT(&mca_btl_openib_component.ib_lock, opal_mutex_t); -#if OPAL_HAVE_THREADS mca_btl_openib_component.async_thread = 0; -#endif distance = dev_sorted[0].distance; for (found = false, i = 0; i < num_devs && (-1 == mca_btl_openib_component.ib_max_btls || @@ -2795,7 +2772,6 @@ btl_openib_component_init(int *num_btl_modules, if (OPAL_SUCCESS != setup_qps()) { goto no_btls; } -#if OPAL_HAVE_THREADS if (mca_btl_openib_component.num_srq_qps > 0 || mca_btl_openib_component.num_xrc_qps > 0) { opal_hash_table_t *srq_addr_table = &mca_btl_openib_component.srq_manager.srq_addr_table; @@ -2807,7 +2783,6 @@ btl_openib_component_init(int *num_btl_modules, goto no_btls; } } -#endif /* For XRC: * from this point we know if MCA_BTL_XRC_ENABLED it true or false */ @@ -3713,12 +3688,10 @@ static int btl_openib_component_progress(void) int i; int count = 0; -#if OPAL_HAVE_THREADS if(OPAL_UNLIKELY(mca_btl_openib_component.use_async_event_thread && mca_btl_openib_component.error_counter)) { goto error; } -#endif for(i = 0; i < mca_btl_openib_component.devices_count; i++) { mca_btl_openib_device_t *device = @@ -3749,7 +3722,6 @@ static int btl_openib_component_progress(void) return count; -#if OPAL_HAVE_THREADS error: /* Set the fatal counter to zero */ mca_btl_openib_component.error_counter = 0; @@ -3770,7 +3742,6 @@ error: } } return count; -#endif } int mca_btl_openib_post_srr(mca_btl_openib_module_t* openib_btl, const int qp) diff --git a/opal/mca/btl/openib/btl_openib_endpoint.c b/opal/mca/btl/openib/btl_openib_endpoint.c index 165256f3c4..4b22cff9ac 100644 --- a/opal/mca/btl/openib/btl_openib_endpoint.c +++ b/opal/mca/btl/openib/btl_openib_endpoint.c @@ -592,7 +592,6 @@ void mca_btl_openib_endpoint_connected(mca_btl_openib_endpoint_t *endpoint) } /* Run over all qps and load alternative path */ -#if OPAL_HAVE_THREADS if (APM_ENABLED) { int i; if (MCA_BTL_XRC_ENABLED) { @@ -605,7 +604,6 @@ void mca_btl_openib_endpoint_connected(mca_btl_openib_endpoint_t *endpoint) } } } -#endif endpoint->endpoint_state = MCA_BTL_IB_CONNECTED; endpoint->endpoint_btl->device->non_eager_rdma_endpoints++; diff --git a/opal/mca/btl/openib/btl_openib_fd.c b/opal/mca/btl/openib/btl_openib_fd.c index 1dc9b16f38..76f87b09f0 100644 --- a/opal/mca/btl/openib/btl_openib_fd.c +++ b/opal/mca/btl/openib/btl_openib_fd.c @@ -1,6 +1,8 @@ /* * Copyright (c) 2008-2013 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2009 Sandia National Laboratories. All rights reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * * $COPYRIGHT$ * @@ -10,7 +12,7 @@ */ /** - * Note: this file is a little fast-n-loose with OPAL_HAVE_THREADS -- + * Note: this file is a little fast-n-loose -- * it uses this value in run-time "if" conditionals (vs. compile-time * #if conditionals). We also don't protect including . * That's because this component currently only compiles on Linux and @@ -487,36 +489,34 @@ int opal_btl_openib_fd_init(void) /* Calculate the real size of the cmd struct */ cmd_size = (int) (&(bogus.end) - ((char*) &bogus)); - if (OPAL_HAVE_THREADS) { - OBJ_CONSTRUCT(&pending_to_main_thread, opal_list_t); + OBJ_CONSTRUCT(&pending_to_main_thread, opal_list_t); - /* Create pipes to communicate between the two threads */ - if (0 != pipe(pipe_to_service_thread)) { - return OPAL_ERR_IN_ERRNO; - } - if (0 != pipe(pipe_to_main_thread)) { - return OPAL_ERR_IN_ERRNO; - } + /* Create pipes to communicate between the two threads */ + if (0 != pipe(pipe_to_service_thread)) { + return OPAL_ERR_IN_ERRNO; + } + if (0 != pipe(pipe_to_main_thread)) { + return OPAL_ERR_IN_ERRNO; + } - /* Create a libevent event that is used in the main thread - to watch its pipe */ - opal_event_set(opal_event_base, &main_thread_event, pipe_to_main_thread[0], - OPAL_EV_READ | OPAL_EV_PERSIST, - main_thread_event_callback, NULL); - opal_event_add(&main_thread_event, 0); + /* Create a libevent event that is used in the main thread + to watch its pipe */ + opal_event_set(opal_event_base, &main_thread_event, pipe_to_main_thread[0], + OPAL_EV_READ | OPAL_EV_PERSIST, + main_thread_event_callback, NULL); + opal_event_add(&main_thread_event, 0); - /* Start the service thread */ - if (0 != pthread_create(&thread, NULL, service_thread_start, - NULL)) { - int errno_save = errno; - opal_event_del(&main_thread_event); - close(pipe_to_service_thread[0]); - close(pipe_to_service_thread[1]); - close(pipe_to_main_thread[0]); - close(pipe_to_main_thread[1]); - errno = errno_save; - return OPAL_ERR_IN_ERRNO; - } + /* Start the service thread */ + if (0 != pthread_create(&thread, NULL, service_thread_start, + NULL)) { + int errno_save = errno; + opal_event_del(&main_thread_event); + close(pipe_to_service_thread[0]); + close(pipe_to_service_thread[1]); + close(pipe_to_main_thread[0]); + close(pipe_to_main_thread[1]); + errno = errno_save; + return OPAL_ERR_IN_ERRNO; } initialized = true; @@ -545,14 +545,9 @@ int opal_btl_openib_fd_monitor(int fd, int flags, cmd.pc_flags = flags; cmd.pc_fn.event = callback; cmd.pc_context = context; - if (OPAL_HAVE_THREADS) { - /* For the threaded version, write a command down the pipe */ - OPAL_OUTPUT((-1, "main thread sending monitor fd %d", fd)); - opal_fd_write(pipe_to_service_thread[1], cmd_size, &cmd); - } else { - /* Otherwise, add it directly */ - service_pipe_cmd_add_fd(true, &cmd); - } + /* For the threaded version, write a command down the pipe */ + OPAL_OUTPUT((-1, "main thread sending monitor fd %d", fd)); + opal_fd_write(pipe_to_service_thread[1], cmd_size, &cmd); return OPAL_SUCCESS; } @@ -578,14 +573,9 @@ int opal_btl_openib_fd_unmonitor(int fd, cmd.pc_flags = 0; cmd.pc_fn.event = callback; cmd.pc_context = context; - if (OPAL_HAVE_THREADS) { - /* For the threaded version, write a command down the pipe */ - OPAL_OUTPUT((-1, "main thread sending unmonitor fd %d", fd)); - opal_fd_write(pipe_to_service_thread[1], cmd_size, &cmd); - } else { - /* Otherwise, remove it directly */ - service_pipe_cmd_remove_fd(&cmd); - } + /* For the threaded version, write a command down the pipe */ + OPAL_OUTPUT((-1, "main thread sending unmonitor fd %d", fd)); + opal_fd_write(pipe_to_service_thread[1], cmd_size, &cmd); return OPAL_SUCCESS; } @@ -604,14 +594,9 @@ int opal_btl_openib_fd_run_in_service(opal_btl_openib_fd_main_callback_fn_t *cal cmd.pc_flags = 0; cmd.pc_fn.main = callback; cmd.pc_context = context; - if (OPAL_HAVE_THREADS) { - /* For the threaded version, write a command down the pipe */ - OPAL_OUTPUT((-1, "main thread sending 'run in service'")); - opal_fd_write(pipe_to_service_thread[1], cmd_size, &cmd); - } else { - /* Otherwise, run it directly */ - callback(context); - } + /* For the threaded version, write a command down the pipe */ + OPAL_OUTPUT((-1, "main thread sending 'run in service'")); + opal_fd_write(pipe_to_service_thread[1], cmd_size, &cmd); return OPAL_SUCCESS; } @@ -623,22 +608,16 @@ int opal_btl_openib_fd_run_in_service(opal_btl_openib_fd_main_callback_fn_t *cal int opal_btl_openib_fd_run_in_main(opal_btl_openib_fd_main_callback_fn_t *callback, void *context) { - if (OPAL_HAVE_THREADS) { - cmd_t cmd; + cmd_t cmd; - OPAL_OUTPUT((-1, "run in main -- sending command")); - /* For the threaded version, write a command down the pipe */ - cmd.pc_cmd = CMD_CALL_FUNCTION; - cmd.pc_fd = -1; - cmd.pc_flags = 0; - cmd.pc_fn.main = callback; - cmd.pc_context = context; - write_to_main_thread(&cmd); - } else { - /* Otherwise, call it directly */ - OPAL_OUTPUT((-1, "run in main -- calling now!")); - callback(context); - } + OPAL_OUTPUT((-1, "run in main -- sending command")); + /* For the threaded version, write a command down the pipe */ + cmd.pc_cmd = CMD_CALL_FUNCTION; + cmd.pc_fd = -1; + cmd.pc_flags = 0; + cmd.pc_fn.main = callback; + cmd.pc_context = context; + write_to_main_thread(&cmd); return OPAL_SUCCESS; } @@ -677,37 +656,35 @@ opal_btl_openib_fd_main_thread_drain(void) int opal_btl_openib_fd_finalize(void) { if (initialized) { - if (OPAL_HAVE_THREADS) { - /* For the threaded version, send a command down the pipe */ - cmd_t cmd; - OPAL_OUTPUT((-1, "shutting down openib fd")); - /* Check if the thread exists before asking it to quit */ - if (ESRCH != pthread_kill(thread, 0)) { - memset(&cmd, 0, cmd_size); - cmd.pc_cmd = CMD_TIME_TO_QUIT; - if (OPAL_SUCCESS != opal_fd_write(pipe_to_service_thread[1], - cmd_size, &cmd)) { - /* We cancel the thread if there's an error - * sending the "quit" cmd. This only ever happens on - * a "restart" which could result in dangling - * fds. OMPI must not rely on the checkpointer to - * save/restore any fds or connections - */ - pthread_cancel(thread); - } - - pthread_join(thread, NULL); - opal_atomic_rmb(); + /* For the threaded version, send a command down the pipe */ + cmd_t cmd; + OPAL_OUTPUT((-1, "shutting down openib fd")); + /* Check if the thread exists before asking it to quit */ + if (ESRCH != pthread_kill(thread, 0)) { + memset(&cmd, 0, cmd_size); + cmd.pc_cmd = CMD_TIME_TO_QUIT; + if (OPAL_SUCCESS != opal_fd_write(pipe_to_service_thread[1], + cmd_size, &cmd)) { + /* We cancel the thread if there's an error + * sending the "quit" cmd. This only ever happens on + * a "restart" which could result in dangling + * fds. OMPI must not rely on the checkpointer to + * save/restore any fds or connections + */ + pthread_cancel(thread); } - opal_event_del(&main_thread_event); - - close(pipe_to_service_thread[0]); - close(pipe_to_service_thread[1]); - close(pipe_to_main_thread[0]); - close(pipe_to_main_thread[1]); - OBJ_DESTRUCT(&pending_to_main_thread); + pthread_join(thread, NULL); + opal_atomic_rmb(); } + + opal_event_del(&main_thread_event); + + close(pipe_to_service_thread[0]); + close(pipe_to_service_thread[1]); + close(pipe_to_main_thread[0]); + close(pipe_to_main_thread[1]); + OBJ_DESTRUCT(&pending_to_main_thread); OBJ_DESTRUCT(®istered_items); } initialized = false; diff --git a/opal/mca/btl/openib/btl_openib_mca.c b/opal/mca/btl/openib/btl_openib_mca.c index 276ed1e08b..94f267c9b3 100644 --- a/opal/mca/btl/openib/btl_openib_mca.c +++ b/opal/mca/btl/openib/btl_openib_mca.c @@ -16,7 +16,7 @@ * Copyright (c) 2006-2007 Voltaire All rights reserved. * Copyright (c) 2009-2010 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013-2014 NVIDIA Corporation. All rights reserved. - * Copyright (c) 2014 Research Organization for Information Science + * Copyright (c) 2014-2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Intel, Inc. All rights reserved. * $COPYRIGHT$ @@ -460,7 +460,6 @@ int btl_openib_register_mca_params(void) "(must be >= 0, where 0 = use all available)", 1, &mca_btl_openib_component.max_lmc, 0)); -#if OPAL_HAVE_THREADS CHECK(reg_int("enable_apm_over_lmc", NULL, "Maximum number of alternative paths for each device port " "(must be >= -1, where 0 = disable apm, -1 = all available alternative paths )", 0, &mca_btl_openib_component.apm_lmc, REGINT_NEG_ONE_OK|REGINT_GE_ZERO)); @@ -501,9 +500,6 @@ int btl_openib_register_mca_params(void) "Enable/Disable on demand SRQ resize. " "(0 = without resizing, nonzero = with resizing)", 1, &mca_btl_openib_component.enable_srq_resize)); -#else - mca_btl_openib_component.enable_srq_resize = false; -#endif #if HAVE_DECL_IBV_LINK_LAYER_ETHERNET CHECK(reg_bool("rroce_enable", NULL, diff --git a/opal/mca/btl/openib/configure.m4 b/opal/mca/btl/openib/configure.m4 index 78920f8f25..5ca6a1af9c 100644 --- a/opal/mca/btl/openib/configure.m4 +++ b/opal/mca/btl/openib/configure.m4 @@ -14,6 +14,8 @@ # Copyright (c) 2008-2011 Mellanox Technologies. All rights reserved. # Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2013 NVIDIA Corporation. All rights reserved. +# Copyright (c) 2015 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -37,7 +39,7 @@ AC_DEFUN([MCA_opal_btl_openib_POST_CONFIG], [ AC_DEFUN([MCA_opal_btl_openib_CONFIG],[ AC_CONFIG_FILES([opal/mca/btl/openib/Makefile]) - OPAL_VAR_SCOPE_PUSH([cpcs have_threads LDFLAGS_save LIBS_save]) + OPAL_VAR_SCOPE_PUSH([cpcs LDFLAGS_save LIBS_save]) cpcs="oob" OPAL_CHECK_OPENFABRICS([btl_openib], @@ -57,19 +59,11 @@ AC_DEFUN([MCA_opal_btl_openib_CONFIG],[ $1], [$2]) - AC_MSG_CHECKING([for thread support (needed for rdmacm/udcm)]) - have_threads=`echo $THREAD_TYPE | awk '{ print [$]1 }'` - if test "x$have_threads" = "x"; then - have_threads=none - fi - AC_MSG_RESULT([$have_threads]) - AS_IF([test "$btl_openib_happy" = "yes"], [if test "x$btl_openib_have_xrc" = "x1"; then cpcs="$cpcs xoob" fi - if test "x$btl_openib_have_rdmacm" = "x1" -a \ - "$have_threads" != "none"; then + if test "x$btl_openib_have_rdmacm" = "x1"; then cpcs="$cpcs rdmacm" if test "$enable_openib_rdmacm_ibaddr" = "yes"; then AC_MSG_CHECKING([IB addressing]) @@ -103,8 +97,7 @@ AC_DEFUN([MCA_opal_btl_openib_CONFIG],[ AC_DEFINE(BTL_OPENIB_RDMACM_IB_ADDR, 0, rdmacm without IB_AF addressing support) fi fi - if test "x$btl_openib_have_udcm" = "x1" -a \ - "$have_threads" != "none"; then + if test "x$btl_openib_have_udcm" = "x1"; then cpcs="$cpcs udcm" fi AC_MSG_CHECKING([which openib btl cpcs will be built]) diff --git a/opal/mca/btl/openib/connect/btl_openib_connect_base.c b/opal/mca/btl/openib/connect/btl_openib_connect_base.c index e92105cd42..11c64f5785 100644 --- a/opal/mca/btl/openib/connect/btl_openib_connect_base.c +++ b/opal/mca/btl/openib/connect/btl_openib_connect_base.c @@ -5,6 +5,8 @@ * Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2013-2014 Intel, Inc. All rights reserved + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * * $COPYRIGHT$ * @@ -18,10 +20,10 @@ #include "btl_openib_proc.h" #include "connect/base.h" #include "connect/btl_openib_connect_empty.h" -#if OPAL_HAVE_RDMACM && OPAL_HAVE_THREADS +#if OPAL_HAVE_RDMACM #include "connect/btl_openib_connect_rdmacm.h" #endif -#if OPAL_HAVE_UDCM && OPAL_HAVE_THREADS +#if OPAL_HAVE_UDCM #include "connect/btl_openib_connect_udcm.h" #endif @@ -44,19 +46,11 @@ static opal_btl_openib_connect_base_component_t *all[] = { /* Always have an entry here so that the CP indexes will always be the same: if RDMA CM is not available, use the "empty" CPC */ -#if OPAL_HAVE_RDMACM && OPAL_HAVE_THREADS &opal_btl_openib_connect_rdmacm, -#else - &opal_btl_openib_connect_empty, -#endif /* Always have an entry here so that the CP indexes will always be the same: if UD CM is not enabled, use the "empty" CPC */ -#if OPAL_HAVE_UDCM && OPAL_HAVE_THREADS &opal_btl_openib_connect_udcm, -#else - &opal_btl_openib_connect_empty, -#endif NULL }; diff --git a/opal/mca/btl/openib/connect/btl_openib_connect_udcm.c b/opal/mca/btl/openib/connect/btl_openib_connect_udcm.c index 5f24701d6a..5e9d3874bf 100644 --- a/opal/mca/btl/openib/connect/btl_openib_connect_udcm.c +++ b/opal/mca/btl/openib/connect/btl_openib_connect_udcm.c @@ -875,7 +875,6 @@ static void udcm_module_destroy_listen_qp (udcm_module_t *m) return; } -#if OPAL_HAVE_THREADS if (mca_btl_openib_component.use_async_event_thread && -1 != mca_btl_openib_component.async_pipe[1]) { /* Tell the openib async thread to ignore ERR state on the QP @@ -894,7 +893,6 @@ static void udcm_module_destroy_listen_qp (udcm_module_t *m) BTL_ERROR(("Command to openib async thread to ignore QP ERR state failed")); } } -#endif do { /* Move listen QP into the ERR state to cancel all outstanding @@ -2681,7 +2679,6 @@ static int udcm_xrc_recv_qp_create (mca_btl_openib_endpoint_t *lcl_ep, udcm_msg_ return OPAL_ERROR; } #endif -#if OPAL_HAVE_THREADS if (APM_ENABLED) { #if OPAL_HAVE_CONNECTX_XRC_DOMAINS mca_btl_openib_load_apm(lcl_ep->xrc_recv_qp, lcl_ep); @@ -2689,7 +2686,6 @@ static int udcm_xrc_recv_qp_create (mca_btl_openib_endpoint_t *lcl_ep, udcm_msg_ mca_btl_openib_load_apm_xrc_rcv(lcl_ep->xrc_recv_qp_num, lcl_ep); #endif } -#endif return OPAL_SUCCESS; } diff --git a/opal/mca/memory/linux/Makefile.am b/opal/mca/memory/linux/Makefile.am index 152932a63a..2d81d81d43 100644 --- a/opal/mca/memory/linux/Makefile.am +++ b/opal/mca/memory/linux/Makefile.am @@ -10,6 +10,8 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2009-2010 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2015 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -19,12 +21,10 @@ AM_CPPFLAGS = -DMALLOC_DEBUG=0 -if OPAL_HAVE_POSIX_THREADS AM_CPPFLAGS += \ -D_GNU_SOURCE=1 \ -DMALLOC_HOOKS=1 \ -I$(srcdir)/sysdeps/pthread -endif # this must come *after* the threads -Is AM_CPPFLAGS += -I$(srcdir)/sysdeps/generic diff --git a/opal/runtime/opal_init.c b/opal/runtime/opal_init.c index 4be54a7bc2..32a8f0275d 100644 --- a/opal/runtime/opal_init.c +++ b/opal/runtime/opal_init.c @@ -16,6 +16,8 @@ * Copyright (c) 2010-2013 Los Alamos National Security, LLC. * All rights reserved. * Copyright (c) 2013-2014 Intel, Inc. All rights reserved + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -607,7 +609,6 @@ int opal_init_test(void) return ret; } -#if OPAL_HAVE_POSIX_THREADS static bool fork_warning_issued = false; static bool atfork_called = false; @@ -619,14 +620,11 @@ static void warn_fork_cb(void) fork_warning_issued = true; } } -#endif /* OPAL_HAVE_POSIX_THREADS */ void opal_warn_fork(void) { -#if OPAL_HAVE_POSIX_THREADS if (opal_warn_on_fork && !atfork_called) { pthread_atfork(warn_fork_cb, NULL, NULL); atfork_called = true; } -#endif } diff --git a/opal/threads/Makefile.am b/opal/threads/Makefile.am index d31bd7dec6..661f22fc47 100644 --- a/opal/threads/Makefile.am +++ b/opal/threads/Makefile.am @@ -11,6 +11,8 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2015 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -31,5 +33,4 @@ headers += \ lib@OPAL_LIB_PREFIX@open_pal_la_SOURCES += \ threads/condition.c \ threads/mutex.c \ - threads/thread.c \ - threads/tsd.c + threads/thread.c diff --git a/opal/threads/condition.h b/opal/threads/condition.h index e9cc2634ea..40ca3571b8 100644 --- a/opal/threads/condition.h +++ b/opal/threads/condition.h @@ -11,6 +11,8 @@ * All rights reserved. * Copyright (c) 2007 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -27,9 +29,7 @@ #ifdef HAVE_TIME_H #include #endif -#if OPAL_HAVE_POSIX_THREADS #include -#endif #include "opal/threads/mutex.h" #include "opal/runtime/opal_progress.h" diff --git a/opal/threads/mutex.c b/opal/threads/mutex.c index de42771ca5..70b384ffcd 100644 --- a/opal/threads/mutex.c +++ b/opal/threads/mutex.c @@ -11,6 +11,8 @@ * All rights reserved. * Copyright (c) 2007-2013 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -32,8 +34,6 @@ bool opal_uses_threads = false; static void opal_mutex_construct(opal_mutex_t *m) { -#if OPAL_HAVE_POSIX_THREADS - #if OPAL_ENABLE_DEBUG pthread_mutexattr_t attr; pthread_mutexattr_init(&attr); @@ -48,6 +48,9 @@ static void opal_mutex_construct(opal_mutex_t *m) pthread_mutex_init(&m->m_lock_pthread, &attr); pthread_mutexattr_destroy(&attr); + m->m_lock_debug = 0; + m->m_lock_file = NULL; + m->m_lock_line = 0; #else /* Without debugging, choose the fastest available mutexes */ @@ -55,14 +58,6 @@ static void opal_mutex_construct(opal_mutex_t *m) #endif /* OPAL_ENABLE_DEBUG */ -#endif - -#if OPAL_ENABLE_DEBUG - m->m_lock_debug = 0; - m->m_lock_file = NULL; - m->m_lock_line = 0; -#endif - #if OPAL_HAVE_ATOMIC_SPINLOCKS opal_atomic_init( &m->m_lock_atomic, OPAL_ATOMIC_UNLOCKED ); #endif @@ -70,9 +65,7 @@ static void opal_mutex_construct(opal_mutex_t *m) static void opal_mutex_destruct(opal_mutex_t *m) { -#if OPAL_HAVE_POSIX_THREADS pthread_mutex_destroy(&m->m_lock_pthread); -#endif } OBJ_CLASS_INSTANCE(opal_mutex_t, diff --git a/opal/threads/mutex_unix.h b/opal/threads/mutex_unix.h index ac0e143a6e..80f6793dc2 100644 --- a/opal/threads/mutex_unix.h +++ b/opal/threads/mutex_unix.h @@ -11,6 +11,8 @@ * All rights reserved. * Copyright (c) 2007 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -34,13 +36,11 @@ #include "opal_config.h" -#if OPAL_HAVE_POSIX_THREADS #ifdef HAVE_PTHREAD_H #include #endif #include #include -#endif #include "opal/class/opal_object.h" #include "opal/sys/atomic.h" @@ -50,9 +50,7 @@ BEGIN_C_DECLS struct opal_mutex_t { opal_object_t super; -#if OPAL_HAVE_POSIX_THREADS pthread_mutex_t m_lock_pthread; -#endif #if OPAL_ENABLE_DEBUG int m_lock_debug; @@ -70,12 +68,6 @@ OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_mutex_t); * ************************************************************************/ -#if OPAL_HAVE_POSIX_THREADS - -/************************************************************************ - * POSIX threads - ************************************************************************/ - static inline int opal_mutex_trylock(opal_mutex_t *m) { #if OPAL_ENABLE_DEBUG @@ -119,34 +111,6 @@ static inline void opal_mutex_unlock(opal_mutex_t *m) #endif } -#elif OPAL_HAVE_ATOMIC_SPINLOCKS - -/************************************************************************ - * Spin Locks - ************************************************************************/ - -static inline int opal_mutex_trylock(opal_mutex_t *m) -{ - return opal_atomic_trylock(&m->m_lock_atomic); -} - -static inline void opal_mutex_lock(opal_mutex_t *m) -{ - opal_atomic_lock(&m->m_lock_atomic); -} - -static inline void opal_mutex_unlock(opal_mutex_t *m) -{ - opal_atomic_unlock(&m->m_lock_atomic); -} - -#else - -#error No mutex definition - -#endif - - /************************************************************************ * * mutex operations (atomic versions) diff --git a/opal/threads/thread.c b/opal/threads/thread.c index eb00ead7aa..4488c55b0f 100644 --- a/opal/threads/thread.c +++ b/opal/threads/thread.c @@ -10,6 +10,8 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -37,17 +39,9 @@ OBJ_CLASS_INSTANCE(opal_thread_t, static void opal_thread_construct(opal_thread_t *t) { t->t_run = 0; -#if OPAL_HAVE_POSIX_THREADS t->t_handle = (pthread_t) -1; -#endif } -#if OPAL_HAVE_POSIX_THREADS - -/************************************************************************ - * POSIX threads - ************************************************************************/ - int opal_thread_start(opal_thread_t *t) { int rc; @@ -89,38 +83,3 @@ void opal_thread_kill(opal_thread_t *t, int sig) { pthread_kill(t->t_handle, sig); } - - -#else - -/************************************************************************ - * No thread support - ************************************************************************/ - -int opal_thread_start(opal_thread_t *t) -{ - return OPAL_ERROR; -} - - -int opal_thread_join(opal_thread_t *t, void **thr_return) -{ - return OPAL_ERROR; -} - - -bool opal_thread_self_compare(opal_thread_t *t) -{ - return true; -} - -opal_thread_t *opal_thread_get_self(void) -{ - return NULL; -} - -void opal_thread_kill(opal_thread_t *t, int sig) -{ -} - -#endif diff --git a/opal/threads/threads.h b/opal/threads/threads.h index f7040754c9..c73bef7f94 100644 --- a/opal/threads/threads.h +++ b/opal/threads/threads.h @@ -11,6 +11,8 @@ * All rights reserved. * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -23,9 +25,7 @@ #include "opal_config.h" -#if OPAL_HAVE_POSIX_THREADS #include -#endif #ifdef HAVE_SIGNAL_H #include #endif @@ -48,9 +48,7 @@ struct opal_thread_t { opal_object_t super; opal_thread_fn_t t_run; void* t_arg; -#ifdef OPAL_HAVE_POSIX_THREADS pthread_t t_handle; -#endif }; typedef struct opal_thread_t opal_thread_t; diff --git a/opal/threads/tsd.c b/opal/threads/tsd.c deleted file mode 100644 index 982dd3e393..0000000000 --- a/opal/threads/tsd.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2007-2013 Los Alamos National Security, LLC. All rights - * reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - - -#include "opal_config.h" - -#include -# if HAVE_STDLIB_H -#include -#endif - -#include - -#include "opal/threads/tsd.h" - -#if !OPAL_HAVE_POSIX_THREADS - -#define TSD_ENTRIES 32 - -struct tsd_entry_t { - bool used; - void *value; - opal_tsd_destructor_t destructor; -}; -typedef struct tsd_entry_t tsd_entry_t; - -static tsd_entry_t entries[TSD_ENTRIES]; -static bool atexit_registered = false; - -static void -run_destructors(void) -{ - int i; - - for (i = 0; i < TSD_ENTRIES ; ++i) { - opal_tsd_destructor_t destructor; - void *value; - - if (entries[i].used) { - destructor = entries[i].destructor; - value = entries[i].value; - - entries[i].used = false; - entries[i].destructor = NULL; - entries[i].value = NULL; - - destructor(value); - } - } -} - -int -opal_tsd_key_create(opal_tsd_key_t *key, - opal_tsd_destructor_t destructor) -{ - int i; - - if (!atexit_registered) { - atexit_registered = true; - if (0 != atexit(run_destructors)) { - return OPAL_ERR_TEMP_OUT_OF_RESOURCE; - } - } - - for (i = 0 ; i < TSD_ENTRIES ; ++i) { - if (entries[i].used == false) { - entries[i].used = true; - entries[i].value = NULL; - entries[i].destructor = destructor; - *key = i; - break; - } - } - if (i == TSD_ENTRIES) return ENOMEM; - - return OPAL_SUCCESS; -} - - -int -opal_tsd_key_delete(opal_tsd_key_t key) -{ - if (!entries[key].used) return OPAL_ERR_BAD_PARAM; - - entries[key].used = false; - entries[key].value = NULL; - entries[key].destructor = NULL; - - return OPAL_SUCCESS; -} - - -int -opal_tsd_setspecific(opal_tsd_key_t key, void *value) -{ - if (!entries[key].used) return OPAL_ERR_BAD_PARAM; - entries[key].value = value; - return OPAL_SUCCESS; -} - - -int -opal_tsd_getspecific(opal_tsd_key_t key, void **valuep) -{ - if (!entries[key].used) return OPAL_ERR_BAD_PARAM; - *valuep = entries[key].value; - return OPAL_SUCCESS; -} - -#endif diff --git a/opal/threads/tsd.h b/opal/threads/tsd.h index 60bd405cfc..97b026017d 100644 --- a/opal/threads/tsd.h +++ b/opal/threads/tsd.h @@ -2,6 +2,8 @@ * Copyright (c) 2007-2013 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -15,9 +17,7 @@ #include "opal_config.h" -#if OPAL_HAVE_POSIX_THREADS #include -#endif #include "opal/constants.h" @@ -134,7 +134,7 @@ OPAL_DECLSPEC int opal_tsd_setspecific(opal_tsd_key_t key, void *value); */ OPAL_DECLSPEC int opal_tsd_getspecific(opal_tsd_key_t key, void **valuep); -#elif OPAL_HAVE_POSIX_THREADS +#else typedef pthread_key_t opal_tsd_key_t; @@ -164,19 +164,6 @@ opal_tsd_getspecific(opal_tsd_key_t key, void **valuep) return OPAL_SUCCESS; } -#else - -typedef int opal_tsd_key_t; - -OPAL_DECLSPEC int opal_tsd_key_create(opal_tsd_key_t *key, - opal_tsd_destructor_t destructor); - -OPAL_DECLSPEC int opal_tsd_key_delete(opal_tsd_key_t key); - -OPAL_DECLSPEC int opal_tsd_setspecific(opal_tsd_key_t key, void *value); - -OPAL_DECLSPEC int opal_tsd_getspecific(opal_tsd_key_t key, void **valuep); - #endif END_C_DECLS diff --git a/orte/tools/orte-info/param.c b/orte/tools/orte-info/param.c index 35ab78df4c..1b6f82c380 100644 --- a/orte/tools/orte-info/param.c +++ b/orte/tools/orte-info/param.c @@ -11,6 +11,8 @@ * All rights reserved. * Copyright (c) 2007-2011 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -354,13 +356,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_POSIX_THREADS) { /* should just test OPAL_HAVE_THREADS */ - asprintf(&threads, "%s (OPAL: %s, ORTE progress: yes, Event lib: yes)", - (OPAL_HAVE_POSIX_THREADS ? "posix" : "type unknown"), /* "type unknown" can presumably never happen */ - OPAL_ENABLE_MULTI_THREADS ? "yes" : "no"); - } else { - threads = strdup("no"); - } + asprintf(&threads, "%s (OPAL: %s, ORTE progress: yes, Event lib: yes)", + "posix", + OPAL_ENABLE_MULTI_THREADS ? "yes" : "no"); asprintf(&ft_support, "%s (checkpoint thread: %s)", OPAL_ENABLE_FT ? "yes" : "no", OPAL_ENABLE_FT_THREAD ? "yes" : "no");; diff --git a/oshmem/tools/oshmem_info/param.c b/oshmem/tools/oshmem_info/param.c index 1e23693789..6736af7518 100644 --- a/oshmem/tools/oshmem_info/param.c +++ b/oshmem/tools/oshmem_info/param.c @@ -263,23 +263,19 @@ void oshmem_info_do_config(bool want_all) fortran_have_ignore_tkr = strdup("no"); } - if (OPAL_HAVE_POSIX_THREADS) { /* should just test OPAL_HAVE_THREADS */ #if OMPI_RTE_ORTE - (void)asprintf(&threads, "%s (MPI_THREAD_MULTIPLE: %s, OPAL support: %s, OMPI progress: %s, ORTE progress: yes, Event lib: yes)", - (OPAL_HAVE_POSIX_THREADS ? "posix" : "type unknown"), /* "type unknown" can presumably never happen */ - OMPI_ENABLE_THREAD_MULTIPLE ? "yes" : "no", - OPAL_ENABLE_MULTI_THREADS ? "yes" : "no", - OPAL_ENABLE_PROGRESS_THREADS ? "yes" : "no"); + (void)asprintf(&threads, "%s (MPI_THREAD_MULTIPLE: %s, OPAL support: %s, OMPI progress: %s, ORTE progress: yes, Event lib: yes)", + "posix", + OMPI_ENABLE_THREAD_MULTIPLE ? "yes" : "no", + OPAL_ENABLE_MULTI_THREADS ? "yes" : "no", + OPAL_ENABLE_PROGRESS_THREADS ? "yes" : "no"); #else - (void)asprintf(&threads, "%s (MPI_THREAD_MULTIPLE: %s, OPAL support: %s, OMPI progress: %s, Event lib: yes)", - (OPAL_HAVE_POSIX_THREADS ? "posix" : "type unknown"), /* "type unknown" can presumably never happen */ - OMPI_ENABLE_THREAD_MULTIPLE ? "yes" : "no", - OPAL_ENABLE_MULTI_THREADS ? "yes" : "no", - OPAL_ENABLE_PROGRESS_THREADS ? "yes" : "no"); + (void)asprintf(&threads, "%s (MPI_THREAD_MULTIPLE: %s, OPAL support: %s, OMPI progress: %s, Event lib: yes)", + "posix", + OMPI_ENABLE_THREAD_MULTIPLE ? "yes" : "no", + OPAL_ENABLE_MULTI_THREADS ? "yes" : "no", + OPAL_ENABLE_PROGRESS_THREADS ? "yes" : "no"); #endif - } else { - threads = strdup("no"); - } (void)asprintf(&ft_support, "%s (checkpoint thread: %s)", OPAL_ENABLE_FT ? "yes" : "no", OPAL_ENABLE_FT_THREAD ? "yes" : "no"); diff --git a/test/asm/atomic_cmpset.c b/test/asm/atomic_cmpset.c index e3305e2ef1..6161b8f12d 100644 --- a/test/asm/atomic_cmpset.c +++ b/test/asm/atomic_cmpset.c @@ -10,6 +10,8 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -62,7 +64,6 @@ void *oldptr; void *newptr; -#if OPAL_HAVE_POSIX_THREADS static void *thread_main(void *arg) { int rank = (int) (unsigned long) arg; @@ -80,15 +81,11 @@ static void *thread_main(void *arg) return (void *) (unsigned long) (rank + 1000); } -#endif - int main(int argc, char *argv[]) { -#if OPAL_HAVE_POSIX_THREADS int tid; pthread_t *th; -#endif if (argc != 2) { printf("*** Incorrect number of arguments. Skipping test\n"); @@ -252,7 +249,6 @@ int main(int argc, char *argv[]) valint = 0; /* -- create the thread set -- */ -#if OPAL_HAVE_POSIX_THREADS th = (pthread_t *) malloc(nthreads * sizeof(pthread_t)); if (!th) { perror("malloc"); @@ -285,7 +281,6 @@ int main(int argc, char *argv[]) #endif opal_atomic_rmb(); assert((5 * nthreads * nreps) == valint); -#endif return 0; } diff --git a/test/asm/atomic_math.c b/test/asm/atomic_math.c index 6bede9ac7b..9729da57ea 100644 --- a/test/asm/atomic_math.c +++ b/test/asm/atomic_math.c @@ -10,6 +10,8 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -57,9 +59,8 @@ static int atomic_math_test_th(int count, int thr_count) { int value; -#if OPAL_HAVE_POSIX_THREADS pthread_t *th; - int tid, ret = 0; + int tid; th = (pthread_t *) malloc(thr_count * sizeof(pthread_t)); if (!th) { @@ -92,16 +93,6 @@ atomic_math_test_th(int count, int thr_count) } free(th); - return ret; -#else - value = count; - if (thr_count == 1) { - atomic_math_test((void*) &value); - } else { - return 77; - } -#endif - return 0; } diff --git a/test/asm/atomic_spinlock.c b/test/asm/atomic_spinlock.c index 710bc9ddce..0a102a0dfe 100644 --- a/test/asm/atomic_spinlock.c +++ b/test/asm/atomic_spinlock.c @@ -10,6 +10,8 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -40,7 +42,6 @@ struct start_info { static int atomic_spinlock_test(opal_atomic_lock_t *lock, int count, int id); -#if OPAL_HAVE_POSIX_THREADS static void* atomic_spinlock_start(void* arg) { struct start_info *data = (struct start_info*) arg; @@ -48,13 +49,10 @@ static void* atomic_spinlock_start(void* arg) return (void*) (unsigned long) atomic_spinlock_test(data->lock, data->count, data->tid); } -#endif - static int atomic_spinlock_test_th(opal_atomic_lock_t *lock, int count, int id, int thr_count) { -#if OPAL_HAVE_POSIX_THREADS pthread_t *th; int tid, ret = 0; struct start_info *data; @@ -90,9 +88,6 @@ atomic_spinlock_test_th(opal_atomic_lock_t *lock, int count, int id, int thr_cou free(th); return ret; -#else - return 77; -#endif }