11/*
2- * Copyright (c) 2013-2015 Intel, Inc. All rights reserved
2+ * Copyright (c) 2013-2016 Intel, Inc. All rights reserved
33 *
44 * $COPYRIGHT$
55 *
@@ -50,10 +50,6 @@ BEGIN_C_DECLS
5050extern mca_mtl_ofi_module_t ompi_mtl_ofi ;
5151extern mca_base_framework_t ompi_mtl_base_framework ;
5252
53- extern int ompi_mtl_ofi_add_procs (struct mca_mtl_base_module_t * mtl ,
54- size_t nprocs ,
55- struct ompi_proc_t * * procs );
56-
5753extern int ompi_mtl_ofi_del_procs (struct mca_mtl_base_module_t * mtl ,
5854 size_t nprocs ,
5955 struct ompi_proc_t * * procs );
@@ -235,7 +231,7 @@ ompi_mtl_ofi_send_start(struct mca_mtl_base_module_t *mtl,
235231 ompi_mtl_ofi_request_t * ack_req = NULL ; /* For synchronous send */
236232
237233 ompi_proc = ompi_comm_peer_lookup (comm , dest );
238- endpoint = ompi_proc -> proc_endpoints [ OMPI_PROC_ENDPOINT_TAG_MTL ] ;
234+ endpoint = ompi_mtl_ofi_get_endpoint ( mtl , ompi_proc ) ;
239235
240236 ompi_ret = ompi_mtl_datatype_pack (convertor , & start , & length , & free_after );
241237 if (OMPI_SUCCESS != ompi_ret ) return ompi_ret ;
@@ -266,6 +262,7 @@ ompi_mtl_ofi_send_start(struct mca_mtl_base_module_t *mtl,
266262 opal_output_verbose (1 , ompi_mtl_base_framework .framework_output ,
267263 "%s:%d: fi_trecv failed: %s(%zd)" ,
268264 __FILE__ , __LINE__ , fi_strerror (- ret ), ret );
265+ free (ack_req );
269266 return ompi_mtl_ofi_get_error (ret );
270267 }
271268 } else {
@@ -284,6 +281,10 @@ ompi_mtl_ofi_send_start(struct mca_mtl_base_module_t *mtl,
284281 opal_output_verbose (1 , ompi_mtl_base_framework .framework_output ,
285282 "%s:%d: fi_tinject failed: %s(%zd)" ,
286283 __FILE__ , __LINE__ , fi_strerror (- ret ), ret );
284+ if (ack_req ) {
285+ fi_cancel ((fid_t )ompi_mtl_ofi .ep , & ack_req -> ctx );
286+ free (ack_req );
287+ }
287288 return ompi_mtl_ofi_get_error (ret );
288289 }
289290
@@ -460,7 +461,7 @@ ompi_mtl_ofi_recv_callback(struct fi_cq_tagged_entry *wc,
460461 if (ompi_mtl_ofi .any_addr == ofi_req -> remote_addr ) {
461462 src = MTL_OFI_GET_SOURCE (wc -> tag );
462463 ompi_proc = ompi_comm_peer_lookup (ofi_req -> comm , src );
463- endpoint = ompi_proc -> proc_endpoints [ OMPI_PROC_ENDPOINT_TAG_MTL ] ;
464+ endpoint = ompi_mtl_ofi_get_endpoint ( ofi_req -> mtl , ompi_proc ) ;
464465 ofi_req -> remote_addr = endpoint -> peer_fiaddr ;
465466 }
466467 MTL_OFI_RETRY_UNTIL_DONE (fi_tsend (ompi_mtl_ofi .ep ,
@@ -532,7 +533,7 @@ ompi_mtl_ofi_irecv(struct mca_mtl_base_module_t *mtl,
532533
533534 if (MPI_ANY_SOURCE != src ) {
534535 ompi_proc = ompi_comm_peer_lookup (comm , src );
535- endpoint = ompi_proc -> proc_endpoints [ OMPI_PROC_ENDPOINT_TAG_MTL ] ;
536+ endpoint = ompi_mtl_ofi_get_endpoint ( mtl , ompi_proc ) ;
536537 remote_addr = endpoint -> peer_fiaddr ;
537538 } else {
538539 remote_addr = ompi_mtl_ofi .any_addr ;
@@ -744,7 +745,7 @@ ompi_mtl_ofi_iprobe(struct mca_mtl_base_module_t *mtl,
744745 */
745746 if (MPI_ANY_SOURCE != src ) {
746747 ompi_proc = ompi_comm_peer_lookup ( comm , src );
747- endpoint = ompi_proc -> proc_endpoints [ OMPI_PROC_ENDPOINT_TAG_MTL ] ;
748+ endpoint = ompi_mtl_ofi_get_endpoint ( mtl , ompi_proc ) ;
748749 remote_proc = endpoint -> peer_fiaddr ;
749750 }
750751
@@ -829,7 +830,7 @@ ompi_mtl_ofi_improbe(struct mca_mtl_base_module_t *mtl,
829830 */
830831 if (MPI_ANY_SOURCE != src ) {
831832 ompi_proc = ompi_comm_peer_lookup ( comm , src );
832- endpoint = ompi_proc -> proc_endpoints [ OMPI_PROC_ENDPOINT_TAG_MTL ] ;
833+ endpoint = ompi_mtl_ofi_get_endpoint ( mtl , ompi_proc ) ;
833834 remote_proc = endpoint -> peer_fiaddr ;
834835 }
835836
@@ -864,11 +865,13 @@ ompi_mtl_ofi_improbe(struct mca_mtl_base_module_t *mtl,
864865 * The search request completed but no matching message was found.
865866 */
866867 * matched = 0 ;
868+ free (ofi_req );
867869 return OMPI_SUCCESS ;
868870 } else if (OPAL_UNLIKELY (0 > ret )) {
869871 opal_output_verbose (1 , ompi_mtl_base_framework .framework_output ,
870872 "%s:%d: fi_trecvmsg failed: %s(%zd)" ,
871873 __FILE__ , __LINE__ , fi_strerror (- ret ), ret );
874+ free (ofi_req );
872875 return ompi_mtl_ofi_get_error (ret );
873876 }
874877
@@ -894,6 +897,7 @@ ompi_mtl_ofi_improbe(struct mca_mtl_base_module_t *mtl,
894897
895898 } else {
896899 (* message ) = MPI_MESSAGE_NULL ;
900+ free (ofi_req );
897901 }
898902
899903 return OMPI_SUCCESS ;
@@ -961,7 +965,6 @@ ompi_mtl_ofi_del_comm(struct mca_mtl_base_module_t *mtl,
961965 return OMPI_SUCCESS ;
962966}
963967
964-
965968END_C_DECLS
966969
967970#endif /* MTL_OFI_H_HAS_BEEN_INCLUDED */
0 commit comments