From 31d0724a08965b786eab6977ae34a7d31d1cd680 Mon Sep 17 00:00:00 2001 From: Alex Mikheev Date: Mon, 15 Sep 2014 12:17:23 +0000 Subject: [PATCH] OMPI: btl openib: fix detection of max registarable memory Deal with the case when mlx4 module is loaded but device is not present cmr=v1.8.3:reviewer=miked This commit was SVN r32734. --- opal/mca/btl/openib/btl_openib.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/opal/mca/btl/openib/btl_openib.c b/opal/mca/btl/openib/btl_openib.c index c441396489..3927f0f8e7 100644 --- a/opal/mca/btl/openib/btl_openib.c +++ b/opal/mca/btl/openib/btl_openib.c @@ -635,12 +635,17 @@ static uint64_t calculate_max_reg (void) mtts_per_seg = 1 << read_module_param("/sys/module/mlx4_core/parameters/log_mtts_per_seg", 1); num_mtt = 1 << read_module_param("/sys/module/mlx4_core/parameters/log_num_mtt", 20); if (1 == num_mtt) { - /* NTH: is 19 a minimum? when log_num_mtt is set to 0 use 19 */ - num_mtt = 1 << 20; + if (0 == stat("/sys/module/mlx5_core", &statinfo)) { + max_reg = 2 * mem_total; + } else { + /* NTH: is 19 a minimum? when log_num_mtt is set to 0 use 19 */ + num_mtt = 1 << 19; + max_reg = (num_mtt - reserved_mtt) * opal_getpagesize () * mtts_per_seg; + } + } else { + max_reg = (num_mtt - reserved_mtt) * opal_getpagesize () * mtts_per_seg; } - max_reg = (num_mtt - reserved_mtt) * opal_getpagesize () * mtts_per_seg; - } else if (0 == stat("/sys/module/ib_mthca/parameters/num_mtt", &statinfo)) { mtts_per_seg = 1 << read_module_param("/sys/module/ib_mthca/parameters/log_mtts_per_seg", 1); num_mtt = read_module_param("/sys/module/ib_mthca/parameters/num_mtt", 1 << 20);