1
1

Use opal_process_info whenever possible. Some other minor cleanups.

This commit was SVN r32325.
Этот коммит содержится в:
George Bosilca 2014-07-26 21:48:23 +00:00
родитель a3feb627cf
Коммит f217661ee0
22 изменённых файлов: 149 добавлений и 144 удалений

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

@ -39,10 +39,8 @@
#include "opal/mca/btl/btl.h" #include "opal/mca/btl/btl.h"
#include "opal/mca/btl/base/btl_base_error.h" #include "opal/mca/btl/base/btl_base_error.h"
#include "ompi/mca/rte/rte.h"
#if OPAL_ENABLE_FT_CR == 1 #if OPAL_ENABLE_FT_CR == 1
#include "ompi/runtime/ompi_cr.h" #include "opal/runtime/opal_cr.h"
#endif #endif
#include "btl_openib_ini.h" #include "btl_openib_ini.h"
@ -752,7 +750,7 @@ static int prepare_device_for_use (mca_btl_openib_device_t *device)
"XRC on device without XRC support", true, "XRC on device without XRC support", true,
mca_btl_openib_component.num_xrc_qps, mca_btl_openib_component.num_xrc_qps,
ibv_get_device_name(device->ib_dev), ibv_get_device_name(device->ib_dev),
ompi_process_info.nodename); opal_process_info.nodename);
return OPAL_ERROR; return OPAL_ERROR;
} }

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

@ -84,8 +84,7 @@
#include "opal/runtime/opal_params.h" #include "opal/runtime/opal_params.h"
#include "opal/runtime/opal.h" #include "opal/runtime/opal.h"
#include "ompi/runtime/ompi_module_exchange.h" #include "ompi/mca/rte/rte.h"
#include "ompi/runtime/mpiruntime.h"
#include "btl_openib.h" #include "btl_openib.h"
#include "btl_openib_frag.h" #include "btl_openib_frag.h"
@ -2090,7 +2089,7 @@ static int finish_btl_init(mca_btl_openib_module_t *openib_btl)
opal_output_verbose(1, opal_btl_base_framework.framework_output, opal_output_verbose(1, opal_btl_base_framework.framework_output,
"[rank=%d] openib: using port %s:%d", "[rank=%d] openib: using port %s:%d",
ORTE_PROC_MY_NAME->vpid, opal_process_name_vpid(OPAL_PROC_MY_NAME),
ibv_get_device_name(openib_btl->device->ib_dev), ibv_get_device_name(openib_btl->device->ib_dev),
openib_btl->port_num); openib_btl->port_num);
return OPAL_SUCCESS; return OPAL_SUCCESS;
@ -2566,7 +2565,7 @@ btl_openib_component_init(int *num_btl_modules,
(dev_sorted[i].distance - distance) > EPS) { (dev_sorted[i].distance - distance) > EPS) {
opal_output_verbose(1, opal_btl_base_framework.framework_output, opal_output_verbose(1, opal_btl_base_framework.framework_output,
"[rank=%d] openib: skipping device %s; it is too far away", "[rank=%d] openib: skipping device %s; it is too far away",
ORTE_PROC_MY_NAME->vpid, opal_process_name_vpid(OPAL_PROC_MY_NAME),
ibv_get_device_name(dev_sorted[i].ib_dev)); ibv_get_device_name(dev_sorted[i].ib_dev));
break; break;
} }

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

