Use opal_process_info whenever possible. Some other minor cleanups.
This commit was SVN r32325.
Этот коммит содержится в:
родитель
a3feb627cf
Коммит
f217661ee0
@ -39,10 +39,8 @@
|
||||
#include "opal/mca/btl/btl.h"
|
||||
#include "opal/mca/btl/base/btl_base_error.h"
|
||||
|
||||
#include "ompi/mca/rte/rte.h"
|
||||
|
||||
#if OPAL_ENABLE_FT_CR == 1
|
||||
#include "ompi/runtime/ompi_cr.h"
|
||||
#include "opal/runtime/opal_cr.h"
|
||||
#endif
|
||||
|
||||
#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,
|
||||
mca_btl_openib_component.num_xrc_qps,
|
||||
ibv_get_device_name(device->ib_dev),
|
||||
ompi_process_info.nodename);
|
||||
opal_process_info.nodename);
|
||||
return OPAL_ERROR;
|
||||
}
|
||||
|
||||
|
@ -84,8 +84,7 @@
|
||||
#include "opal/runtime/opal_params.h"
|
||||
#include "opal/runtime/opal.h"
|
||||
|
||||
#include "ompi/runtime/ompi_module_exchange.h"
|
||||
#include "ompi/runtime/mpiruntime.h"
|
||||
#include "ompi/mca/rte/rte.h"
|
||||
|
||||
#include "btl_openib.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,
|
||||
"[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),
|
||||
openib_btl->port_num);
|
||||
return OPAL_SUCCESS;
|
||||
@ -2566,7 +2565,7 @@ btl_openib_component_init(int *num_btl_modules,
|
||||
(dev_sorted[i].distance - distance) > EPS) {
|
||||
opal_output_verbose(1, opal_btl_base_framework.framework_output,
|
||||
"[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));
|
||||
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);
|
||||
len = asprintf(&xrc_file_name,
|
||||
"%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) {
|
||||
BTL_ERROR(("Failed to allocate memomry for XRC file name: %s\n",
|
||||
strerror(errno)));
|
||||
|
@ -2435,7 +2435,7 @@ static int udcm_xrc_send_qp_create (mca_btl_base_endpoint_t *lcl_ep)
|
||||
if (NULL == *qp) {
|
||||
opal_show_help("help-mpi-btl-openib-cpc-base.txt",
|
||||
"ibv_create_qp failed", true,
|
||||
orte_process_info.nodename,
|
||||
ompi_process_info.nodename,
|
||||
ibv_get_device_name(openib_btl->device->ib_dev),
|
||||
"Reliable connected (XRC)");
|
||||
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) {
|
||||
lcl_ep->qps[0].ib_inline_max = qp_init_attr.cap.max_inline_data;
|
||||
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),
|
||||
openib_btl->port_num,
|
||||
req_inline, qp_init_attr.cap.max_inline_data);
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include "opal/mca/event/event.h"
|
||||
#include "opal/util/output.h"
|
||||
#include "ompi/runtime/ompi_module_exchange.h"
|
||||
|
||||
#include "portals4.h"
|
||||
#include "btl_portals4.h"
|
||||
|
@ -60,7 +60,7 @@
|
||||
#include "opal/mca/crs/base/base.h"
|
||||
#include "opal/util/basename.h"
|
||||
#include "orte/mca/sstore/sstore.h"
|
||||
#include "ompi/runtime/ompi_cr.h"
|
||||
#include "opal/runtime/opal_cr.h"
|
||||
#endif
|
||||
|
||||
#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;
|
||||
|
||||
/* 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 */
|
||||
for (w=0; w < i; w++) {
|
||||
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);
|
||||
#if OPAL_ENABLE_PROGRESS_THREADS == 1
|
||||
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);
|
||||
ep->fifo_fd = open(path, O_WRONLY);
|
||||
if(ep->fifo_fd < 0) {
|
||||
|
@ -368,7 +368,7 @@ get_num_local_procs(void)
|
||||
{
|
||||
/* num_local_peers does not include us in
|
||||
* 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
|
||||
@ -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,
|
||||
"%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) {
|
||||
/* rc set */
|
||||
goto out;
|
||||
}
|
||||
if (asprintf(&comp_ptr->sm_mpool_rndv_file_name,
|
||||
"%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) {
|
||||
/* rc set */
|
||||
goto out;
|
||||
}
|
||||
if (asprintf(&comp_ptr->sm_ctl_file_name,
|
||||
"%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) {
|
||||
/* rc set */
|
||||
goto out;
|
||||
}
|
||||
if (asprintf(&comp_ptr->sm_rndv_file_name,
|
||||
"%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) {
|
||||
/* rc set */
|
||||
goto out;
|
||||
@ -702,7 +702,7 @@ mca_btl_sm_component_init(int *num_btls,
|
||||
mca_btl_sm_component.sm_mpool_base = NULL;
|
||||
|
||||
/* 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
|
||||
* file-backed store. Extend shmem to provide this info one day. Especially
|
||||
* 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
|
||||
* to provide that for us. */
|
||||
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);
|
||||
return NULL;
|
||||
}
|
||||
@ -739,7 +739,7 @@ mca_btl_sm_component_init(int *num_btls,
|
||||
#if OPAL_ENABLE_PROGRESS_THREADS == 1
|
||||
/* create a named pipe to receive events */
|
||||
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) );
|
||||
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);
|
||||
|
@ -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;
|
||||
|
||||
/* 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 */
|
||||
for (w=0; w < i; w++) {
|
||||
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);
|
||||
#if OPAL_ENABLE_PROGRESS_THREADS == 1
|
||||
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);
|
||||
ep->fifo_fd = open(path, O_WRONLY);
|
||||
if(ep->fifo_fd < 0) {
|
||||
|
@ -300,7 +300,7 @@ get_num_local_procs(void)
|
||||
{
|
||||
/* num_local_peers does not include us in
|
||||
* 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
|
||||
@ -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,
|
||||
"%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) {
|
||||
/* rc set */
|
||||
goto out;
|
||||
}
|
||||
if (asprintf(&comp_ptr->sm_mpool_rndv_file_name,
|
||||
"%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) {
|
||||
/* rc set */
|
||||
goto out;
|
||||
}
|
||||
if (asprintf(&comp_ptr->sm_ctl_file_name,
|
||||
"%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) {
|
||||
/* rc set */
|
||||
goto out;
|
||||
}
|
||||
if (asprintf(&comp_ptr->sm_rndv_file_name,
|
||||
"%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) {
|
||||
/* rc set */
|
||||
goto out;
|
||||
@ -841,7 +841,7 @@ mca_btl_smcuda_component_init(int *num_btls,
|
||||
mca_btl_smcuda_component.sm_mpool_base = NULL;
|
||||
|
||||
/* 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
|
||||
* file-backed store. Extend shmem to provide this info one day. Especially
|
||||
* 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
|
||||
* to provide that for us. */
|
||||
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);
|
||||
return NULL;
|
||||
}
|
||||
@ -878,7 +878,7 @@ mca_btl_smcuda_component_init(int *num_btls,
|
||||
#if OPAL_ENABLE_PROGRESS_THREADS == 1
|
||||
/* create a named pipe to receive events */
|
||||
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 );
|
||||
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);
|
||||
|
@ -1123,7 +1123,7 @@ static void mca_btl_tcp_component_accept_handler( int incoming_sd,
|
||||
if (opal_socket_errno != EAGAIN &&
|
||||
opal_socket_errno != EWOULDBLOCK) {
|
||||
opal_show_help("help-mpi-btl-tcp.txt", "accept failed",
|
||||
true, ompi_process_info.nodename,
|
||||
true, opal_process_info.nodename,
|
||||
getpid(),
|
||||
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);
|
||||
opal_btl_usnic_sprintf_mac(mac_str, ap->dest_mac);
|
||||
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->usnic_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
|
||||
local rank 0) */
|
||||
if (ompi_process_info.my_local_rank != 0) {
|
||||
if (opal_process_info.my_local_rank != 0) {
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
if (agent_initialized) {
|
||||
@ -1010,7 +1010,7 @@ int opal_btl_usnic_connectivity_agent_init(void)
|
||||
}
|
||||
|
||||
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) {
|
||||
OPAL_ERROR_LOG(OPAL_ERR_IN_ERRNO);
|
||||
ABORT("Out of memory");
|
||||
|
@ -61,7 +61,7 @@ int opal_btl_usnic_connectivity_client_init(void)
|
||||
|
||||
char *ipc_filename = NULL;
|
||||
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) {
|
||||
OPAL_ERROR_LOG(OPAL_ERR_IN_ERRNO);
|
||||
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
|
||||
};
|
||||
/* 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);
|
||||
strncpy(cmd.if_name, module->if_name, CONNECTIVITY_IFNAME_LEN - 1);
|
||||
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",
|
||||
true,
|
||||
ompi_process_info.nodename,
|
||||
opal_process_info.nodename,
|
||||
str_limit);
|
||||
|
||||
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",
|
||||
"not enough usnic resources",
|
||||
true,
|
||||
ompi_process_info.nodename,
|
||||
opal_process_info.nodename,
|
||||
ibv_get_device_name(module->device),
|
||||
str);
|
||||
return OPAL_ERROR;
|
||||
@ -465,7 +465,7 @@ static mca_btl_base_module_t** usnic_component_init(int* num_btl_modules,
|
||||
if (0 != err) {
|
||||
/* API returns negative errno values */
|
||||
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;
|
||||
}
|
||||
|
||||
@ -566,7 +566,7 @@ static mca_btl_base_module_t** usnic_component_init(int* num_btl_modules,
|
||||
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
|
||||
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)) {
|
||||
opal_show_help("help-mpi-btl-usnic.txt", "ibv API failed",
|
||||
true,
|
||||
ompi_process_info.nodename,
|
||||
opal_process_info.nodename,
|
||||
ibv_get_device_name(module->device),
|
||||
module->if_name,
|
||||
"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_show_help("help-mpi-btl-usnic.txt", "ibv API failed",
|
||||
true,
|
||||
ompi_process_info.nodename,
|
||||
opal_process_info.nodename,
|
||||
ibv_get_device_name(module->device),
|
||||
module->if_name,
|
||||
"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. */
|
||||
opal_show_help("help-mpi-btl-usnic.txt", "verbs_port_bw failed",
|
||||
true,
|
||||
ompi_process_info.nodename,
|
||||
opal_process_info.nodename,
|
||||
ibv_get_device_name(module->device),
|
||||
module->if_name);
|
||||
return OPAL_ERROR;
|
||||
@ -1305,7 +1305,7 @@ static usnic_if_filter_t *parse_ifex_str(const char *orig_str,
|
||||
str = strchr(argv[i], '/');
|
||||
if (NULL == str) {
|
||||
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 \"/\")");
|
||||
free(tmp);
|
||||
continue;
|
||||
@ -1314,7 +1314,7 @@ static usnic_if_filter_t *parse_ifex_str(const char *orig_str,
|
||||
argv_prefix = atoi(str + 1);
|
||||
if (argv_prefix < 1 || argv_prefix > 32) {
|
||||
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)");
|
||||
free(tmp);
|
||||
continue;
|
||||
@ -1326,7 +1326,7 @@ static usnic_if_filter_t *parse_ifex_str(const char *orig_str,
|
||||
&((struct sockaddr_in*) &argv_inaddr)->sin_addr);
|
||||
if (1 != ret) {
|
||||
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)");
|
||||
free(tmp);
|
||||
continue;
|
||||
|
@ -235,7 +235,7 @@ void opal_btl_usnic_connectivity_map(void)
|
||||
rank>.txt */
|
||||
asprintf(&filename, "%s-%s.pid%d.job%d.mcwrank%d.txt",
|
||||
mca_btl_usnic_component.connectivity_map_prefix,
|
||||
ompi_process_info.nodename,
|
||||
opal_process_info.nodename,
|
||||
getpid(),
|
||||
opal_process_name_jobid(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';
|
||||
opal_show_help("help-mpi-btl-usnic.txt", "cannot write to map file",
|
||||
true,
|
||||
ompi_process_info.nodename,
|
||||
opal_process_info.nodename,
|
||||
filename,
|
||||
dirname,
|
||||
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);
|
||||
opal_show_help("help-mpi-btl-usnic.txt", "create_ah failed",
|
||||
true,
|
||||
ompi_process_info.nodename,
|
||||
opal_process_info.nodename,
|
||||
local,
|
||||
module->if_name,
|
||||
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) {
|
||||
opal_show_help("help-mpi-btl-usnic.txt", "ibv API failed",
|
||||
true,
|
||||
ompi_process_info.nodename,
|
||||
opal_process_info.nodename,
|
||||
ibv_get_device_name(module->device),
|
||||
module->if_name,
|
||||
"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)) {
|
||||
opal_show_help("help-mpi-btl-usnic.txt", "ibv_create_ah timeout",
|
||||
true,
|
||||
ompi_process_info.nodename,
|
||||
opal_process_info.nodename,
|
||||
ibv_get_device_name(module->device),
|
||||
module->if_name,
|
||||
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",
|
||||
true,
|
||||
ompi_process_info.nodename,
|
||||
opal_process_info.nodename,
|
||||
ibv_get_device_name(module->device),
|
||||
module->if_name,
|
||||
ibv_event_type_str(event.event_type),
|
||||
@ -1805,7 +1805,7 @@ init_qp(
|
||||
if (NULL == channel->qp) {
|
||||
opal_show_help("help-mpi-btl-usnic.txt", "create ibv resource failed",
|
||||
true,
|
||||
ompi_process_info.nodename,
|
||||
opal_process_info.nodename,
|
||||
ibv_get_device_name(module->device),
|
||||
module->if_name,
|
||||
"ibv_create_qp()", __FILE__, __LINE__,
|
||||
@ -1825,7 +1825,7 @@ init_qp(
|
||||
IBV_QP_STATE | IBV_QP_PORT)) {
|
||||
opal_show_help("help-mpi-btl-usnic.txt", "ibv API failed",
|
||||
true,
|
||||
ompi_process_info.nodename,
|
||||
opal_process_info.nodename,
|
||||
ibv_get_device_name(module->device),
|
||||
module->if_name,
|
||||
"ibv_modify_qp()", __FILE__, __LINE__,
|
||||
@ -1840,7 +1840,7 @@ init_qp(
|
||||
&qp_init_attr) != 0) {
|
||||
opal_show_help("help-mpi-btl-usnic.txt", "ibv API failed",
|
||||
true,
|
||||
ompi_process_info.nodename,
|
||||
opal_process_info.nodename,
|
||||
ibv_get_device_name(module->device),
|
||||
module->if_name,
|
||||
"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)) {
|
||||
opal_show_help("help-mpi-btl-usnic.txt", "ibv API failed",
|
||||
true,
|
||||
ompi_process_info.nodename,
|
||||
opal_process_info.nodename,
|
||||
ibv_get_device_name(module->device),
|
||||
module->if_name,
|
||||
"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)) {
|
||||
opal_show_help("help-mpi-btl-usnic.txt", "ibv API failed",
|
||||
true,
|
||||
ompi_process_info.nodename,
|
||||
opal_process_info.nodename,
|
||||
ibv_get_device_name(module->device),
|
||||
module->if_name,
|
||||
"ibv_modify_qp", __FILE__, __LINE__,
|
||||
@ -1970,7 +1970,7 @@ opal_btl_usnic_channel_init(
|
||||
if (NULL == channel->cq) {
|
||||
opal_show_help("help-mpi-btl-usnic.txt", "create ibv resource failed",
|
||||
true,
|
||||
ompi_process_info.nodename,
|
||||
opal_process_info.nodename,
|
||||
ibv_get_device_name(module->device),
|
||||
module->if_name,
|
||||
"ibv_create_cq()", __FILE__, __LINE__,
|
||||
@ -2016,7 +2016,7 @@ opal_btl_usnic_channel_init(
|
||||
opal_show_help("help-mpi-btl-usnic.txt",
|
||||
"internal error during init",
|
||||
true,
|
||||
ompi_process_info.nodename,
|
||||
opal_process_info.nodename,
|
||||
ibv_get_device_name(module->device),
|
||||
module->if_name,
|
||||
"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)) {
|
||||
opal_show_help("help-mpi-btl-usnic.txt", "ibv API failed",
|
||||
true,
|
||||
ompi_process_info.nodename,
|
||||
opal_process_info.nodename,
|
||||
ibv_get_device_name(module->device),
|
||||
module->if_name,
|
||||
"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) {
|
||||
opal_show_help("help-mpi-btl-usnic.txt", "ibv API failed",
|
||||
true,
|
||||
ompi_process_info.nodename,
|
||||
opal_process_info.nodename,
|
||||
ibv_get_device_name(module->device),
|
||||
module->if_name,
|
||||
"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) {
|
||||
opal_show_help("help-mpi-btl-usnic.txt", "ibv API failed",
|
||||
true,
|
||||
ompi_process_info.nodename,
|
||||
opal_process_info.nodename,
|
||||
ibv_get_device_name(module->device),
|
||||
module->if_name,
|
||||
"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",
|
||||
"internal error during init",
|
||||
true,
|
||||
ompi_process_info.nodename,
|
||||
opal_process_info.nodename,
|
||||
"<none>", "<none>",
|
||||
"opal_modex_recv() failed", __FILE__, __LINE__,
|
||||
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));
|
||||
opal_show_help("help-mpi-btl-usnic.txt", "internal error during init",
|
||||
true,
|
||||
ompi_process_info.nodename,
|
||||
opal_process_info.nodename,
|
||||
"<none>", 0,
|
||||
"invalid modex data", __FILE__, __LINE__,
|
||||
msg);
|
||||
@ -244,7 +244,7 @@ static int create_proc(opal_proc_t *opal_proc,
|
||||
opal_show_help("help-mpi-btl-usnic.txt",
|
||||
"transport mismatch",
|
||||
true,
|
||||
ompi_process_info.nodename,
|
||||
opal_process_info.nodename,
|
||||
proc->proc_opal->proc_hostname);
|
||||
OBJ_RELEASE(proc);
|
||||
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) {
|
||||
opal_show_help("help-mpi-btl-usnic.txt", "MTU mismatch",
|
||||
true,
|
||||
ompi_process_info.nodename,
|
||||
opal_process_info.nodename,
|
||||
ibv_get_device_name(module->device),
|
||||
module->if_name,
|
||||
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",
|
||||
true,
|
||||
ompi_process_info.nodename,
|
||||
opal_process_info.nodename,
|
||||
msg, file, line, strerror(ret));
|
||||
|
||||
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) */
|
||||
#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 */
|
||||
#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
|
||||
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;
|
||||
|
||||
rc = asprintf(&sm_file, "%s" OPAL_PATH_SEP "vader_segment.%s.%d", ompi_process_info.proc_session_dir,
|
||||
ompi_process_info.nodename, MCA_BTL_VADER_LOCAL_RANK);
|
||||
rc = asprintf(&sm_file, "%s" OPAL_PATH_SEP "vader_segment.%s.%d", opal_process_info.proc_session_dir,
|
||||
opal_process_info.nodename, MCA_BTL_VADER_LOCAL_RANK);
|
||||
if (0 > rc) {
|
||||
free (btls);
|
||||
return NULL;
|
||||
|
@ -178,7 +178,7 @@ int mca_mpool_sm_ft_event(int state) {
|
||||
if(OPAL_CRS_CHECKPOINT == state) {
|
||||
/* Record the shared memory filename */
|
||||
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 );
|
||||
orte_sstore.set_attr(orte_sstore_handle_current, SSTORE_METADATA_LOCAL_TOUCH, file_name);
|
||||
free(file_name);
|
||||
|
@ -20,6 +20,9 @@
|
||||
|
||||
AM_CPPFLAGS="-I$(top_srcdir)/test/support"
|
||||
|
||||
if PROJECT_OMPI
|
||||
REQUIRES_OMPI = ompi_rb_tree
|
||||
endif
|
||||
|
||||
check_PROGRAMS = \
|
||||
$(REQUIRES_OMPI) opal_bitmap \
|
||||
@ -69,5 +72,11 @@ opal_value_array_LDADD = \
|
||||
$(top_builddir)/test/support/libsupport.a
|
||||
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:
|
||||
rm -f opal_bitmap_test_out.txt opal_hash_table_test_out.txt
|
||||
|
@ -28,9 +28,9 @@
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include "support.h"
|
||||
#include "ompi/class/ompi_free_list.h"
|
||||
#include "ompi/class/ompi_rb_tree.h"
|
||||
#include "ompi/mca/mpool/base/base.h"
|
||||
#include "opal/class/ompi_free_list.h"
|
||||
#include "opal/class/opal_rb_tree.h"
|
||||
#include "opal/mca/mpool/base/base.h"
|
||||
|
||||
#define NUM_KEYS 10000
|
||||
#define SEED 1
|
||||
@ -86,7 +86,7 @@ int comp_key(void* key1, void* key2) {
|
||||
|
||||
void test_keys(void)
|
||||
{
|
||||
ompi_rb_tree_t tree;
|
||||
opal_rb_tree_t tree;
|
||||
int rc, i;
|
||||
my_key_t keys[NUM_KEYS];
|
||||
my_val_t vals[NUM_KEYS];
|
||||
@ -95,8 +95,8 @@ void test_keys(void)
|
||||
my_val_t *cur_val;
|
||||
long tmp;
|
||||
|
||||
OBJ_CONSTRUCT(&tree, ompi_rb_tree_t);
|
||||
rc = ompi_rb_tree_init(&tree, comp_key);
|
||||
OBJ_CONSTRUCT(&tree, opal_rb_tree_t);
|
||||
rc = opal_rb_tree_init(&tree, comp_key);
|
||||
srand(SEED);
|
||||
for(i = 0; i < NUM_KEYS; i++) {
|
||||
cur_key = &(keys[i]);
|
||||
@ -107,21 +107,21 @@ void test_keys(void)
|
||||
cur_key->base = (void*) tmp;
|
||||
tmp += (long) rand();
|
||||
cur_key->bound = (void*) tmp;
|
||||
rc = ompi_rb_tree_insert(&tree, cur_key, cur_val);
|
||||
if(OMPI_SUCCESS != rc) {
|
||||
rc = opal_rb_tree_insert(&tree, cur_key, cur_val);
|
||||
if(OPAL_SUCCESS != rc) {
|
||||
test_failure("error inserting element in the tree");
|
||||
}
|
||||
}
|
||||
for(i = 0; i < NUM_KEYS; i+=2) {
|
||||
cur_key = &(keys[i]);
|
||||
rc = ompi_rb_tree_delete(&tree, cur_key);
|
||||
if(OMPI_SUCCESS != rc) {
|
||||
rc = opal_rb_tree_delete(&tree, cur_key);
|
||||
if(OPAL_SUCCESS != rc) {
|
||||
test_failure("error deleting element in the tree");
|
||||
}
|
||||
}
|
||||
for(i = 1; i < NUM_KEYS; i+=2) {
|
||||
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) {
|
||||
test_failure("lookup returned NULL item");
|
||||
}
|
||||
@ -137,21 +137,21 @@ void test_keys(void)
|
||||
|
||||
void test1(void)
|
||||
{
|
||||
ompi_rb_tree_t tree;
|
||||
opal_rb_tree_t tree;
|
||||
int rc;
|
||||
void * result;
|
||||
|
||||
OBJ_CONSTRUCT(&tree, ompi_rb_tree_t);
|
||||
rc = ompi_rb_tree_init(&tree, comp_fn);
|
||||
if(!test_verify_int(OMPI_SUCCESS, rc)) {
|
||||
OBJ_CONSTRUCT(&tree, opal_rb_tree_t);
|
||||
rc = opal_rb_tree_init(&tree, comp_fn);
|
||||
if(!test_verify_int(OPAL_SUCCESS, rc)) {
|
||||
test_failure("failed to properly initialize the tree");
|
||||
}
|
||||
|
||||
rc = ompi_rb_tree_insert(&tree, &keys[0], &values[0]);
|
||||
if(!test_verify_int(OMPI_SUCCESS, rc)) {
|
||||
rc = opal_rb_tree_insert(&tree, &keys[0], &values[0]);
|
||||
if(!test_verify_int(OPAL_SUCCESS, rc)) {
|
||||
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) {
|
||||
test_failure("lookup returned null!");
|
||||
}
|
||||
@ -159,11 +159,11 @@ void test1(void)
|
||||
test_failure("failed to properly insert a new node");
|
||||
}
|
||||
|
||||
rc = ompi_rb_tree_insert(&tree, &keys[1], &values[1]);
|
||||
if(!test_verify_int(OMPI_SUCCESS, rc)) {
|
||||
rc = opal_rb_tree_insert(&tree, &keys[1], &values[1]);
|
||||
if(!test_verify_int(OPAL_SUCCESS, rc)) {
|
||||
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) {
|
||||
test_failure("lookup returned null!");
|
||||
}
|
||||
@ -171,11 +171,11 @@ void test1(void)
|
||||
test_failure("failed to properly insert a new node");
|
||||
}
|
||||
|
||||
rc = ompi_rb_tree_insert(&tree, &keys[2], &values[2]);
|
||||
if(!test_verify_int(OMPI_SUCCESS, rc)) {
|
||||
rc = opal_rb_tree_insert(&tree, &keys[2], &values[2]);
|
||||
if(!test_verify_int(OPAL_SUCCESS, rc)) {
|
||||
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) {
|
||||
test_failure("lookup returned null!");
|
||||
}
|
||||
@ -183,11 +183,11 @@ void test1(void)
|
||||
test_failure("failed to properly insert a new node");
|
||||
}
|
||||
|
||||
rc = ompi_rb_tree_insert(&tree, &keys[3], &values[3]);
|
||||
if(!test_verify_int(OMPI_SUCCESS, rc)) {
|
||||
rc = opal_rb_tree_insert(&tree, &keys[3], &values[3]);
|
||||
if(!test_verify_int(OPAL_SUCCESS, rc)) {
|
||||
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) {
|
||||
test_failure("lookup returned null!");
|
||||
}
|
||||
@ -195,11 +195,11 @@ void test1(void)
|
||||
test_failure("failed to properly insert a new node");
|
||||
}
|
||||
|
||||
rc = ompi_rb_tree_insert(&tree, &keys[4], &values[4]);
|
||||
if(!test_verify_int(OMPI_SUCCESS, rc)) {
|
||||
rc = opal_rb_tree_insert(&tree, &keys[4], &values[4]);
|
||||
if(!test_verify_int(OPAL_SUCCESS, rc)) {
|
||||
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) {
|
||||
test_failure("lookup returned null!");
|
||||
}
|
||||
@ -207,11 +207,11 @@ void test1(void)
|
||||
test_failure("failed to properly insert a new node");
|
||||
}
|
||||
|
||||
rc = ompi_rb_tree_insert(&tree, &keys[5], &values[5]);
|
||||
if(!test_verify_int(OMPI_SUCCESS, rc)) {
|
||||
rc = opal_rb_tree_insert(&tree, &keys[5], &values[5]);
|
||||
if(!test_verify_int(OPAL_SUCCESS, rc)) {
|
||||
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) {
|
||||
test_failure("lookup returned null!");
|
||||
}
|
||||
@ -219,11 +219,11 @@ void test1(void)
|
||||
test_failure("failed to properly insert a new node");
|
||||
}
|
||||
|
||||
rc = ompi_rb_tree_insert(&tree, &keys[6], &values[6]);
|
||||
if(!test_verify_int(OMPI_SUCCESS, rc)) {
|
||||
rc = opal_rb_tree_insert(&tree, &keys[6], &values[6]);
|
||||
if(!test_verify_int(OPAL_SUCCESS, rc)) {
|
||||
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) {
|
||||
test_failure("lookup returned null!");
|
||||
}
|
||||
@ -231,11 +231,11 @@ void test1(void)
|
||||
test_failure("failed to properly insert a new node");
|
||||
}
|
||||
|
||||
rc = ompi_rb_tree_insert(&tree, &keys[7], &values[7]);
|
||||
if(!test_verify_int(OMPI_SUCCESS, rc)) {
|
||||
rc = opal_rb_tree_insert(&tree, &keys[7], &values[7]);
|
||||
if(!test_verify_int(OPAL_SUCCESS, rc)) {
|
||||
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) {
|
||||
test_failure("lookup returned null!");
|
||||
}
|
||||
@ -243,16 +243,16 @@ void test1(void)
|
||||
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)) {
|
||||
test_failure("failed to properly insert a new node");
|
||||
}
|
||||
|
||||
rc = ompi_rb_tree_delete(&tree, &keys[0]);
|
||||
if(!test_verify_int(OMPI_SUCCESS, rc)) {
|
||||
rc = opal_rb_tree_delete(&tree, &keys[0]);
|
||||
if(!test_verify_int(OPAL_SUCCESS, rc)) {
|
||||
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) {
|
||||
test_failure("lookup returned a value instead of null!");
|
||||
} else {
|
||||
@ -272,33 +272,33 @@ void test2(void);
|
||||
/* the number of memory segments to allocate */
|
||||
#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 * 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_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];
|
||||
/* 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)
|
||||
{
|
||||
if(((ompi_test_rb_key_t *) key1)->bottom <
|
||||
((ompi_test_rb_key_t *) key2)->bottom)
|
||||
if(((opal_test_rb_key_t *) key1)->bottom <
|
||||
((opal_test_rb_key_t *) key2)->bottom)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else if(((ompi_test_rb_key_t *) key1)->bottom >
|
||||
((ompi_test_rb_key_t *) key2)->top)
|
||||
else if(((opal_test_rb_key_t *) key1)->bottom >
|
||||
((opal_test_rb_key_t *) key2)->top)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@ -309,7 +309,7 @@ void test2(void)
|
||||
{
|
||||
ompi_free_list_t key_list;
|
||||
ompi_free_list_item_t * new_value;
|
||||
ompi_rb_tree_t tree;
|
||||
opal_rb_tree_t tree;
|
||||
int rc, i, size;
|
||||
void * result, * lookup;
|
||||
void * mem[NUM_ALLOCATIONS];
|
||||
@ -317,15 +317,15 @@ void test2(void)
|
||||
struct timeval start, end;
|
||||
|
||||
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,
|
||||
OBJ_CLASS(ompi_test_rb_value_t),
|
||||
OBJ_CLASS(opal_test_rb_value_t),
|
||||
0,opal_cache_line_size,
|
||||
0, -1 , 128, NULL);
|
||||
|
||||
OBJ_CONSTRUCT(&tree, ompi_rb_tree_t);
|
||||
rc = ompi_rb_tree_init(&tree, mem_node_compare);
|
||||
if(!test_verify_int(OMPI_SUCCESS, rc)) {
|
||||
OBJ_CONSTRUCT(&tree, opal_rb_tree_t);
|
||||
rc = opal_rb_tree_init(&tree, mem_node_compare);
|
||||
if(!test_verify_int(OPAL_SUCCESS, rc)) {
|
||||
test_failure("failed to properly initialize the tree");
|
||||
}
|
||||
|
||||
@ -344,13 +344,13 @@ void test2(void)
|
||||
test_failure("failed to get memory from free list");
|
||||
}
|
||||
key_array[i] = new_value;
|
||||
((ompi_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.bottom = mem[i];
|
||||
((opal_test_rb_value_t *) new_value)->key.top =
|
||||
(void *) ((size_t) mem[i] + size - 1);
|
||||
((ompi_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,
|
||||
((opal_test_rb_value_t *) new_value)->registered_mpools[0] = (void *)(intptr_t) i;
|
||||
rc = opal_rb_tree_insert(&tree, &((opal_test_rb_value_t *)new_value)->key,
|
||||
new_value);
|
||||
if(OMPI_SUCCESS != rc)
|
||||
if(OPAL_SUCCESS != rc)
|
||||
{
|
||||
test_failure("failed to properly insert a new node");
|
||||
}
|
||||
@ -361,19 +361,19 @@ void test2(void)
|
||||
for(i = 0; i < NUM_ALLOCATIONS; 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)
|
||||
{
|
||||
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!");
|
||||
}
|
||||
result = ompi_rb_tree_find(&tree, &lookup);
|
||||
result = opal_rb_tree_find(&tree, &lookup);
|
||||
if(NULL == result)
|
||||
{
|
||||
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!");
|
||||
}
|
||||
@ -403,7 +403,7 @@ void test2(void)
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
test_init("ompi_rb_tree_t");
|
||||
test_init("opal_rb_tree_t");
|
||||
|
||||
test1();
|
||||
test2();
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user