@@ -251,6 +251,15 @@ ompi_mtl_ofi_component_register(void)
251251 MCA_BASE_VAR_SCOPE_READONLY ,
252252 & ompi_mtl_ofi .num_ofi_contexts );
253253
254+ ompi_mtl_ofi .disable_hmem = false;
255+ mca_base_component_var_register (& mca_mtl_ofi_component .super .mtl_version ,
256+ "disable_hmem" ,
257+ "Disable HMEM usage" ,
258+ MCA_BASE_VAR_TYPE_BOOL , NULL , 0 , 0 ,
259+ OPAL_INFO_LVL_3 ,
260+ MCA_BASE_VAR_SCOPE_READONLY ,
261+ & ompi_mtl_ofi .disable_hmem );
262+
254263 return opal_common_ofi_mca_register (& mca_mtl_ofi_component .super .mtl_version );
255264}
256265
@@ -626,8 +635,10 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads,
626635
627636 /* Request device transfer capabilities */
628637#if defined(FI_HMEM )
629- hints -> caps |= FI_HMEM ;
630- hints -> domain_attr -> mr_mode |= FI_MR_HMEM | FI_MR_ALLOCATED ;
638+ if (false == ompi_mtl_ofi .disable_hmem ) {
639+ hints -> caps |= FI_HMEM ;
640+ hints -> domain_attr -> mr_mode |= FI_MR_HMEM | FI_MR_ALLOCATED ;
641+ }
631642#endif
632643
633644no_hmem :
@@ -791,10 +802,17 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads,
791802
792803 * accelerator_support = false;
793804#if defined(FI_HMEM )
794- if (!(prov -> caps & FI_HMEM )) {
795- opal_output_verbose (50 , opal_common_ofi .output ,
796- "%s:%d: Libfabric provider does not support device buffers. Continuing with device to host copies.\n" ,
797- __FILE__ , __LINE__ );
805+ if (!(prov -> caps & FI_HMEM ) || (true == ompi_mtl_ofi .disable_hmem )) {
806+ if (!(prov -> caps & FI_HMEM ) && (false == ompi_mtl_ofi .disable_hmem )) {
807+ opal_output_verbose (50 , opal_common_ofi .output ,
808+ "%s:%d: Libfabric provider does not support device buffers. Continuing with device to host copies.\n" ,
809+ __FILE__ , __LINE__ );
810+ }
811+ if (true == ompi_mtl_ofi .disable_hmem ) {
812+ opal_output_verbose (50 , opal_common_ofi .output ,
813+ "%s:%d: Support for device buffers disabled by MCA parameter. Continuing with device to host copies.\n" ,
814+ __FILE__ , __LINE__ );
815+ }
798816 } else {
799817 * accelerator_support = true;
800818 ompi_mtl_ofi .hmem_needs_reg = true;
0 commit comments