1717
1818static void mca_btl_uct_endpoint_construct (mca_btl_uct_endpoint_t * endpoint )
1919{
20- memset (endpoint -> uct_eps , 0 , sizeof (endpoint -> uct_eps ) );
20+ memset (endpoint -> uct_eps , 0 , sizeof (endpoint -> uct_eps [ 0 ]) * mca_btl_uct_component . num_contexts_per_module );
2121 endpoint -> conn_ep = NULL ;
2222 OBJ_CONSTRUCT (& endpoint -> ep_lock , opal_recursive_mutex_t );
2323}
2424
2525static void mca_btl_uct_endpoint_destruct (mca_btl_uct_endpoint_t * endpoint )
2626{
2727 for (int tl_index = 0 ; tl_index < 2 ; ++ tl_index ) {
28- for (int i = 0 ; i < MCA_BTL_UCT_MAX_WORKERS ; ++ i ) {
29- if (NULL != endpoint -> uct_eps [tl_index ][ i ].uct_ep ) {
30- uct_ep_destroy (endpoint -> uct_eps [tl_index ][ i ].uct_ep );
28+ for (int i = 0 ; i < mca_btl_uct_component . num_contexts_per_module ; ++ i ) {
29+ if (NULL != endpoint -> uct_eps [i ][ tl_index ].uct_ep ) {
30+ uct_ep_destroy (endpoint -> uct_eps [i ][ tl_index ].uct_ep );
3131 }
3232 }
3333 }
3434
35- memset (endpoint -> uct_eps , 0 , sizeof (endpoint -> uct_eps ));
36-
3735 OBJ_DESTRUCT (& endpoint -> ep_lock );
3836}
3937
@@ -43,12 +41,14 @@ OBJ_CLASS_INSTANCE(mca_btl_uct_endpoint_t, opal_object_t,
4341
4442mca_btl_base_endpoint_t * mca_btl_uct_endpoint_create (opal_proc_t * proc )
4543{
46- mca_btl_uct_endpoint_t * endpoint = OBJ_NEW (mca_btl_uct_endpoint_t );
44+ mca_btl_uct_endpoint_t * endpoint = calloc (1 , sizeof (* endpoint ) + sizeof (endpoint -> uct_eps [0 ]) *
45+ mca_btl_uct_component .num_contexts_per_module );
4746
4847 if (OPAL_UNLIKELY (NULL == endpoint )) {
4948 return NULL ;
5049 }
5150
51+ OBJ_CONSTRUCT (endpoint , mca_btl_uct_endpoint_t );
5252 endpoint -> ep_proc = proc ;
5353
5454 return (mca_btl_base_endpoint_t * ) endpoint ;
@@ -295,7 +295,7 @@ static int mca_btl_uct_endpoint_connect_endpoint (mca_btl_uct_module_t *uct_btl,
295295int mca_btl_uct_endpoint_connect (mca_btl_uct_module_t * uct_btl , mca_btl_uct_endpoint_t * endpoint , int context_id ,
296296 void * ep_addr , int tl_index )
297297{
298- mca_btl_uct_tl_endpoint_t * tl_endpoint = endpoint -> uct_eps [tl_index ] + context_id ;
298+ mca_btl_uct_tl_endpoint_t * tl_endpoint = endpoint -> uct_eps [context_id ] + tl_index ;
299299 mca_btl_uct_device_context_t * tl_context = mca_btl_uct_module_get_rdma_context_specific (uct_btl , context_id );
300300 mca_btl_uct_tl_t * tl = (tl_index == uct_btl -> rdma_tl -> tl_index ) ? uct_btl -> rdma_tl : uct_btl -> am_tl ;
301301 uint8_t * rdma_tl_data = NULL , * conn_tl_data = NULL , * am_tl_data = NULL , * tl_data ;
0 commit comments