@ -44,7 +44,7 @@ int mca_btl_openib_open_xrc_domain(struct mca_btl_openib_device_t *device)
dev_name = ibv_get_device_name(device->ib_dev); dev_name = ibv_get_device_name(device->ib_dev);
len = asprintf(&xrc_file_name, len = asprintf(&xrc_file_name,
"%s"OPAL_PATH_SEP"openib_xrc_domain_%s", "%s"OPAL_PATH_SEP"openib_xrc_domain_%s",
ompi_process_info.job_session_dir, dev_name); opal_process_info.job_session_dir, dev_name);
if (0 > len) { if (0 > len) {
BTL_ERROR(("Failed to allocate memomry for XRC file name: %s\n", BTL_ERROR(("Failed to allocate memomry for XRC file name: %s\n",
strerror(errno))); strerror(errno)));

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

@ -2435,7 +2435,7 @@ static int udcm_xrc_send_qp_create (mca_btl_base_endpoint_t *lcl_ep)
if (NULL == *qp) { if (NULL == *qp) {
opal_show_help("help-mpi-btl-openib-cpc-base.txt", opal_show_help("help-mpi-btl-openib-cpc-base.txt",
"ibv_create_qp failed", true, "ibv_create_qp failed", true,
orte_process_info.nodename, ompi_process_info.nodename,
ibv_get_device_name(openib_btl->device->ib_dev), ibv_get_device_name(openib_btl->device->ib_dev),
"Reliable connected (XRC)"); "Reliable connected (XRC)");
return OPAL_ERROR; return OPAL_ERROR;
@ -2444,7 +2444,7 @@ static int udcm_xrc_send_qp_create (mca_btl_base_endpoint_t *lcl_ep)
if (qp_init_attr.cap.max_inline_data < req_inline) { if (qp_init_attr.cap.max_inline_data < req_inline) {
lcl_ep->qps[0].ib_inline_max = qp_init_attr.cap.max_inline_data; lcl_ep->qps[0].ib_inline_max = qp_init_attr.cap.max_inline_data;
opal_show_help("help-mpi-btl-openib-cpc-base.txt", opal_show_help("help-mpi-btl-openib-cpc-base.txt",
"inline truncated", orte_process_info.nodename, "inline truncated", ompi_process_info.nodename,
ibv_get_device_name(openib_btl->device->ib_dev), ibv_get_device_name(openib_btl->device->ib_dev),
openib_btl->port_num, openib_btl->port_num,
req_inline, qp_init_attr.cap.max_inline_data); req_inline, qp_init_attr.cap.max_inline_data);

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

@ -22,7 +22,6 @@
#include "opal/mca/event/event.h" #include "opal/mca/event/event.h"
#include "opal/util/output.h" #include "opal/util/output.h"
#include "ompi/runtime/ompi_module_exchange.h"
#include "portals4.h" #include "portals4.h"
#include "btl_portals4.h" #include "btl_portals4.h"

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

@ -60,7 +60,7 @@
#include "opal/mca/crs/base/base.h" #include "opal/mca/crs/base/base.h"
#include "opal/util/basename.h" #include "opal/util/basename.h"
#include "orte/mca/sstore/sstore.h" #include "orte/mca/sstore/sstore.h"
#include "ompi/runtime/ompi_cr.h" #include "opal/runtime/opal_cr.h"
#endif #endif
#include "btl_sm.h" #include "btl_sm.h"
@ -248,7 +248,7 @@ sm_btl_first_time_init(mca_btl_sm_t *sm_btl,
mca_btl_sm_component.num_mem_nodes = num_mem_nodes = i; mca_btl_sm_component.num_mem_nodes = num_mem_nodes = i;
/* if we are not bound, then there is nothing further to do */ /* if we are not bound, then there is nothing further to do */
if (NULL != ompi_process_info.cpuset) { if (NULL != opal_process_info.cpuset) {
/* count the number of NUMA nodes to which we are bound */ /* count the number of NUMA nodes to which we are bound */
for (w=0; w < i; w++) { for (w=0; w < i; w++) {
if (NULL == (obj = opal_hwloc_base_get_obj_by_type(opal_hwloc_topology, if (NULL == (obj = opal_hwloc_base_get_obj_by_type(opal_hwloc_topology,
@ -440,7 +440,7 @@ create_sm_endpoint(int local_proc, struct opal_proc_t *proc)
OBJ_CONSTRUCT(&ep->endpoint_lock, opal_mutex_t); OBJ_CONSTRUCT(&ep->endpoint_lock, opal_mutex_t);
#if OPAL_ENABLE_PROGRESS_THREADS == 1 #if OPAL_ENABLE_PROGRESS_THREADS == 1
sprintf(path, "%s"OPAL_PATH_SEP"sm_fifo.%lu", sprintf(path, "%s"OPAL_PATH_SEP"sm_fifo.%lu",
ompi_process_info.job_session_dir, opal_process_info.job_session_dir,
(unsigned long)proc->proc_name); (unsigned long)proc->proc_name);
ep->fifo_fd = open(path, O_WRONLY); ep->fifo_fd = open(path, O_WRONLY);
if(ep->fifo_fd < 0) { if(ep->fifo_fd < 0) {

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

@ -368,7 +368,7 @@ get_num_local_procs(void)
{ {
/* num_local_peers does not include us in /* num_local_peers does not include us in
* its calculation, so adjust for that */ * its calculation, so adjust for that */
return (int)(1 + ompi_process_info.num_local_peers); return (int)(1 + opal_process_info.num_local_peers);
} }
static void static void
@ -505,28 +505,28 @@ set_uniq_paths_for_init_rndv(mca_btl_sm_component_t *comp_ptr)
if (asprintf(&comp_ptr->sm_mpool_ctl_file_name, if (asprintf(&comp_ptr->sm_mpool_ctl_file_name,
"%s"OPAL_PATH_SEP"shared_mem_pool.%s", "%s"OPAL_PATH_SEP"shared_mem_pool.%s",
ompi_process_info.job_session_dir, opal_process_info.job_session_dir,
opal_proc_local_get()->proc_hostname) < 0) { opal_proc_local_get()->proc_hostname) < 0) {
/* rc set */ /* rc set */
goto out; goto out;
} }
if (asprintf(&comp_ptr->sm_mpool_rndv_file_name, if (asprintf(&comp_ptr->sm_mpool_rndv_file_name,
"%s"OPAL_PATH_SEP"shared_mem_pool_rndv.%s", "%s"OPAL_PATH_SEP"shared_mem_pool_rndv.%s",
ompi_process_info.job_session_dir, opal_process_info.job_session_dir,
opal_proc_local_get()->proc_hostname) < 0) { opal_proc_local_get()->proc_hostname) < 0) {
/* rc set */ /* rc set */
goto out; goto out;
} }
if (asprintf(&comp_ptr->sm_ctl_file_name, if (asprintf(&comp_ptr->sm_ctl_file_name,
"%s"OPAL_PATH_SEP"shared_mem_btl_module.%s", "%s"OPAL_PATH_SEP"shared_mem_btl_module.%s",
ompi_process_info.job_session_dir, opal_process_info.job_session_dir,
opal_proc_local_get()->proc_hostname) < 0) { opal_proc_local_get()->proc_hostname) < 0) {
/* rc set */ /* rc set */
goto out; goto out;
} }
if (asprintf(&comp_ptr->sm_rndv_file_name, if (asprintf(&comp_ptr->sm_rndv_file_name,
"%s"OPAL_PATH_SEP"shared_mem_btl_rndv.%s", "%s"OPAL_PATH_SEP"shared_mem_btl_rndv.%s",
ompi_process_info.job_session_dir, opal_process_info.job_session_dir,
opal_proc_local_get()->proc_hostname) < 0) { opal_proc_local_get()->proc_hostname) < 0) {
/* rc set */ /* rc set */
goto out; goto out;
@ -702,7 +702,7 @@ mca_btl_sm_component_init(int *num_btls,
mca_btl_sm_component.sm_mpool_base = NULL; mca_btl_sm_component.sm_mpool_base = NULL;
/* if no session directory was created, then we cannot be used */ /* if no session directory was created, then we cannot be used */
if (NULL == ompi_process_info.job_session_dir) { if (NULL == opal_process_info.job_session_dir) {
/* SKG - this isn't true anymore. Some backing facilities don't require a /* SKG - this isn't true anymore. Some backing facilities don't require a
* file-backed store. Extend shmem to provide this info one day. Especially * file-backed store. Extend shmem to provide this info one day. Especially
* when we use a proper modex for init. */ * when we use a proper modex for init. */
@ -715,7 +715,7 @@ mca_btl_sm_component_init(int *num_btls,
* set of processes that are initializing the btl, and my_local_rank seems * set of processes that are initializing the btl, and my_local_rank seems
* to provide that for us. */ * to provide that for us. */
if (UINT16_MAX == if (UINT16_MAX ==
(my_local_rank = ompi_process_info.my_local_rank)) { (my_local_rank = opal_process_info.my_local_rank)) {
opal_show_help("help-mpi-btl-sm.txt", "no locality", true); opal_show_help("help-mpi-btl-sm.txt", "no locality", true);
return NULL; return NULL;
} }
@ -739,7 +739,7 @@ mca_btl_sm_component_init(int *num_btls,
#if OPAL_ENABLE_PROGRESS_THREADS == 1 #if OPAL_ENABLE_PROGRESS_THREADS == 1
/* create a named pipe to receive events */ /* create a named pipe to receive events */
sprintf( mca_btl_sm_component.sm_fifo_path, sprintf( mca_btl_sm_component.sm_fifo_path,
"%s"OPAL_PATH_SEP"sm_fifo.%lu", ompi_process_info.job_session_dir, "%s"OPAL_PATH_SEP"sm_fifo.%lu", opal_process_info.job_session_dir,
(unsigned long)opal_process_name_vpid(OPAL_PROC_MY_NAME) ); (unsigned long)opal_process_name_vpid(OPAL_PROC_MY_NAME) );
if(mkfifo(mca_btl_sm_component.sm_fifo_path, 0660) < 0) { if(mkfifo(mca_btl_sm_component.sm_fifo_path, 0660) < 0) {
opal_output(0, "mca_btl_sm_component_init: mkfifo failed with errno=%d\n",errno); opal_output(0, "mca_btl_sm_component_init: mkfifo failed with errno=%d\n",errno);

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

@ -246,7 +246,7 @@ smcuda_btl_first_time_init(mca_btl_smcuda_t *smcuda_btl,
mca_btl_smcuda_component.num_mem_nodes = num_mem_nodes = i; mca_btl_smcuda_component.num_mem_nodes = num_mem_nodes = i;
/* if we are not bound, then there is nothing further to do */ /* if we are not bound, then there is nothing further to do */
if (NULL != ompi_process_info.cpuset) { if (NULL != opal_process_info.cpuset) {
/* count the number of NUMA nodes to which we are bound */ /* count the number of NUMA nodes to which we are bound */
for (w=0; w < i; w++) { for (w=0; w < i; w++) {
if (NULL == (obj = opal_hwloc_base_get_obj_by_type(opal_hwloc_topology, if (NULL == (obj = opal_hwloc_base_get_obj_by_type(opal_hwloc_topology,
@ -449,7 +449,7 @@ create_sm_endpoint(int local_proc, struct opal_proc_t *proc)
OBJ_CONSTRUCT(&ep->endpoint_lock, opal_mutex_t); OBJ_CONSTRUCT(&ep->endpoint_lock, opal_mutex_t);
#if OPAL_ENABLE_PROGRESS_THREADS == 1 #if OPAL_ENABLE_PROGRESS_THREADS == 1
sprintf(path, "%s"OPAL_PATH_SEP"sm_fifo.%lu", sprintf(path, "%s"OPAL_PATH_SEP"sm_fifo.%lu",
ompi_process_info.job_session_dir, opal_process_info.job_session_dir,
(unsigned long)proc->proc_name); (unsigned long)proc->proc_name);
ep->fifo_fd = open(path, O_WRONLY); ep->fifo_fd = open(path, O_WRONLY);
if(ep->fifo_fd < 0) { if(ep->fifo_fd < 0) {

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

@ -300,7 +300,7 @@ get_num_local_procs(void)
{ {
/* num_local_peers does not include us in /* num_local_peers does not include us in
* its calculation, so adjust for that */ * its calculation, so adjust for that */
return (int)(1 + ompi_process_info.num_local_peers); return (int)(1 + opal_process_info.num_local_peers);
} }
static void static void
@ -437,28 +437,28 @@ set_uniq_paths_for_init_rndv(mca_btl_smcuda_component_t *comp_ptr)
if (asprintf(&comp_ptr->sm_mpool_ctl_file_name, if (asprintf(&comp_ptr->sm_mpool_ctl_file_name,
"%s"OPAL_PATH_SEP"shared_mem_cuda_pool.%s", "%s"OPAL_PATH_SEP"shared_mem_cuda_pool.%s",
ompi_process_info.job_session_dir, opal_process_info.job_session_dir,
opal_proc_local_get()->proc_hostname) < 0) { opal_proc_local_get()->proc_hostname) < 0) {
/* rc set */ /* rc set */
goto out; goto out;
} }
if (asprintf(&comp_ptr->sm_mpool_rndv_file_name, if (asprintf(&comp_ptr->sm_mpool_rndv_file_name,
"%s"OPAL_PATH_SEP"shared_mem_cuda_pool_rndv.%s", "%s"OPAL_PATH_SEP"shared_mem_cuda_pool_rndv.%s",
ompi_process_info.job_session_dir, opal_process_info.job_session_dir,
opal_proc_local_get()->proc_hostname) < 0) { opal_proc_local_get()->proc_hostname) < 0) {
/* rc set */ /* rc set */
goto out; goto out;
} }
if (asprintf(&comp_ptr->sm_ctl_file_name, if (asprintf(&comp_ptr->sm_ctl_file_name,
"%s"OPAL_PATH_SEP"shared_mem_cuda_btl_module.%s", "%s"OPAL_PATH_SEP"shared_mem_cuda_btl_module.%s",
ompi_process_info.job_session_dir, opal_process_info.job_session_dir,
opal_proc_local_get()->proc_hostname) < 0) { opal_proc_local_get()->proc_hostname) < 0) {
/* rc set */ /* rc set */
goto out; goto out;
} }
if (asprintf(&comp_ptr->sm_rndv_file_name, if (asprintf(&comp_ptr->sm_rndv_file_name,
"%s"OPAL_PATH_SEP"shared_mem_cuda_btl_rndv.%s", "%s"OPAL_PATH_SEP"shared_mem_cuda_btl_rndv.%s",
ompi_process_info.job_session_dir, opal_process_info.job_session_dir,
opal_proc_local_get()->proc_hostname) < 0) { opal_proc_local_get()->proc_hostname) < 0) {
/* rc set */ /* rc set */
goto out; goto out;
@ -841,7 +841,7 @@ mca_btl_smcuda_component_init(int *num_btls,
mca_btl_smcuda_component.sm_mpool_base = NULL; mca_btl_smcuda_component.sm_mpool_base = NULL;
/* if no session directory was created, then we cannot be used */ /* if no session directory was created, then we cannot be used */
if (NULL == ompi_process_info.job_session_dir) { if (NULL == opal_process_info.job_session_dir) {
/* SKG - this isn't true anymore. Some backing facilities don't require a /* SKG - this isn't true anymore. Some backing facilities don't require a
* file-backed store. Extend shmem to provide this info one day. Especially * file-backed store. Extend shmem to provide this info one day. Especially
* when we use a proper modex for init. */ * when we use a proper modex for init. */
@ -854,7 +854,7 @@ mca_btl_smcuda_component_init(int *num_btls,
* set of processes that are initializing the btl, and my_local_rank seems * set of processes that are initializing the btl, and my_local_rank seems
* to provide that for us. */ * to provide that for us. */
if (UINT16_MAX == if (UINT16_MAX ==
(my_local_rank = ompi_process_info.my_local_rank)) { (my_local_rank = opal_process_info.my_local_rank)) {
opal_show_help("help-mpi-btl-sm.txt", "no locality", true); opal_show_help("help-mpi-btl-sm.txt", "no locality", true);
return NULL; return NULL;
} }
@ -878,7 +878,7 @@ mca_btl_smcuda_component_init(int *num_btls,
#if OPAL_ENABLE_PROGRESS_THREADS == 1 #if OPAL_ENABLE_PROGRESS_THREADS == 1
/* create a named pipe to receive events */ /* create a named pipe to receive events */
sprintf( mca_btl_smcuda_component.sm_fifo_path, sprintf( mca_btl_smcuda_component.sm_fifo_path,
"%s"OPAL_PATH_SEP"sm_fifo.%lu", ompi_process_info.job_session_dir, "%s"OPAL_PATH_SEP"sm_fifo.%lu", opal_process_info.job_session_dir,
(unsigned long)OPAL_PROC_MY_NAME->vpid ); (unsigned long)OPAL_PROC_MY_NAME->vpid );
if(mkfifo(mca_btl_smcuda_component.sm_fifo_path, 0660) < 0) { if(mkfifo(mca_btl_smcuda_component.sm_fifo_path, 0660) < 0) {
opal_output(0, "mca_btl_smcuda_component_init: mkfifo failed with errno=%d\n",errno); opal_output(0, "mca_btl_smcuda_component_init: mkfifo failed with errno=%d\n",errno);

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

@ -1123,7 +1123,7 @@ static void mca_btl_tcp_component_accept_handler( int incoming_sd,
if (opal_socket_errno != EAGAIN && if (opal_socket_errno != EAGAIN &&
opal_socket_errno != EWOULDBLOCK) { opal_socket_errno != EWOULDBLOCK) {
opal_show_help("help-mpi-btl-tcp.txt", "accept failed", opal_show_help("help-mpi-btl-tcp.txt", "accept failed",
true, ompi_process_info.nodename, true, opal_process_info.nodename,
getpid(), getpid(),
opal_socket_errno, opal_socket_errno,
strerror(opal_socket_errno)); strerror(opal_socket_errno));

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

@ -693,7 +693,7 @@ static void agent_thread_send_ping(int fd, short flags, void *context)
ap->dest_cidrmask); ap->dest_cidrmask);
opal_btl_usnic_sprintf_mac(mac_str, ap->dest_mac); opal_btl_usnic_sprintf_mac(mac_str, ap->dest_mac);
opal_show_help("help-mpi-btl-usnic.txt", topic, true, opal_show_help("help-mpi-btl-usnic.txt", topic, true,
ompi_process_info.nodename, opal_process_info.nodename,
ap->listener->ipv4_addr_str, ap->listener->ipv4_addr_str,
ap->listener->usnic_name, ap->listener->usnic_name,
ap->listener->if_name, ap->listener->if_name,
@ -972,7 +972,7 @@ int opal_btl_usnic_connectivity_agent_init(void)
{ {
/* Only do this initialization if I am the agent (the agent is /* Only do this initialization if I am the agent (the agent is
local rank 0) */ local rank 0) */
if (ompi_process_info.my_local_rank != 0) { if (opal_process_info.my_local_rank != 0) {
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
if (agent_initialized) { if (agent_initialized) {
@ -1010,7 +1010,7 @@ int opal_btl_usnic_connectivity_agent_init(void)
} }
asprintf(&ipc_filename, "%s/%s", asprintf(&ipc_filename, "%s/%s",
ompi_process_info.job_session_dir, CONNECTIVITY_SOCK_NAME); opal_process_info.job_session_dir, CONNECTIVITY_SOCK_NAME);
if (NULL == ipc_filename) { if (NULL == ipc_filename) {
OPAL_ERROR_LOG(OPAL_ERR_IN_ERRNO); OPAL_ERROR_LOG(OPAL_ERR_IN_ERRNO);
ABORT("Out of memory"); ABORT("Out of memory");

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

@ -61,7 +61,7 @@ int opal_btl_usnic_connectivity_client_init(void)
char *ipc_filename = NULL; char *ipc_filename = NULL;
asprintf(&ipc_filename, "%s/%s", asprintf(&ipc_filename, "%s/%s",
ompi_process_info.job_session_dir, CONNECTIVITY_SOCK_NAME); opal_process_info.job_session_dir, CONNECTIVITY_SOCK_NAME);
if (NULL == ipc_filename) { if (NULL == ipc_filename) {
OPAL_ERROR_LOG(OPAL_ERR_IN_ERRNO); OPAL_ERROR_LOG(OPAL_ERR_IN_ERRNO);
ABORT("Out of memory"); ABORT("Out of memory");
@ -170,7 +170,7 @@ int opal_btl_usnic_connectivity_listen(opal_btl_usnic_module_t *module)
.mtu = module->local_addr.mtu .mtu = module->local_addr.mtu
}; };
/* Ensure to NULL-terminate the passed strings */ /* Ensure to NULL-terminate the passed strings */
strncpy(cmd.nodename, ompi_process_info.nodename, strncpy(cmd.nodename, opal_process_info.nodename,
CONNECTIVITY_NODENAME_LEN - 1); CONNECTIVITY_NODENAME_LEN - 1);
strncpy(cmd.if_name, module->if_name, CONNECTIVITY_IFNAME_LEN - 1); strncpy(cmd.if_name, module->if_name, CONNECTIVITY_IFNAME_LEN - 1);
strncpy(cmd.usnic_name, ibv_get_device_name(module->device), strncpy(cmd.usnic_name, ibv_get_device_name(module->device),

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

@ -293,7 +293,7 @@ static int check_reg_mem_basics(void)
opal_show_help("help-mpi-btl-usnic.txt", "check_reg_mem_basics fail", opal_show_help("help-mpi-btl-usnic.txt", "check_reg_mem_basics fail",
true, true,
ompi_process_info.nodename, opal_process_info.nodename,
str_limit); str_limit);
return OPAL_ERR_OUT_OF_RESOURCE; return OPAL_ERR_OUT_OF_RESOURCE;
@ -381,7 +381,7 @@ static int check_usnic_config(struct ibv_device_attr *device_attr,
opal_show_help("help-mpi-btl-usnic.txt", opal_show_help("help-mpi-btl-usnic.txt",
"not enough usnic resources", "not enough usnic resources",
true, true,
ompi_process_info.nodename, opal_process_info.nodename,
ibv_get_device_name(module->device), ibv_get_device_name(module->device),
str); str);
return OPAL_ERROR; return OPAL_ERROR;
@ -465,7 +465,7 @@ static mca_btl_base_module_t** usnic_component_init(int* num_btl_modules,
if (0 != err) { if (0 != err) {
/* API returns negative errno values */ /* API returns negative errno values */
opal_show_help("help-mpi-btl-usnic.txt", "rtnetlink init fail", opal_show_help("help-mpi-btl-usnic.txt", "rtnetlink init fail",
true, ompi_process_info.nodename, strerror(-err)); true, opal_process_info.nodename, strerror(-err));
return NULL; return NULL;
} }
@ -566,7 +566,7 @@ static mca_btl_base_module_t** usnic_component_init(int* num_btl_modules,
filter = NULL; filter = NULL;
} }
num_local_procs = ompi_process_info.num_local_peers; num_local_procs = opal_process_info.num_local_peers;
/* Go through the list of ports and determine if we want it or /* Go through the list of ports and determine if we want it or
not. Create and (mostly) fill a module struct for each port not. Create and (mostly) fill a module struct for each port
@ -607,7 +607,7 @@ static mca_btl_base_module_t** usnic_component_init(int* num_btl_modules,
if (0 != ibv_query_device(module->device_context, &device_attr)) { if (0 != ibv_query_device(module->device_context, &device_attr)) {
opal_show_help("help-mpi-btl-usnic.txt", "ibv API failed", opal_show_help("help-mpi-btl-usnic.txt", "ibv API failed",
true, true,
ompi_process_info.nodename, opal_process_info.nodename,
ibv_get_device_name(module->device), ibv_get_device_name(module->device),
module->if_name, module->if_name,
"ibv_query_device", __FILE__, __LINE__, "ibv_query_device", __FILE__, __LINE__,
@ -1147,7 +1147,7 @@ static int init_module_from_port(opal_btl_usnic_module_t *module,
opal_memchecker_base_mem_defined(&gid, sizeof(gid)); opal_memchecker_base_mem_defined(&gid, sizeof(gid));
opal_show_help("help-mpi-btl-usnic.txt", "ibv API failed", opal_show_help("help-mpi-btl-usnic.txt", "ibv API failed",
true, true,
ompi_process_info.nodename, opal_process_info.nodename,
ibv_get_device_name(module->device), ibv_get_device_name(module->device),
module->if_name, module->if_name,
"ibv_query_gid", __FILE__, __LINE__, "ibv_query_gid", __FILE__, __LINE__,
@ -1195,7 +1195,7 @@ static int init_module_from_port(opal_btl_usnic_module_t *module,
That's a bad sign. Let's ignore this port. */ That's a bad sign. Let's ignore this port. */
opal_show_help("help-mpi-btl-usnic.txt", "verbs_port_bw failed", opal_show_help("help-mpi-btl-usnic.txt", "verbs_port_bw failed",
true, true,
ompi_process_info.nodename, opal_process_info.nodename,
ibv_get_device_name(module->device), ibv_get_device_name(module->device),
module->if_name); module->if_name);
return OPAL_ERROR; return OPAL_ERROR;
@ -1305,7 +1305,7 @@ static usnic_if_filter_t *parse_ifex_str(const char *orig_str,
str = strchr(argv[i], '/'); str = strchr(argv[i], '/');
if (NULL == str) { if (NULL == str) {
opal_show_help("help-mpi-btl-usnic.txt", "invalid if_inexclude", opal_show_help("help-mpi-btl-usnic.txt", "invalid if_inexclude",
true, name, ompi_process_info.nodename, true, name, opal_process_info.nodename,
tmp, "Invalid specification (missing \"/\")"); tmp, "Invalid specification (missing \"/\")");
free(tmp); free(tmp);
continue; continue;
@ -1314,7 +1314,7 @@ static usnic_if_filter_t *parse_ifex_str(const char *orig_str,
argv_prefix = atoi(str + 1); argv_prefix = atoi(str + 1);
if (argv_prefix < 1 || argv_prefix > 32) { if (argv_prefix < 1 || argv_prefix > 32) {
opal_show_help("help-mpi-btl-usnic.txt", "invalid if_inexclude", opal_show_help("help-mpi-btl-usnic.txt", "invalid if_inexclude",
true, name, ompi_process_info.nodename, true, name, opal_process_info.nodename,
tmp, "Invalid specification (prefix < 1 or prefix >32)"); tmp, "Invalid specification (prefix < 1 or prefix >32)");
free(tmp); free(tmp);
continue; continue;
@ -1326,7 +1326,7 @@ static usnic_if_filter_t *parse_ifex_str(const char *orig_str,
&((struct sockaddr_in*) &argv_inaddr)->sin_addr); &((struct sockaddr_in*) &argv_inaddr)->sin_addr);
if (1 != ret) { if (1 != ret) {
opal_show_help("help-mpi-btl-usnic.txt", "invalid if_inexclude", opal_show_help("help-mpi-btl-usnic.txt", "invalid if_inexclude",
true, name, ompi_process_info.nodename, tmp, true, name, opal_process_info.nodename, tmp,
"Invalid specification (inet_pton() failed)"); "Invalid specification (inet_pton() failed)");
free(tmp); free(tmp);
continue; continue;

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

@ -235,7 +235,7 @@ void opal_btl_usnic_connectivity_map(void)
rank>.txt */ rank>.txt */
asprintf(&filename, "%s-%s.pid%d.job%d.mcwrank%d.txt", asprintf(&filename, "%s-%s.pid%d.job%d.mcwrank%d.txt",
mca_btl_usnic_component.connectivity_map_prefix, mca_btl_usnic_component.connectivity_map_prefix,
ompi_process_info.nodename, opal_process_info.nodename,
getpid(), getpid(),
opal_process_name_jobid(opal_proc_local_get()->proc_name), opal_process_name_jobid(opal_proc_local_get()->proc_name),
opal_process_name_vpid(opal_proc_local_get()->proc_name)); opal_process_name_vpid(opal_proc_local_get()->proc_name));
@ -251,7 +251,7 @@ void opal_btl_usnic_connectivity_map(void)
dirname[sizeof(dirname) - 1] = '\0'; dirname[sizeof(dirname) - 1] = '\0';
opal_show_help("help-mpi-btl-usnic.txt", "cannot write to map file", opal_show_help("help-mpi-btl-usnic.txt", "cannot write to map file",
true, true,
ompi_process_info.nodename, opal_process_info.nodename,
filename, filename,
dirname, dirname,
strerror(errno), errno); strerror(errno), errno);

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

@ -192,7 +192,7 @@ static void add_procs_warn_ah_fail(opal_btl_usnic_module_t *module,
module->if_name, local, remote); module->if_name, local, remote);
opal_show_help("help-mpi-btl-usnic.txt", "create_ah failed", opal_show_help("help-mpi-btl-usnic.txt", "create_ah failed",
true, true,
ompi_process_info.nodename, opal_process_info.nodename,
local, local,
module->if_name, module->if_name,
ibv_get_device_name(module->device), ibv_get_device_name(module->device),
@ -274,7 +274,7 @@ static int add_procs_create_ahs(opal_btl_usnic_module_t *module,
else if (EAGAIN != errno) { else if (EAGAIN != errno) {
opal_show_help("help-mpi-btl-usnic.txt", "ibv API failed", opal_show_help("help-mpi-btl-usnic.txt", "ibv API failed",
true, true,
ompi_process_info.nodename, opal_process_info.nodename,
ibv_get_device_name(module->device), ibv_get_device_name(module->device),
module->if_name, module->if_name,
"ibv_create_ah()", __FILE__, __LINE__, "ibv_create_ah()", __FILE__, __LINE__,
@ -294,7 +294,7 @@ static int add_procs_create_ahs(opal_btl_usnic_module_t *module,
mca_btl_usnic_component.arp_timeout)) { mca_btl_usnic_component.arp_timeout)) {
opal_show_help("help-mpi-btl-usnic.txt", "ibv_create_ah timeout", opal_show_help("help-mpi-btl-usnic.txt", "ibv_create_ah timeout",
true, true,
ompi_process_info.nodename, opal_process_info.nodename,
ibv_get_device_name(module->device), ibv_get_device_name(module->device),
module->if_name, module->if_name,
mca_btl_usnic_component.arp_timeout); mca_btl_usnic_component.arp_timeout);
@ -1737,7 +1737,7 @@ static void module_async_event_callback(int fd, short flags, void *arg)
opal_show_help("help-mpi-btl-usnic.txt", "async event", opal_show_help("help-mpi-btl-usnic.txt", "async event",
true, true,
ompi_process_info.nodename, opal_process_info.nodename,
ibv_get_device_name(module->device), ibv_get_device_name(module->device),
module->if_name, module->if_name,
ibv_event_type_str(event.event_type), ibv_event_type_str(event.event_type),
@ -1805,7 +1805,7 @@ init_qp(
if (NULL == channel->qp) { if (NULL == channel->qp) {
opal_show_help("help-mpi-btl-usnic.txt", "create ibv resource failed", opal_show_help("help-mpi-btl-usnic.txt", "create ibv resource failed",
true, true,
ompi_process_info.nodename, opal_process_info.nodename,
ibv_get_device_name(module->device), ibv_get_device_name(module->device),
module->if_name, module->if_name,
"ibv_create_qp()", __FILE__, __LINE__, "ibv_create_qp()", __FILE__, __LINE__,
@ -1825,7 +1825,7 @@ init_qp(
IBV_QP_STATE | IBV_QP_PORT)) { IBV_QP_STATE | IBV_QP_PORT)) {
opal_show_help("help-mpi-btl-usnic.txt", "ibv API failed", opal_show_help("help-mpi-btl-usnic.txt", "ibv API failed",
true, true,
ompi_process_info.nodename, opal_process_info.nodename,
ibv_get_device_name(module->device), ibv_get_device_name(module->device),
module->if_name, module->if_name,
"ibv_modify_qp()", __FILE__, __LINE__, "ibv_modify_qp()", __FILE__, __LINE__,
@ -1840,7 +1840,7 @@ init_qp(
&qp_init_attr) != 0) { &qp_init_attr) != 0) {
opal_show_help("help-mpi-btl-usnic.txt", "ibv API failed", opal_show_help("help-mpi-btl-usnic.txt", "ibv API failed",
true, true,
ompi_process_info.nodename, opal_process_info.nodename,
ibv_get_device_name(module->device), ibv_get_device_name(module->device),
module->if_name, module->if_name,
"ibv_query_qp()", __FILE__, __LINE__, "ibv_query_qp()", __FILE__, __LINE__,
@ -1868,7 +1868,7 @@ static int move_qp_to_rtr(opal_btl_usnic_module_t *module,
if (ibv_modify_qp(channel->qp, &qp_attr, IBV_QP_STATE)) { if (ibv_modify_qp(channel->qp, &qp_attr, IBV_QP_STATE)) {
opal_show_help("help-mpi-btl-usnic.txt", "ibv API failed", opal_show_help("help-mpi-btl-usnic.txt", "ibv API failed",
true, true,
ompi_process_info.nodename, opal_process_info.nodename,
ibv_get_device_name(module->device), ibv_get_device_name(module->device),
module->if_name, module->if_name,
"ibv_modify_qp", __FILE__, __LINE__, "ibv_modify_qp", __FILE__, __LINE__,
@ -1891,7 +1891,7 @@ static int move_qp_to_rts(opal_btl_usnic_module_t *module,
if (ibv_modify_qp(channel->qp, &qp_attr, IBV_QP_STATE)) { if (ibv_modify_qp(channel->qp, &qp_attr, IBV_QP_STATE)) {
opal_show_help("help-mpi-btl-usnic.txt", "ibv API failed", opal_show_help("help-mpi-btl-usnic.txt", "ibv API failed",
true, true,
ompi_process_info.nodename, opal_process_info.nodename,
ibv_get_device_name(module->device), ibv_get_device_name(module->device),
module->if_name, module->if_name,
"ibv_modify_qp", __FILE__, __LINE__, "ibv_modify_qp", __FILE__, __LINE__,
@ -1970,7 +1970,7 @@ opal_btl_usnic_channel_init(
if (NULL == channel->cq) { if (NULL == channel->cq) {
opal_show_help("help-mpi-btl-usnic.txt", "create ibv resource failed", opal_show_help("help-mpi-btl-usnic.txt", "create ibv resource failed",
true, true,
ompi_process_info.nodename, opal_process_info.nodename,
ibv_get_device_name(module->device), ibv_get_device_name(module->device),
module->if_name, module->if_name,
"ibv_create_cq()", __FILE__, __LINE__, "ibv_create_cq()", __FILE__, __LINE__,
@ -2016,7 +2016,7 @@ opal_btl_usnic_channel_init(
opal_show_help("help-mpi-btl-usnic.txt", opal_show_help("help-mpi-btl-usnic.txt",
"internal error during init", "internal error during init",
true, true,
ompi_process_info.nodename, opal_process_info.nodename,
ibv_get_device_name(module->device), ibv_get_device_name(module->device),
module->if_name, module->if_name,
"get freelist buffer()", __FILE__, __LINE__, "get freelist buffer()", __FILE__, __LINE__,
@ -2031,7 +2031,7 @@ opal_btl_usnic_channel_init(
if (ibv_post_recv(channel->qp, &rseg->rs_recv_desc, &bad_wr)) { if (ibv_post_recv(channel->qp, &rseg->rs_recv_desc, &bad_wr)) {
opal_show_help("help-mpi-btl-usnic.txt", "ibv API failed", opal_show_help("help-mpi-btl-usnic.txt", "ibv API failed",
true, true,
ompi_process_info.nodename, opal_process_info.nodename,
ibv_get_device_name(module->device), ibv_get_device_name(module->device),
module->if_name, module->if_name,
"ibv_post_recv", __FILE__, __LINE__, "ibv_post_recv", __FILE__, __LINE__,
@ -2119,7 +2119,7 @@ int opal_btl_usnic_module_init(opal_btl_usnic_module_t *module)
if (NULL == module->pd) { if (NULL == module->pd) {
opal_show_help("help-mpi-btl-usnic.txt", "ibv API failed", opal_show_help("help-mpi-btl-usnic.txt", "ibv API failed",
true, true,
ompi_process_info.nodename, opal_process_info.nodename,
ibv_get_device_name(module->device), ibv_get_device_name(module->device),
module->if_name, module->if_name,
"ibv_alloc_pd()", __FILE__, __LINE__, "ibv_alloc_pd()", __FILE__, __LINE__,
@ -2140,7 +2140,7 @@ int opal_btl_usnic_module_init(opal_btl_usnic_module_t *module)
if (NULL == module->super.btl_mpool) { if (NULL == module->super.btl_mpool) {
opal_show_help("help-mpi-btl-usnic.txt", "ibv API failed", opal_show_help("help-mpi-btl-usnic.txt", "ibv API failed",
true, true,
ompi_process_info.nodename, opal_process_info.nodename,
ibv_get_device_name(module->device), ibv_get_device_name(module->device),
module->if_name, module->if_name,
"create mpool", __FILE__, __LINE__, "create mpool", __FILE__, __LINE__,

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

@ -202,7 +202,7 @@ static int create_proc(opal_proc_t *opal_proc,
opal_show_help("help-mpi-btl-usnic.txt", opal_show_help("help-mpi-btl-usnic.txt",
"internal error during init", "internal error during init",
true, true,
ompi_process_info.nodename, opal_process_info.nodename,
"<none>", "<none>", "<none>", "<none>",
"opal_modex_recv() failed", __FILE__, __LINE__, "opal_modex_recv() failed", __FILE__, __LINE__,
opal_strerror(rc)); opal_strerror(rc));
@ -219,7 +219,7 @@ static int create_proc(opal_proc_t *opal_proc,
(int) size, (int) sizeof(opal_btl_usnic_addr_t)); (int) size, (int) sizeof(opal_btl_usnic_addr_t));
opal_show_help("help-mpi-btl-usnic.txt", "internal error during init", opal_show_help("help-mpi-btl-usnic.txt", "internal error during init",
true, true,
ompi_process_info.nodename, opal_process_info.nodename,
"<none>", 0, "<none>", 0,
"invalid modex data", __FILE__, __LINE__, "invalid modex data", __FILE__, __LINE__,
msg); msg);
@ -244,7 +244,7 @@ static int create_proc(opal_proc_t *opal_proc,
opal_show_help("help-mpi-btl-usnic.txt", opal_show_help("help-mpi-btl-usnic.txt",
"transport mismatch", "transport mismatch",
true, true,
ompi_process_info.nodename, opal_process_info.nodename,
proc->proc_opal->proc_hostname); proc->proc_opal->proc_hostname);
OBJ_RELEASE(proc); OBJ_RELEASE(proc);
return OPAL_ERR_BAD_PARAM; return OPAL_ERR_BAD_PARAM;
@ -621,7 +621,7 @@ static int match_modex(opal_btl_usnic_module_t *module,
proc->proc_modex[*index_out].mtu != (uint16_t) module->if_mtu) { proc->proc_modex[*index_out].mtu != (uint16_t) module->if_mtu) {
opal_show_help("help-mpi-btl-usnic.txt", "MTU mismatch", opal_show_help("help-mpi-btl-usnic.txt", "MTU mismatch",
true, true,
ompi_process_info.nodename, opal_process_info.nodename,
ibv_get_device_name(module->device), ibv_get_device_name(module->device),
module->if_name, module->if_name,
module->if_mtu, module->if_mtu,

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

@ -241,7 +241,7 @@ void opal_btl_usnic_util_abort(const char *msg, const char *file, int line,
{ {
opal_show_help("help-mpi-btl-usnic.txt", "internal error after init", opal_show_help("help-mpi-btl-usnic.txt", "internal error after init",
true, true,
ompi_process_info.nodename, opal_process_info.nodename,
msg, file, line, strerror(ret)); msg, file, line, strerror(ret));
ompi_rte_abort(ret, NULL); ompi_rte_abort(ret, NULL);

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

@ -147,10 +147,10 @@ OPAL_MODULE_DECLSPEC extern mca_btl_vader_t mca_btl_vader;
/* number of peers on the node (not including self) */ /* number of peers on the node (not including self) */
#define MCA_BTL_VADER_NUM_LOCAL_PEERS ompi_process_info.num_local_peers #define MCA_BTL_VADER_NUM_LOCAL_PEERS opal_process_info.num_local_peers
/* local rank in the group */ /* local rank in the group */
#define MCA_BTL_VADER_LOCAL_RANK ompi_process_info.my_local_rank #define MCA_BTL_VADER_LOCAL_RANK opal_process_info.my_local_rank
/* memcpy is faster at larger sizes but is undefined if the /* memcpy is faster at larger sizes but is undefined if the
pointers are aliased (TODO -- readd alias check) */ pointers are aliased (TODO -- readd alias check) */

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

@ -291,8 +291,8 @@ static mca_btl_base_module_t **mca_btl_vader_component_init (int *num_btls,
{ {
char *sm_file; char *sm_file;
rc = asprintf(&sm_file, "%s" OPAL_PATH_SEP "vader_segment.%s.%d", ompi_process_info.proc_session_dir, rc = asprintf(&sm_file, "%s" OPAL_PATH_SEP "vader_segment.%s.%d", opal_process_info.proc_session_dir,
ompi_process_info.nodename, MCA_BTL_VADER_LOCAL_RANK); opal_process_info.nodename, MCA_BTL_VADER_LOCAL_RANK);
if (0 > rc) { if (0 > rc) {
free (btls); free (btls);
return NULL; return NULL;

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

@ -178,7 +178,7 @@ int mca_mpool_sm_ft_event(int state) {
if(OPAL_CRS_CHECKPOINT == state) { if(OPAL_CRS_CHECKPOINT == state) {
/* Record the shared memory filename */ /* Record the shared memory filename */
asprintf( &file_name, "%s"OPAL_PATH_SEP"shared_mem_pool.%s", asprintf( &file_name, "%s"OPAL_PATH_SEP"shared_mem_pool.%s",
ompi_process_info.job_session_dir, opal_process_info.job_session_dir,
opal_proc_local_get()->proc_hostname ); opal_proc_local_get()->proc_hostname );
orte_sstore.set_attr(orte_sstore_handle_current, SSTORE_METADATA_LOCAL_TOUCH, file_name); orte_sstore.set_attr(orte_sstore_handle_current, SSTORE_METADATA_LOCAL_TOUCH, file_name);
free(file_name); free(file_name);

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

@ -20,6 +20,9 @@
AM_CPPFLAGS="-I$(top_srcdir)/test/support" AM_CPPFLAGS="-I$(top_srcdir)/test/support"
if PROJECT_OMPI
REQUIRES_OMPI = ompi_rb_tree
endif
check_PROGRAMS = \ check_PROGRAMS = \
$(REQUIRES_OMPI) opal_bitmap \ $(REQUIRES_OMPI) opal_bitmap \
@ -69,5 +72,11 @@ opal_value_array_LDADD = \
$(top_builddir)/test/support/libsupport.a $(top_builddir)/test/support/libsupport.a
opal_value_array_DEPENDENCIES = $(opal_value_array_LDADD) opal_value_array_DEPENDENCIES = $(opal_value_array_LDADD)
ompi_rb_tree_SOURCES = ompi_rb_tree.c
ompi_rb_tree_LDADD = \
$(top_builddir)/ompi/libmpi.la \
$(top_builddir)/test/support/libsupport.a
ompi_rb_tree_DEPENDENCIES = $(ompi_rb_tree_LDADD)
clean-local: clean-local:
rm -f opal_bitmap_test_out.txt opal_hash_table_test_out.txt rm -f opal_bitmap_test_out.txt opal_hash_table_test_out.txt

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

@ -28,9 +28,9 @@
#endif #endif
#include <string.h> #include <string.h>
#include "support.h" #include "support.h"
#include "ompi/class/ompi_free_list.h" #include "opal/class/ompi_free_list.h"
#include "ompi/class/ompi_rb_tree.h" #include "opal/class/opal_rb_tree.h"
#include "ompi/mca/mpool/base/base.h" #include "opal/mca/mpool/base/base.h"
#define NUM_KEYS 10000 #define NUM_KEYS 10000
#define SEED 1 #define SEED 1
@ -86,7 +86,7 @@ int comp_key(void* key1, void* key2) {
void test_keys(void) void test_keys(void)
{ {
ompi_rb_tree_t tree; opal_rb_tree_t tree;
int rc, i; int rc, i;
my_key_t keys[NUM_KEYS]; my_key_t keys[NUM_KEYS];
my_val_t vals[NUM_KEYS]; my_val_t vals[NUM_KEYS];
@ -95,8 +95,8 @@ void test_keys(void)
my_val_t *cur_val; my_val_t *cur_val;
long tmp; long tmp;
OBJ_CONSTRUCT(&tree, ompi_rb_tree_t); OBJ_CONSTRUCT(&tree, opal_rb_tree_t);
rc = ompi_rb_tree_init(&tree, comp_key); rc = opal_rb_tree_init(&tree, comp_key);
srand(SEED); srand(SEED);
for(i = 0; i < NUM_KEYS; i++) { for(i = 0; i < NUM_KEYS; i++) {
cur_key = &(keys[i]); cur_key = &(keys[i]);
@ -107,21 +107,21 @@ void test_keys(void)
cur_key->base = (void*) tmp; cur_key->base = (void*) tmp;
tmp += (long) rand(); tmp += (long) rand();
cur_key->bound = (void*) tmp; cur_key->bound = (void*) tmp;
rc = ompi_rb_tree_insert(&tree, cur_key, cur_val); rc = opal_rb_tree_insert(&tree, cur_key, cur_val);
if(OMPI_SUCCESS != rc) { if(OPAL_SUCCESS != rc) {
test_failure("error inserting element in the tree"); test_failure("error inserting element in the tree");
} }
} }
for(i = 0; i < NUM_KEYS; i+=2) { for(i = 0; i < NUM_KEYS; i+=2) {
cur_key = &(keys[i]); cur_key = &(keys[i]);
rc = ompi_rb_tree_delete(&tree, cur_key); rc = opal_rb_tree_delete(&tree, cur_key);
if(OMPI_SUCCESS != rc) { if(OPAL_SUCCESS != rc) {
test_failure("error deleting element in the tree"); test_failure("error deleting element in the tree");
} }
} }
for(i = 1; i < NUM_KEYS; i+=2) { for(i = 1; i < NUM_KEYS; i+=2) {
cur_key = &(keys[i]); cur_key = &(keys[i]);
cur_val = (my_val_t*) ompi_rb_tree_find(&tree, cur_key); cur_val = (my_val_t*) opal_rb_tree_find(&tree, cur_key);
if(cur_val == NULL) { if(cur_val == NULL) {
test_failure("lookup returned NULL item"); test_failure("lookup returned NULL item");
} }
@ -137,21 +137,21 @@ void test_keys(void)
void test1(void) void test1(void)
{ {
ompi_rb_tree_t tree; opal_rb_tree_t tree;
int rc; int rc;
void * result; void * result;
OBJ_CONSTRUCT(&tree, ompi_rb_tree_t); OBJ_CONSTRUCT(&tree, opal_rb_tree_t);
rc = ompi_rb_tree_init(&tree, comp_fn); rc = opal_rb_tree_init(&tree, comp_fn);
if(!test_verify_int(OMPI_SUCCESS, rc)) { if(!test_verify_int(OPAL_SUCCESS, rc)) {
test_failure("failed to properly initialize the tree"); test_failure("failed to properly initialize the tree");
} }
rc = ompi_rb_tree_insert(&tree, &keys[0], &values[0]); rc = opal_rb_tree_insert(&tree, &keys[0], &values[0]);
if(!test_verify_int(OMPI_SUCCESS, rc)) { if(!test_verify_int(OPAL_SUCCESS, rc)) {
test_failure("failed to properly insert a new node"); test_failure("failed to properly insert a new node");
} }
result = ompi_rb_tree_find(&tree, &keys[0]); result = opal_rb_tree_find(&tree, &keys[0]);
if(NULL == result) { if(NULL == result) {
test_failure("lookup returned null!"); test_failure("lookup returned null!");
} }
@ -159,11 +159,11 @@ void test1(void)
test_failure("failed to properly insert a new node"); test_failure("failed to properly insert a new node");
} }
rc = ompi_rb_tree_insert(&tree, &keys[1], &values[1]); rc = opal_rb_tree_insert(&tree, &keys[1], &values[1]);
if(!test_verify_int(OMPI_SUCCESS, rc)) { if(!test_verify_int(OPAL_SUCCESS, rc)) {
test_failure("failed to properly insert a new node"); test_failure("failed to properly insert a new node");
} }
result = ompi_rb_tree_find(&tree, &keys[1]); result = opal_rb_tree_find(&tree, &keys[1]);
if(NULL == result) { if(NULL == result) {
test_failure("lookup returned null!"); test_failure("lookup returned null!");
} }
@ -171,11 +171,11 @@ void test1(void)
test_failure("failed to properly insert a new node"); test_failure("failed to properly insert a new node");
} }
rc = ompi_rb_tree_insert(&tree, &keys[2], &values[2]); rc = opal_rb_tree_insert(&tree, &keys[2], &values[2]);
if(!test_verify_int(OMPI_SUCCESS, rc)) { if(!test_verify_int(OPAL_SUCCESS, rc)) {
test_failure("failed to properly insert a new node"); test_failure("failed to properly insert a new node");
} }
result = ompi_rb_tree_find(&tree, &keys[2]); result = opal_rb_tree_find(&tree, &keys[2]);
if(NULL == result) { if(NULL == result) {
test_failure("lookup returned null!"); test_failure("lookup returned null!");
} }
@ -183,11 +183,11 @@ void test1(void)
test_failure("failed to properly insert a new node"); test_failure("failed to properly insert a new node");
} }
rc = ompi_rb_tree_insert(&tree, &keys[3], &values[3]); rc = opal_rb_tree_insert(&tree, &keys[3], &values[3]);
if(!test_verify_int(OMPI_SUCCESS, rc)) { if(!test_verify_int(OPAL_SUCCESS, rc)) {
test_failure("failed to properly insert a new node"); test_failure("failed to properly insert a new node");
} }
result = ompi_rb_tree_find(&tree, &keys[3]); result = opal_rb_tree_find(&tree, &keys[3]);
if(NULL == result) { if(NULL == result) {
test_failure("lookup returned null!"); test_failure("lookup returned null!");
} }
@ -195,11 +195,11 @@ void test1(void)
test_failure("failed to properly insert a new node"); test_failure("failed to properly insert a new node");
} }
rc = ompi_rb_tree_insert(&tree, &keys[4], &values[4]); rc = opal_rb_tree_insert(&tree, &keys[4], &values[4]);
if(!test_verify_int(OMPI_SUCCESS, rc)) { if(!test_verify_int(OPAL_SUCCESS, rc)) {
test_failure("failed to properly insert a new node"); test_failure("failed to properly insert a new node");
} }
result = ompi_rb_tree_find(&tree, &keys[4]); result = opal_rb_tree_find(&tree, &keys[4]);
if(NULL == result) { if(NULL == result) {
test_failure("lookup returned null!"); test_failure("lookup returned null!");
} }
@ -207,11 +207,11 @@ void test1(void)
test_failure("failed to properly insert a new node"); test_failure("failed to properly insert a new node");
} }
rc = ompi_rb_tree_insert(&tree, &keys[5], &values[5]); rc = opal_rb_tree_insert(&tree, &keys[5], &values[5]);
if(!test_verify_int(OMPI_SUCCESS, rc)) { if(!test_verify_int(OPAL_SUCCESS, rc)) {
test_failure("failed to properly insert a new node"); test_failure("failed to properly insert a new node");
} }
result = ompi_rb_tree_find(&tree, &keys[5]); result = opal_rb_tree_find(&tree, &keys[5]);
if(NULL == result) { if(NULL == result) {
test_failure("lookup returned null!"); test_failure("lookup returned null!");
} }
@ -219,11 +219,11 @@ void test1(void)
test_failure("failed to properly insert a new node"); test_failure("failed to properly insert a new node");
} }
rc = ompi_rb_tree_insert(&tree, &keys[6], &values[6]); rc = opal_rb_tree_insert(&tree, &keys[6], &values[6]);
if(!test_verify_int(OMPI_SUCCESS, rc)) { if(!test_verify_int(OPAL_SUCCESS, rc)) {
test_failure("failed to properly insert a new node"); test_failure("failed to properly insert a new node");
} }
result = ompi_rb_tree_find(&tree, &keys[6]); result = opal_rb_tree_find(&tree, &keys[6]);
if(NULL == result) { if(NULL == result) {
test_failure("lookup returned null!"); test_failure("lookup returned null!");
} }
@ -231,11 +231,11 @@ void test1(void)
test_failure("failed to properly insert a new node"); test_failure("failed to properly insert a new node");
} }
rc = ompi_rb_tree_insert(&tree, &keys[7], &values[7]); rc = opal_rb_tree_insert(&tree, &keys[7], &values[7]);
if(!test_verify_int(OMPI_SUCCESS, rc)) { if(!test_verify_int(OPAL_SUCCESS, rc)) {
test_failure("failed to properly insert a new node"); test_failure("failed to properly insert a new node");
} }
result = ompi_rb_tree_find(&tree, &keys[7]); result = opal_rb_tree_find(&tree, &keys[7]);
if(NULL == result) { if(NULL == result) {
test_failure("lookup returned null!"); test_failure("lookup returned null!");
} }
@ -243,16 +243,16 @@ void test1(void)
test_failure("failed to properly insert a new node"); test_failure("failed to properly insert a new node");
} }
rc = ompi_rb_tree_size(&tree); rc = opal_rb_tree_size(&tree);
if(!test_verify_int(8, rc)) { if(!test_verify_int(8, rc)) {
test_failure("failed to properly insert a new node"); test_failure("failed to properly insert a new node");
} }
rc = ompi_rb_tree_delete(&tree, &keys[0]); rc = opal_rb_tree_delete(&tree, &keys[0]);
if(!test_verify_int(OMPI_SUCCESS, rc)) { if(!test_verify_int(OPAL_SUCCESS, rc)) {
test_failure("failed to properly delete a node"); test_failure("failed to properly delete a node");
} }
result = ompi_rb_tree_find(&tree, &keys[0]); result = opal_rb_tree_find(&tree, &keys[0]);
if(NULL != result) { if(NULL != result) {
test_failure("lookup returned a value instead of null!"); test_failure("lookup returned a value instead of null!");
} else { } else {
@ -272,33 +272,33 @@ void test2(void);
/* the number of memory segments to allocate */ /* the number of memory segments to allocate */
#define NUM_ALLOCATIONS 500 #define NUM_ALLOCATIONS 500
struct ompi_test_rb_key_t struct opal_test_rb_key_t
{ {
void * bottom; /* the bottom of the memory range */ void * bottom; /* the bottom of the memory range */
void * top; /* the top of the memory range */ void * top; /* the top of the memory range */
}; };
typedef struct ompi_test_rb_key_t ompi_test_rb_key_t; typedef struct opal_test_rb_key_t opal_test_rb_key_t;
struct ompi_test_rb_value_t struct opal_test_rb_value_t
{ {
ompi_free_list_item_t super; /* the parent class */ ompi_free_list_item_t super; /* the parent class */
ompi_test_rb_key_t key; /* the key which holds the memory pointers */ opal_test_rb_key_t key; /* the key which holds the memory pointers */
mca_mpool_base_module_t* registered_mpools[MAX_REGISTRATIONS]; mca_mpool_base_module_t* registered_mpools[MAX_REGISTRATIONS];
/* the mpools the memory is registered with */ /* the mpools the memory is registered with */
}; };
typedef struct ompi_test_rb_value_t ompi_test_rb_value_t; typedef struct opal_test_rb_value_t opal_test_rb_value_t;
OBJ_CLASS_INSTANCE(ompi_test_rb_value_t, ompi_free_list_item_t, NULL, NULL); OBJ_CLASS_INSTANCE(opal_test_rb_value_t, ompi_free_list_item_t, NULL, NULL);
int mem_node_compare(void * key1, void * key2) int mem_node_compare(void * key1, void * key2)
{ {
if(((ompi_test_rb_key_t *) key1)->bottom < if(((opal_test_rb_key_t *) key1)->bottom <
((ompi_test_rb_key_t *) key2)->bottom) ((opal_test_rb_key_t *) key2)->bottom)
{ {
return -1; return -1;
} }
else if(((ompi_test_rb_key_t *) key1)->bottom > else if(((opal_test_rb_key_t *) key1)->bottom >
((ompi_test_rb_key_t *) key2)->top) ((opal_test_rb_key_t *) key2)->top)
{ {
return 1; return 1;
} }
@ -309,7 +309,7 @@ void test2(void)
{ {
ompi_free_list_t key_list; ompi_free_list_t key_list;
ompi_free_list_item_t * new_value; ompi_free_list_item_t * new_value;
ompi_rb_tree_t tree; opal_rb_tree_t tree;
int rc, i, size; int rc, i, size;
void * result, * lookup; void * result, * lookup;
void * mem[NUM_ALLOCATIONS]; void * mem[NUM_ALLOCATIONS];
@ -317,15 +317,15 @@ void test2(void)
struct timeval start, end; struct timeval start, end;
OBJ_CONSTRUCT(&key_list, ompi_free_list_t); OBJ_CONSTRUCT(&key_list, ompi_free_list_t);
ompi_free_list_init_new(&key_list, sizeof(ompi_test_rb_value_t), ompi_free_list_init_new(&key_list, sizeof(opal_test_rb_value_t),
opal_cache_line_size, opal_cache_line_size,
OBJ_CLASS(ompi_test_rb_value_t), OBJ_CLASS(opal_test_rb_value_t),
0,opal_cache_line_size, 0,opal_cache_line_size,
0, -1 , 128, NULL); 0, -1 , 128, NULL);
OBJ_CONSTRUCT(&tree, ompi_rb_tree_t); OBJ_CONSTRUCT(&tree, opal_rb_tree_t);
rc = ompi_rb_tree_init(&tree, mem_node_compare); rc = opal_rb_tree_init(&tree, mem_node_compare);
if(!test_verify_int(OMPI_SUCCESS, rc)) { if(!test_verify_int(OPAL_SUCCESS, rc)) {
test_failure("failed to properly initialize the tree"); test_failure("failed to properly initialize the tree");
} }
@ -344,13 +344,13 @@ void test2(void)
test_failure("failed to get memory from free list"); test_failure("failed to get memory from free list");
} }
key_array[i] = new_value; key_array[i] = new_value;
((ompi_test_rb_value_t *) new_value)->key.bottom = mem[i]; ((opal_test_rb_value_t *) new_value)->key.bottom = mem[i];
((ompi_test_rb_value_t *) new_value)->key.top = ((opal_test_rb_value_t *) new_value)->key.top =
(void *) ((size_t) mem[i] + size - 1); (void *) ((size_t) mem[i] + size - 1);
((ompi_test_rb_value_t *) new_value)->registered_mpools[0] = (void *)(intptr_t) i; ((opal_test_rb_value_t *) new_value)->registered_mpools[0] = (void *)(intptr_t) i;
rc = ompi_rb_tree_insert(&tree, &((ompi_test_rb_value_t *)new_value)->key, rc = opal_rb_tree_insert(&tree, &((opal_test_rb_value_t *)new_value)->key,
new_value); new_value);
if(OMPI_SUCCESS != rc) if(OPAL_SUCCESS != rc)
{ {
test_failure("failed to properly insert a new node"); test_failure("failed to properly insert a new node");
} }
@ -361,19 +361,19 @@ void test2(void)
for(i = 0; i < NUM_ALLOCATIONS; i++) for(i = 0; i < NUM_ALLOCATIONS; i++)
{ {
lookup = (void *) ((size_t) mem[i] + i); lookup = (void *) ((size_t) mem[i] + i);
result = ompi_rb_tree_find(&tree, &lookup); result = opal_rb_tree_find(&tree, &lookup);
if(NULL == result) if(NULL == result)
{ {
test_failure("lookup returned null!"); test_failure("lookup returned null!");
} else if(i != ((int)(intptr_t) ((ompi_test_rb_value_t *) result)->registered_mpools[0])) } else if(i != ((int)(intptr_t) ((opal_test_rb_value_t *) result)->registered_mpools[0]))
{ {
test_failure("lookup returned wrong node!"); test_failure("lookup returned wrong node!");
} }
result = ompi_rb_tree_find(&tree, &lookup); result = opal_rb_tree_find(&tree, &lookup);
if(NULL == result) if(NULL == result)
{ {
test_failure("lookup returned null!"); test_failure("lookup returned null!");
} else if(i != ((int)(intptr_t) ((ompi_test_rb_value_t *) result)->registered_mpools[0])) } else if(i != ((int)(intptr_t) ((opal_test_rb_value_t *) result)->registered_mpools[0]))
{ {
test_failure("lookup returned wrong node!"); test_failure("lookup returned wrong node!");
} }
@ -403,7 +403,7 @@ void test2(void)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
test_init("ompi_rb_tree_t"); test_init("opal_rb_tree_t");
test1(); test1();
test2(); test2();