1
1

openib/btl: better detect max reg memory. OFED has no runtime versioning API :(

based on http://www.open-mpi.org/community/lists/users/2014/08/25048.php

reviewed by AlexM
cmr=v1.8.2:reviewer=ompi-rm1.8

This commit was SVN r32569.
Этот коммит содержится в:
Mike Dubman 2014-08-21 12:12:43 +00:00
родитель cfc0773c8c
Коммит c3beb0472e

Просмотреть файл

@ -620,6 +620,7 @@ static uint64_t calculate_total_mem (void)
#endif
}
static uint64_t calculate_max_reg (void)
{
struct stat statinfo;
@ -630,11 +631,7 @@ static uint64_t calculate_max_reg (void)
mem_total = calculate_total_mem ();
if (0 == stat("/sys/module/mlx5_core", &statinfo)) {
/* mlx5 means that we have ofed 2.0 and it can always register 2xmem_total for any mlx hca */
max_reg = 2 * mem_total;
}
else if (0 == stat("/sys/module/mlx4_core/parameters", &statinfo)) {
if (0 == stat("/sys/module/mlx4_core/parameters/log_num_mtt", &statinfo)) {
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) {
@ -643,12 +640,22 @@ static uint64_t calculate_max_reg (void)
}
max_reg = (num_mtt - reserved_mtt) * opal_getpagesize () * mtts_per_seg;
} else if (0 == stat("/sys/module/ib_mthca/parameters", &statinfo)) {
} 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);
reserved_mtt = read_module_param("/sys/module/ib_mthca/parameters/fmr_reserved_mtts", 0);
max_reg = (num_mtt - reserved_mtt) * opal_getpagesize () * mtts_per_seg;
} else if (
(0 == stat("/sys/module/mlx5_core", &statinfo)) ||
(0 == stat("/sys/module/mlx4_core/parameters", &statinfo)) ||
(0 == stat("/sys/module/ib_mthca/parameters", &statinfo))
) {
/* mlx5 means that we have ofed 2.0 and it can always register 2xmem_total for any mlx hca */
max_reg = 2 * mem_total;
} else {
/* Need to update to determine the registration limit for this
configuration */