Skip to content

Commit ae0ffbb

Browse files
committed
Merge pull request #1397 from hjelmn/enable_thread_multiple
ompi: always enable MPI_THREAD_MULTIPLE support
2 parents 628e638 + 230d043 commit ae0ffbb

File tree

18 files changed

+67
-203
lines changed

18 files changed

+67
-203
lines changed

config/ompi_config_threads.m4

Lines changed: 0 additions & 58 deletions
This file was deleted.

configure.ac

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,6 @@ OPAL_CHECK_BROKEN_QSORT
896896
# Check out what thread support we have
897897
#
898898
OPAL_CONFIG_THREADS
899-
OMPI_CONFIG_THREADS
900899

901900
CFLAGS="$CFLAGS $THREAD_CFLAGS"
902901
CPPFLAGS="$CPPFLAGS $THREAD_CPPFLAGS"

ompi/communicator/comm_cid.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,6 @@ static int ompi_comm_register_cid (uint32_t cid)
514514
if ( regcom->cid > cid ) {
515515
break;
516516
}
517-
#if OMPI_ENABLE_THREAD_MULTIPLE
518517
if( regcom->cid == cid ) {
519518
/**
520519
* The MPI standard state that is the user responsability to
@@ -527,7 +526,6 @@ static int ompi_comm_register_cid (uint32_t cid)
527526
ok = false;
528527
break;
529528
}
530-
#endif /* OMPI_ENABLE_THREAD_MULTIPLE */
531529
}
532530
if (ok) {
533531
opal_list_insert_pos (&ompi_registered_comms, (opal_list_item_t *) regcom,

ompi/mca/bml/r2/bml_r2_ft.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,7 @@ int mca_bml_r2_ft_event(int state)
170170
* This will cause the BTL components to discover the available
171171
* network options on this machine, and post proper modex informaiton.
172172
*/
173-
if( OMPI_SUCCESS != (ret = mca_btl_base_select(OPAL_ENABLE_PROGRESS_THREADS,
174-
OMPI_ENABLE_THREAD_MULTIPLE) ) ) {
173+
if( OMPI_SUCCESS != (ret = mca_btl_base_select(OPAL_ENABLE_PROGRESS_THREADS, 1) ) ) {
175174
opal_output(0, "bml:r2: ft_event(Restart): Failed to select in BTL framework\n");
176175
return ret;
177176
}
@@ -257,8 +256,7 @@ int mca_bml_r2_ft_event(int state)
257256
* This will cause the BTL components to discover the available
258257
* network options on this machine, and post proper modex informaiton.
259258
*/
260-
if( OMPI_SUCCESS != (ret = mca_btl_base_select(OPAL_ENABLE_PROGRESS_THREADS,
261-
OMPI_ENABLE_THREAD_MULTIPLE) ) ) {
259+
if( OMPI_SUCCESS != (ret = mca_btl_base_select(OPAL_ENABLE_PROGRESS_THREADS, 1) ) ) {
262260
opal_output(0, "bml:r2: ft_event(Restart): Failed to select in BTL framework\n");
263261
return ret;
264262
}

ompi/mca/io/base/io_base_file_select.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,23 +215,19 @@ int mca_io_base_file_select(ompi_file_t *file,
215215
}
216216

217217
if (OMPI_SUCCESS !=
218-
(ret = mca_fs_base_find_available(OPAL_ENABLE_PROGRESS_THREADS,
219-
OMPI_ENABLE_THREAD_MULTIPLE))) {
218+
(ret = mca_fs_base_find_available(OPAL_ENABLE_PROGRESS_THREADS, 1))) {
220219
return err;
221220
}
222221
if (OMPI_SUCCESS !=
223-
(ret = mca_fcoll_base_find_available(OPAL_ENABLE_PROGRESS_THREADS,
224-
OMPI_ENABLE_THREAD_MULTIPLE))) {
222+
(ret = mca_fcoll_base_find_available(OPAL_ENABLE_PROGRESS_THREADS, 1))) {
225223
return err;
226224
}
227225
if (OMPI_SUCCESS !=
228-
(ret = mca_fbtl_base_find_available(OPAL_ENABLE_PROGRESS_THREADS,
229-
OMPI_ENABLE_THREAD_MULTIPLE))) {
226+
(ret = mca_fbtl_base_find_available(OPAL_ENABLE_PROGRESS_THREADS, 1))) {
230227
return err;
231228
}
232229
if (OMPI_SUCCESS !=
233-
(ret = mca_sharedfp_base_find_available(OPAL_ENABLE_PROGRESS_THREADS,
234-
OMPI_ENABLE_THREAD_MULTIPLE))) {
230+
(ret = mca_sharedfp_base_find_available(OPAL_ENABLE_PROGRESS_THREADS, 1))) {
235231
return err;
236232
}
237233
}

ompi/mca/io/base/io_base_frame.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static int mca_io_base_open(mca_base_open_flag_t flags)
3838
return ret;
3939
}
4040

41-
return mca_io_base_find_available(OPAL_ENABLE_PROGRESS_THREADS, OMPI_ENABLE_THREAD_MULTIPLE);
41+
return mca_io_base_find_available(OPAL_ENABLE_PROGRESS_THREADS, 1);
4242
}
4343

4444
MCA_BASE_FRAMEWORK_DECLARE(ompi, io, "I/O", NULL, mca_io_base_open, NULL,

ompi/mca/mtl/portals4/mtl_portals4_recv_short.c

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ ompi_mtl_portals4_recv_block_progress(ptl_event_t *ev,
4343

4444
switch (ev->type) {
4545
case PTL_EVENT_AUTO_FREE:
46-
#if OMPI_ENABLE_THREAD_MULTIPLE
4746
OPAL_THREAD_LOCK(&ompi_mtl_portals4.short_block_mutex);
4847
switch (block->status) {
4948
case BLOCK_STATUS_ACTIVATED: /* May be encountered with multi threading */
@@ -73,19 +72,10 @@ ompi_mtl_portals4_recv_block_progress(ptl_event_t *ev,
7372
__FILE__, __LINE__, block->status);
7473
break;
7574
}
76-
#else
77-
if (OPAL_UNLIKELY(block->release_on_free)) {
78-
opal_list_remove_item(&ompi_mtl_portals4.recv_short_blocks,
79-
&block->base);
80-
ompi_mtl_portals4_recv_short_block_free(block);
81-
} else {
82-
ompi_mtl_portals4_activate_block(block);
83-
}
84-
#endif
75+
8576
break;
8677

8778
case PTL_EVENT_AUTO_UNLINK:
88-
#if OMPI_ENABLE_THREAD_MULTIPLE
8979
OPAL_THREAD_LOCK(&ompi_mtl_portals4.short_block_mutex);
9080
switch (block->status) {
9181
case BLOCK_STATUS_ACTIVATED: /* Normal case */
@@ -115,14 +105,10 @@ ompi_mtl_portals4_recv_block_progress(ptl_event_t *ev,
115105
__FILE__, __LINE__, block->status);
116106
break;
117107
}
118-
#else
119-
block->status = BLOCK_STATUS_WAITING_FREE;
120-
ompi_mtl_portals4.active_recv_short_blocks--;
121-
#endif
108+
122109
break;
123110

124111
case PTL_EVENT_LINK:
125-
#if OMPI_ENABLE_THREAD_MULTIPLE
126112
OPAL_THREAD_LOCK(&ompi_mtl_portals4.short_block_mutex);
127113
switch (block->status) {
128114
case BLOCK_STATUS_WAITING_LINK:
@@ -138,10 +124,7 @@ ompi_mtl_portals4_recv_block_progress(ptl_event_t *ev,
138124
__FILE__, __LINE__, block->status);
139125
break;
140126
}
141-
#else
142-
block->status = BLOCK_STATUS_ACTIVATED;
143-
ompi_mtl_portals4.active_recv_short_blocks++;
144-
#endif
127+
145128
break;
146129

147130
default:

ompi/mca/pml/ob1/pml_ob1_irecv.c

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* University of Stuttgart. All rights reserved.
1111
* Copyright (c) 2004-2005 The Regents of the University of California.
1212
* All rights reserved.
13-
* Copyright (c) 2007-2015 Los Alamos National Security, LLC. All rights
13+
* Copyright (c) 2007-2016 Los Alamos National Security, LLC. All rights
1414
* reserved.
1515
* Copyright (c) 2010-2012 Oracle and/or its affiliates. All rights reserved.
1616
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
@@ -101,16 +101,16 @@ int mca_pml_ob1_recv(void *addr,
101101
mca_pml_ob1_recv_request_t *recvreq = NULL;
102102
int rc;
103103

104-
#if !OMPI_ENABLE_THREAD_MULTIPLE
105-
recvreq = mca_pml_ob1_recvreq;
106-
mca_pml_ob1_recvreq = NULL;
107-
if( OPAL_UNLIKELY(NULL == recvreq) )
108-
#endif /* !OMPI_ENABLE_THREAD_MULTIPLE */
109-
{
110-
MCA_PML_OB1_RECV_REQUEST_ALLOC(recvreq);
111-
if (NULL == recvreq)
112-
return OMPI_ERR_TEMP_OUT_OF_RESOURCE;
113-
}
104+
if (OPAL_LIKELY(!ompi_mpi_thread_multiple)) {
105+
recvreq = mca_pml_ob1_recvreq;
106+
mca_pml_ob1_recvreq = NULL;
107+
}
108+
109+
if( OPAL_UNLIKELY(NULL == recvreq) ) {
110+
MCA_PML_OB1_RECV_REQUEST_ALLOC(recvreq);
111+
if (NULL == recvreq)
112+
return OMPI_ERR_TEMP_OUT_OF_RESOURCE;
113+
}
114114

115115
MCA_PML_OB1_RECV_REQUEST_INIT(recvreq, addr, count, datatype,
116116
src, tag, comm, false);
@@ -128,16 +128,12 @@ int mca_pml_ob1_recv(void *addr,
128128

129129
rc = recvreq->req_recv.req_base.req_ompi.req_status.MPI_ERROR;
130130

131-
#if OMPI_ENABLE_THREAD_MULTIPLE
132-
MCA_PML_OB1_RECV_REQUEST_RETURN(recvreq);
133-
#else
134-
if( NULL != mca_pml_ob1_recvreq ) {
131+
if (OPAL_UNLIKELY(ompi_mpi_thread_multiple || NULL != mca_pml_ob1_recvreq)) {
135132
MCA_PML_OB1_RECV_REQUEST_RETURN(recvreq);
136133
} else {
137134
mca_pml_ob1_recv_request_fini (recvreq);
138135
mca_pml_ob1_recvreq = recvreq;
139136
}
140-
#endif
141137

142138
return rc;
143139
}

ompi/mca/pml/ob1/pml_ob1_isend.c

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* University of Stuttgart. All rights reserved.
1111
* Copyright (c) 2004-2005 The Regents of the University of California.
1212
* All rights reserved.
13-
* Copyright (c) 2007-2015 Los Alamos National Security, LLC. All rights
13+
* Copyright (c) 2007-2016 Los Alamos National Security, LLC. All rights
1414
* reserved.
1515
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
1616
* Copyright (c) 2015 Research Organization for Information Science
@@ -230,16 +230,17 @@ int mca_pml_ob1_send(const void *buf,
230230
}
231231
}
232232

233-
#if !OMPI_ENABLE_THREAD_MULTIPLE
234-
sendreq = mca_pml_ob1_sendreq;
235-
mca_pml_ob1_sendreq = NULL;
236-
if( OPAL_UNLIKELY(NULL == sendreq) )
237-
#endif /* !OMPI_ENABLE_THREAD_MULTIPLE */
238-
{
239-
MCA_PML_OB1_SEND_REQUEST_ALLOC(comm, dst, sendreq);
240-
if (NULL == sendreq)
241-
return OMPI_ERR_TEMP_OUT_OF_RESOURCE;
242-
}
233+
if (OPAL_LIKELY(!ompi_mpi_thread_multiple)) {
234+
sendreq = mca_pml_ob1_sendreq;
235+
mca_pml_ob1_sendreq = NULL;
236+
}
237+
238+
if( OPAL_UNLIKELY(NULL == sendreq) ) {
239+
MCA_PML_OB1_SEND_REQUEST_ALLOC(comm, dst, sendreq);
240+
if (NULL == sendreq)
241+
return OMPI_ERR_TEMP_OUT_OF_RESOURCE;
242+
}
243+
243244
sendreq->req_send.req_base.req_proc = dst_proc;
244245
sendreq->rdma_frag = NULL;
245246

@@ -261,16 +262,12 @@ int mca_pml_ob1_send(const void *buf,
261262
rc = sendreq->req_send.req_base.req_ompi.req_status.MPI_ERROR;
262263
}
263264

264-
#if OMPI_ENABLE_THREAD_MULTIPLE
265-
MCA_PML_OB1_SEND_REQUEST_RETURN(sendreq);
266-
#else
267-
if( NULL != mca_pml_ob1_sendreq ) {
265+
if (OPAL_UNLIKELY(ompi_mpi_thread_multiple || NULL != mca_pml_ob1_sendreq)) {
268266
MCA_PML_OB1_SEND_REQUEST_RETURN(sendreq);
269267
} else {
270268
mca_pml_ob1_send_request_fini (sendreq);
271269
mca_pml_ob1_sendreq = sendreq;
272270
}
273-
#endif
274271

275272
return rc;
276273
}

ompi/mca/pml/v/pml_v_component.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ mca_pml_base_component_2_0_0_t mca_pml_v_component =
5656
};
5757

5858
static bool pml_v_enable_progress_treads = OPAL_ENABLE_PROGRESS_THREADS;
59-
static bool pml_v_enable_mpi_thread_multiple = OMPI_ENABLE_THREAD_MULTIPLE;
59+
static bool pml_v_enable_mpi_thread_multiple = 1;
6060

6161
static char *ompi_pml_vprotocol_include_list;
6262
static char *ompi_pml_v_output;

0 commit comments

Comments
 (0)