32
32
#include "opal/datatype/opal_convertor.h"
33
33
#include "ompi/mca/mpool/base/base.h"
34
34
#include "ompi/mca/mpool/mpool.h"
35
- #include "ompi/proc/proc.h"
35
+ #include "btl_tcp.h"
36
+ #include "btl_tcp_frag.h"
37
+ #include "btl_tcp_proc.h"
38
+ #include "btl_tcp_endpoint.h"
36
39
37
40
mca_btl_tcp2_module_t mca_btl_tcp2_module = {
38
41
{
@@ -57,9 +60,9 @@ mca_btl_tcp2_module_t mca_btl_tcp2_module = {
57
60
mca_btl_tcp2_prepare_dst ,
58
61
mca_btl_tcp2_send ,
59
62
NULL , /* send immediate */
60
- mca_btl_tcp2_put ,
63
+ mca_btl_tcp_put ,
61
64
NULL , /* get */
62
- mca_btl_base_dump ,
65
+ mca_btl_tcp_dump ,
63
66
NULL , /* mpool */
64
67
NULL , /* register error */
65
68
mca_btl_tcp2_ft_event
@@ -134,7 +137,9 @@ int mca_btl_tcp2_add_procs( struct mca_btl_base_module_t* btl,
134
137
/* we increase the count of MPI users of the event library
135
138
once per peer, so that we are used until we aren't
136
139
connected to a peer */
140
+ #if !MCA_BTL_TCP_USES_PROGRESS_THREAD
137
141
opal_progress_event_users_increment ();
142
+ #endif /* !MCA_BTL_TCP_USES_PROGRESS_THREAD */
138
143
}
139
144
140
145
return OMPI_SUCCESS ;
@@ -153,7 +158,9 @@ int mca_btl_tcp2_del_procs(struct mca_btl_base_module_t* btl,
153
158
opal_list_remove_item (& tcp_btl -> tcp_endpoints , (opal_list_item_t * )tcp_endpoint );
154
159
OBJ_RELEASE (tcp_endpoint );
155
160
}
161
+ #if !MCA_BTL_TCP_USES_PROGRESS_THREAD
156
162
opal_progress_event_users_decrement ();
163
+ #endif /* !MCA_BTL_TCP_USES_PROGRESS_THREAD */
157
164
}
158
165
return OMPI_SUCCESS ;
159
166
}
@@ -193,7 +200,8 @@ mca_btl_base_descriptor_t* mca_btl_tcp2_alloc(
193
200
frag -> base .des_dst_cnt = 0 ;
194
201
frag -> base .des_flags = flags ;
195
202
frag -> base .order = MCA_BTL_NO_ORDER ;
196
- frag -> btl = (mca_btl_tcp2_module_t * )btl ;
203
+ frag -> btl = (mca_btl_tcp_module_t * )btl ;
204
+ frag -> endpoint = endpoint ;
197
205
return (mca_btl_base_descriptor_t * )frag ;
198
206
}
199
207
@@ -384,7 +392,7 @@ int mca_btl_tcp2_send( struct mca_btl_base_module_t* btl,
384
392
frag -> hdr .type = MCA_BTL_TCP_HDR_TYPE_SEND ;
385
393
frag -> hdr .count = 0 ;
386
394
if (endpoint -> endpoint_nbo ) MCA_BTL_TCP_HDR_HTON (frag -> hdr );
387
- return mca_btl_tcp2_endpoint_send (endpoint ,frag );
395
+ return mca_btl_tcp_endpoint_send (endpoint ,frag );
388
396
}
389
397
390
398
@@ -425,7 +433,7 @@ int mca_btl_tcp2_put( mca_btl_base_module_t* btl,
425
433
frag -> hdr .type = MCA_BTL_TCP_HDR_TYPE_PUT ;
426
434
frag -> hdr .count = frag -> base .des_dst_cnt ;
427
435
if (endpoint -> endpoint_nbo ) MCA_BTL_TCP_HDR_HTON (frag -> hdr );
428
- return ((i = mca_btl_tcp2_endpoint_send (endpoint ,frag )) >= 0 ? OMPI_SUCCESS : i );
436
+ return ((i = mca_btl_tcp_endpoint_send (endpoint ,frag )) >= 0 ? OMPI_SUCCESS : i );
429
437
}
430
438
431
439
@@ -462,12 +470,13 @@ int mca_btl_tcp2_get(
462
470
frag -> hdr .type = MCA_BTL_TCP_HDR_TYPE_GET ;
463
471
frag -> hdr .count = frag -> base .des_src_cnt ;
464
472
if (endpoint -> endpoint_nbo ) MCA_BTL_TCP_HDR_HTON (frag -> hdr );
465
- return ((rc = mca_btl_tcp2_endpoint_send (endpoint ,frag )) >= 0 ? OMPI_SUCCESS : rc );
473
+ return ((rc = mca_btl_tcp_endpoint_send (endpoint ,frag )) >= 0 ? OMPI_SUCCESS : rc );
466
474
}
467
475
468
476
469
477
/*
470
- * Cleanup/release module resources.
478
+ * Cleanup/release module resources. This function should only be called once,
479
+ * there is no need to protect it.
471
480
*/
472
481
473
482
int mca_btl_tcp2_finalize (struct mca_btl_base_module_t * btl )
@@ -479,8 +488,42 @@ int mca_btl_tcp2_finalize(struct mca_btl_base_module_t* btl)
479
488
item = opal_list_remove_first (& tcp_btl -> tcp_endpoints )) {
480
489
mca_btl_tcp2_endpoint_t * endpoint = (mca_btl_tcp2_endpoint_t * )item ;
481
490
OBJ_RELEASE (endpoint );
491
+ #if !MCA_BTL_TCP_USES_PROGRESS_THREAD
482
492
opal_progress_event_users_decrement ();
493
+ #endif /* !MCA_BTL_TCP_USES_PROGRESS_THREAD */
483
494
}
484
495
free (tcp_btl );
485
496
return OMPI_SUCCESS ;
486
497
}
498
+
499
+ /**
500
+ *
501
+ */
502
+ void mca_btl_tcp_dump (struct mca_btl_base_module_t * base_btl ,
503
+ struct mca_btl_base_endpoint_t * endpoint ,
504
+ int verbose )
505
+ {
506
+ mca_btl_tcp_module_t * btl = (mca_btl_tcp_module_t * )base_btl ;
507
+ mca_btl_base_err ("%s TCP %p kernel_id %d\n"
508
+ #if MCA_BTL_TCP_STATISTICS
509
+ " | statistics: sent %lu recv %lu\n"
510
+ #endif /* MCA_BTL_TCP_STATISTICS */
511
+ " | latency %u bandwidth %u\n" ,
512
+ ORTE_NAME_PRINT (ORTE_PROC_MY_NAME ), (void * )btl , btl -> tcp_ifkindex ,
513
+ #if MCA_BTL_TCP_STATISTICS
514
+ btl -> tcp_bytes_sent , btl -> btl_bytes_recv ,
515
+ #endif /* MCA_BTL_TCP_STATISTICS */
516
+ btl -> super .btl_latency , btl -> super .btl_bandwidth );
517
+ if ( NULL != endpoint ) {
518
+ mca_btl_tcp_endpoint_dump ( endpoint , "TCP" );
519
+ } else if ( verbose ) {
520
+ opal_list_item_t * item ;
521
+
522
+ for (item = opal_list_get_first (& btl -> tcp_endpoints );
523
+ item != opal_list_get_end (& btl -> tcp_endpoints );
524
+ item = opal_list_get_next (item )) {
525
+ mca_btl_tcp_endpoint_dump ( (mca_btl_base_endpoint_t * )item , "TCP" );
526
+ }
527
+ }
528
+ }
529
+
0 commit comments