@@ -473,13 +473,6 @@ static int ompi_mtl_ofi_init_sep(struct fi_info *prov)
473
473
int ret = OMPI_SUCCESS , num_ofi_ctxts ;
474
474
struct fi_av_attr av_attr = {0 };
475
475
476
- ompi_mtl_ofi .max_ctx_cnt = (prov -> domain_attr -> max_ep_tx_ctx <
477
- prov -> domain_attr -> max_ep_rx_ctx ) ?
478
- prov -> domain_attr -> max_ep_tx_ctx :
479
- prov -> domain_attr -> max_ep_rx_ctx ;
480
-
481
- /* Provision enough contexts to service all ranks in a node */
482
- ompi_mtl_ofi .max_ctx_cnt /= (1 + ompi_process_info .num_local_peers );
483
476
prov -> ep_attr -> tx_ctx_cnt = prov -> ep_attr -> rx_ctx_cnt =
484
477
ompi_mtl_ofi .max_ctx_cnt ;
485
478
@@ -601,15 +594,14 @@ static mca_mtl_base_module_t*
601
594
ompi_mtl_ofi_component_init (bool enable_progress_threads ,
602
595
bool enable_mpi_threads )
603
596
{
604
- int ret , fi_version ;
597
+ int ret , fi_version , num_local_ranks ;
598
+ int ofi_tag_leading_zeros , ofi_tag_bits_for_cid ;
605
599
struct fi_info * hints ;
606
600
struct fi_info * providers = NULL ;
607
601
struct fi_info * prov = NULL ;
608
602
struct fi_info * prov_cq_data = NULL ;
609
603
char ep_name [FI_NAME_MAX ] = {0 };
610
604
size_t namelen ;
611
- int ofi_tag_leading_zeros ;
612
- int ofi_tag_bits_for_cid ;
613
605
614
606
/**
615
607
* Hints to filter providers
@@ -774,10 +766,10 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads,
774
766
ompi_mtl_ofi .num_peers = 0 ;
775
767
776
768
/* Check if Scalable Endpoints can be enabled for the provider */
777
- ompi_mtl_ofi .sep_supported = false ;
769
+ ompi_mtl_ofi .enable_sep = 0 ;
778
770
if ((prov -> domain_attr -> max_ep_tx_ctx > 1 ) ||
779
771
(prov -> domain_attr -> max_ep_rx_ctx > 1 )) {
780
- ompi_mtl_ofi .sep_supported = true ;
772
+ ompi_mtl_ofi .enable_sep = 1 ;
781
773
opal_output_verbose (1 , ompi_mtl_base_framework .framework_output ,
782
774
"%s:%d: Scalable EP supported in %s provider. Enabling in MTL.\n" ,
783
775
__FILE__ , __LINE__ , prov -> fabric_attr -> prov_name );
@@ -786,7 +778,7 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads,
786
778
/*
787
779
* Scalable Endpoints is required for Thread Grouping feature
788
780
*/
789
- if (!ompi_mtl_ofi .sep_supported && ompi_mtl_ofi .thread_grouping ) {
781
+ if (!ompi_mtl_ofi .enable_sep && ompi_mtl_ofi .thread_grouping ) {
790
782
opal_show_help ("help-mtl-ofi.txt" , "SEP unavailable" , true,
791
783
prov -> fabric_attr -> prov_name ,
792
784
ompi_process_info .nodename , __FILE__ , __LINE__ ,
@@ -848,7 +840,20 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads,
848
840
* vectors, completion counters or event queues etc, and enabled.
849
841
* See man fi_endpoint for more details.
850
842
*/
851
- if (true == ompi_mtl_ofi .sep_supported ) {
843
+ ompi_mtl_ofi .max_ctx_cnt = (prov -> domain_attr -> max_ep_tx_ctx <
844
+ prov -> domain_attr -> max_ep_rx_ctx ) ?
845
+ prov -> domain_attr -> max_ep_tx_ctx :
846
+ prov -> domain_attr -> max_ep_rx_ctx ;
847
+
848
+ num_local_ranks = 1 + ompi_process_info .num_local_peers ;
849
+ if (ompi_mtl_ofi .max_ctx_cnt <= num_local_ranks ) {
850
+ ompi_mtl_ofi .enable_sep = 0 ;
851
+ }
852
+
853
+ if (1 == ompi_mtl_ofi .enable_sep ) {
854
+ /* Provision enough contexts to service all ranks in a node */
855
+ ompi_mtl_ofi .max_ctx_cnt /= num_local_ranks ;
856
+
852
857
ret = ompi_mtl_ofi_init_sep (prov );
853
858
} else {
854
859
ret = ompi_mtl_ofi_init_regular_ep (prov );
@@ -926,7 +931,7 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads,
926
931
if (ompi_mtl_ofi .av ) {
927
932
(void ) fi_close ((fid_t )ompi_mtl_ofi .av );
928
933
}
929
- if ((false == ompi_mtl_ofi .sep_supported ) &&
934
+ if ((0 == ompi_mtl_ofi .enable_sep ) &&
930
935
ompi_mtl_ofi .ofi_ctxt != NULL &&
931
936
ompi_mtl_ofi .ofi_ctxt [0 ].cq ) {
932
937
/* Check if CQ[0] was created for non-SEP case and close if needed */
@@ -964,9 +969,9 @@ ompi_mtl_ofi_finalize(struct mca_mtl_base_module_t *mtl)
964
969
goto finalize_err ;
965
970
}
966
971
967
- if (false == ompi_mtl_ofi .sep_supported ) {
972
+ if (0 == ompi_mtl_ofi .enable_sep ) {
968
973
/*
969
- * CQ[0] is bound to SEP object when SEP is not supported by a
974
+ * CQ[0] is bound to SEP object Nwhen SEP is not supported by a
970
975
* provider. OFI spec requires that we close the Endpoint that is bound
971
976
* to the CQ before closing the CQ itself. So, for the non-SEP case, we
972
977
* handle the closing of CQ[0] here.
0 commit comments