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}
0 commit comments