1
1

Use opal_getpagesize to get the proper page size

Refs trac:4826

This commit was SVN r32427.

The following Trac tickets were found above:
  Ticket 4826 --> https://svn.open-mpi.org/trac/ompi/ticket/4826
Этот коммит содержится в:
Gilles Gouaillardet 2014-08-05 05:35:57 +00:00
родитель f7ede30c46
Коммит e8bf030d93
6 изменённых файлов: 22 добавлений и 8 удалений

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

@ -62,6 +62,8 @@
#include "opal/mca/common/cuda/common_cuda.h" #include "opal/mca/common/cuda/common_cuda.h"
#endif /* OPAL_CUDA_SUPPORT */ #endif /* OPAL_CUDA_SUPPORT */
#include "opal/util/sys_limits.h"
#include <errno.h> #include <errno.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -640,13 +642,13 @@ static uint64_t calculate_max_reg (void)
num_mtt = 1 << 20; num_mtt = 1 << 20;
} }
max_reg = (num_mtt - reserved_mtt) * getpagesize () * mtts_per_seg; 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", &statinfo)) {
mtts_per_seg = 1 << read_module_param("/sys/module/ib_mthca/parameters/log_mtts_per_seg", 1); 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); 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); reserved_mtt = read_module_param("/sys/module/ib_mthca/parameters/fmr_reserved_mtts", 0);
max_reg = (num_mtt - reserved_mtt) * getpagesize () * mtts_per_seg; max_reg = (num_mtt - reserved_mtt) * opal_getpagesize () * mtts_per_seg;
} else { } else {
/* Need to update to determine the registration limit for this /* Need to update to determine the registration limit for this
configuration */ configuration */

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

@ -2,6 +2,8 @@
* Copyright (c) 2011 Mellanox Technologies. All rights reserved. * Copyright (c) 2011 Mellanox Technologies. All rights reserved.
* *
* Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -12,6 +14,7 @@
#include "btl_openib.h" #include "btl_openib.h"
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/sys_limits.h"
#include "connect/btl_openib_connect_sl.h" #include "connect/btl_openib_connect_sl.h"
#include <infiniband/iba/ib_types.h> #include <infiniband/iba/ib_types.h>
@ -393,7 +396,7 @@ static int get_pathrecord_sl(struct ibv_context *context_arg,
ib_sa_mad_t *req_mad, *resp_mad; ib_sa_mad_t *req_mad, *resp_mad;
struct ibv_sge ssge; struct ibv_sge ssge;
struct mca_btl_openib_sa_qp_cache *cache; struct mca_btl_openib_sa_qp_cache *cache;
long page_size = sysconf(_SC_PAGESIZE); size_t page_size = (size_t)opal_getpagesize();
int rc; int rc;
/* search for a cached item */ /* search for a cached item */

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

@ -71,6 +71,7 @@
#include "connect/connect.h" #include "connect/connect.h"
#include "opal/mca/mpool/grdma/mpool_grdma.h" #include "opal/mca/mpool/grdma/mpool_grdma.h"
#include "opal/util/sys_limits.h"
#if (ENABLE_DYNAMIC_SL) #if (ENABLE_DYNAMIC_SL)
#include "connect/btl_openib_connect_sl.h" #include "connect/btl_openib_connect_sl.h"
@ -935,7 +936,7 @@ static int udcm_module_allocate_buffers (udcm_module_t *m)
UDCM_GRH_SIZE); UDCM_GRH_SIZE);
m->cm_buffer = NULL; m->cm_buffer = NULL;
posix_memalign ((void **)&m->cm_buffer, sysconf(_SC_PAGESIZE), posix_memalign ((void **)&m->cm_buffer, (size_t)opal_getpagesize(),
total_size); total_size);
if (NULL == m->cm_buffer) { if (NULL == m->cm_buffer) {
BTL_ERROR(("malloc failed! errno = %d", errno)); BTL_ERROR(("malloc failed! errno = %d", errno));

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

@ -13,6 +13,8 @@
* Copyright (c) 2010-2011 Los Alamos National Security, LLC. * Copyright (c) 2010-2011 Los Alamos National Security, LLC.
* All rights reserved. * All rights reserved.
* Copyright (c) 2011 NVIDIA Corporation. All rights reserved. * Copyright (c) 2011 NVIDIA Corporation. All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -51,6 +53,7 @@
#include "opal/constants.h" #include "opal/constants.h"
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/util/sys_limits.h"
#include "opal/mca/shmem/base/base.h" #include "opal/mca/shmem/base/base.h"
#include "opal/mca/shmem/shmem.h" #include "opal/mca/shmem/shmem.h"
#include "shmem_sysv.h" #include "shmem_sysv.h"
@ -183,7 +186,7 @@ sysv_runtime_query(mca_base_module_t **module, int *priority, const char *hint)
"starting run-time test...\n") "starting run-time test...\n")
); );
if (-1 == (shmid = shmget(IPC_PRIVATE, (size_t)(getpagesize()), if (-1 == (shmid = shmget(IPC_PRIVATE, (size_t)(opal_getpagesize()),
IPC_CREAT | IPC_EXCL | S_IRWXU ))) { IPC_CREAT | IPC_EXCL | S_IRWXU ))) {
goto out; goto out;
} }

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

@ -1,6 +1,8 @@
/* /*
* Copyright (c) 2014 Mellanox Technologies, Inc. * Copyright (c) 2014 Mellanox Technologies, Inc.
* All rights reserved. * All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -33,6 +35,7 @@
#include "opal/constants.h" #include "opal/constants.h"
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/util/sys_limits.h"
#include "oshmem/mca/sshmem/sshmem.h" #include "oshmem/mca/sshmem/sshmem.h"
#include "oshmem/mca/sshmem/base/base.h" #include "oshmem/mca/sshmem/base/base.h"
@ -110,7 +113,7 @@ sysv_runtime_query(mca_base_module_t **module,
#if defined (SHM_HUGETLB) #if defined (SHM_HUGETLB)
mca_sshmem_sysv_component.use_hp = 1; mca_sshmem_sysv_component.use_hp = 1;
flags = IPC_CREAT | IPC_EXCL | S_IRUSR | S_IWUSR | SHM_HUGETLB; flags = IPC_CREAT | IPC_EXCL | S_IRUSR | S_IWUSR | SHM_HUGETLB;
if (-1 == (shmid = shmget(IPC_PRIVATE, (size_t)(getpagesize()), flags))) { if (-1 == (shmid = shmget(IPC_PRIVATE, (size_t)(opal_getpagesize()), flags))) {
mca_sshmem_sysv_component.use_hp = 0; mca_sshmem_sysv_component.use_hp = 0;
} }
else if ((void *)-1 == (addr = shmat(shmid, NULL, 0))) { else if ((void *)-1 == (addr = shmat(shmid, NULL, 0))) {
@ -121,7 +124,7 @@ sysv_runtime_query(mca_base_module_t **module,
if (0 == mca_sshmem_sysv_component.use_hp) { if (0 == mca_sshmem_sysv_component.use_hp) {
flags = IPC_CREAT | IPC_EXCL | S_IRUSR | S_IWUSR; flags = IPC_CREAT | IPC_EXCL | S_IRUSR | S_IWUSR;
if (-1 == (shmid = shmget(IPC_PRIVATE, (size_t)(getpagesize()), flags))) { if (-1 == (shmid = shmget(IPC_PRIVATE, (size_t)(opal_getpagesize()), flags))) {
goto out; goto out;
} }
else if ((void *)-1 == (addr = shmat(shmid, NULL, 0))) { else if ((void *)-1 == (addr = shmat(shmid, NULL, 0))) {

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

@ -1,6 +1,8 @@
/* /*
* Copyright (c) 2014 Mellanox Technologies, Inc. * Copyright (c) 2014 Mellanox Technologies, Inc.
* All rights reserved. * All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -146,7 +148,7 @@ verbs_runtime_query(mca_base_module_t **module,
/* Allocate memory */ /* Allocate memory */
if (!rc) { if (!rc) {
void *addr = NULL; void *addr = NULL;
size_t size = getpagesize(); size_t size = (size_t)opal_getpagesize();
struct ibv_mr *ib_mr = NULL; struct ibv_mr *ib_mr = NULL;
uint64_t access_flag = IBV_ACCESS_LOCAL_WRITE | uint64_t access_flag = IBV_ACCESS_LOCAL_WRITE |
IBV_ACCESS_REMOTE_WRITE | IBV_ACCESS_REMOTE_WRITE |