Skip to content

Commit

Permalink
IB/DC/TEST: Fix compilation with gcc 7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
yosefe committed Jun 28, 2017
1 parent 0adcbe4 commit 71dfa34
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 36 deletions.
3 changes: 2 additions & 1 deletion src/uct/ib/base/ib_md.c
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,8 @@ static ucs_rcache_ops_t uct_ib_rcache_ops = {

static void uct_ib_make_md_name(char md_name[UCT_MD_NAME_MAX], struct ibv_device *device)
{
snprintf(md_name, UCT_MD_NAME_MAX, "%s/%s", UCT_IB_MD_PREFIX, device->name);
snprintf(md_name, UCT_MD_NAME_MAX, "%s/", UCT_IB_MD_PREFIX);
strncat(md_name, device->name, UCT_MD_NAME_MAX);
}

static ucs_status_t uct_ib_query_md_resources(uct_md_resource_desc_t **resources_p,
Expand Down
6 changes: 3 additions & 3 deletions src/uct/ib/dc/accel/dc_mlx5.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ uct_dc_mlx5_iface_atomic_post(uct_dc_mlx5_iface_t *iface, uct_dc_mlx5_ep_t *ep,
desc->super.sn = txwq->sw_pi;
uct_rc_mlx5_txqp_dptr_post(&iface->super.super, IBV_EXP_QPT_DC_INI, txqp, txwq,
opcode, desc + 1, length, &desc->lkey,
0, NULL, 0, remote_addr, ib_rkey,
0, desc/*dummy*/, 0, remote_addr, ib_rkey,
compare_mask, compare, swap_add,
&ep->av, uct_ib_mlx5_wqe_av_size(&ep->av),
MLX5_WQE_CTRL_CQ_UPDATE);
Expand Down Expand Up @@ -624,7 +624,7 @@ ucs_status_t uct_dc_mlx5_ep_fc_ctrl(uct_ep_t *tl_ep, unsigned op,

uct_rc_mlx5_txqp_inline_post(&iface->super.super, IBV_EXP_QPT_DC_INI,
txqp, txwq, MLX5_OPCODE_SEND,
NULL, 0, op, sender_ep, 0,
&av /*dummy*/, 0, op, sender_ep, 0,
0, 0,
&av, uct_ib_mlx5_wqe_av_size(&av));
} else {
Expand All @@ -637,7 +637,7 @@ ucs_status_t uct_dc_mlx5_ep_fc_ctrl(uct_ep_t *tl_ep, unsigned op,

uct_rc_mlx5_txqp_inline_post(&iface->super.super, IBV_EXP_QPT_DC_INI,
txqp, txwq, MLX5_OPCODE_SEND_IMM,
NULL, 0, op, sender_ep,
&dc_mlx5_ep->av /*dummy*/, 0, op, sender_ep,
iface->super.rx.dct->dct_num,
0, 0,
&dc_mlx5_ep->av,
Expand Down
42 changes: 24 additions & 18 deletions test/gtest/ucs/test_stats.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,21 @@ extern "C" {
class stats_test : public ucs::test {
public:

template <unsigned N>
struct stats_class {
ucs_stats_class_t cls;
const char *counter_names[N];
};
stats_test() {
size_t size = sizeof(ucs_stats_class_t) +
NUM_COUNTERS * sizeof(m_data_stats_class->counter_names[0]);
m_data_stats_class = (ucs_stats_class_t*)malloc(size);
m_data_stats_class->name = "data";
m_data_stats_class->num_counters = NUM_COUNTERS;
m_data_stats_class->counter_names[0] = "counter0";
m_data_stats_class->counter_names[1] = "counter1";
m_data_stats_class->counter_names[2] = "counter2";
m_data_stats_class->counter_names[3] = "counter3";
}

~stats_test() {
free(m_data_stats_class);
}

virtual void init() {
ucs::test::init();
Expand All @@ -46,21 +56,16 @@ class stats_test : public ucs::test {

void prepare_nodes(ucs_stats_node_t **cat_node,
ucs_stats_node_t *data_nodes[NUM_DATA_NODES]) {
static stats_class<0> category_stats_class = {
{"category", 0, {}}
};

static stats_class<4> data_stats_class = {
{ "data", NUM_COUNTERS, {} },
{ "counter0","counter1","counter2","counter3" }
static ucs_stats_class_t category_stats_class = {
"category", 0, {}
};

ucs_status_t status = UCS_STATS_NODE_ALLOC(cat_node,
&category_stats_class.cls,
&category_stats_class,
ucs_stats_get_root());
ASSERT_UCS_OK(status);
for (unsigned i = 0; i < NUM_DATA_NODES; ++i) {
status = UCS_STATS_NODE_ALLOC(&data_nodes[i], &data_stats_class.cls,
status = UCS_STATS_NODE_ALLOC(&data_nodes[i], m_data_stats_class,
*cat_node, "-%d", i);
ASSERT_UCS_OK(status);

Expand Down Expand Up @@ -109,6 +114,8 @@ class stats_test : public ucs::test {

protected:
static const unsigned NUM_COUNTERS = 4;

ucs_stats_class_t *m_data_stats_class;
};

class stats_udp_test : public stats_test {
Expand Down Expand Up @@ -250,11 +257,10 @@ class stats_on_exit_test : public stats_file_test {
UCS_TEST_F(stats_on_demand_test, null_root) {
ucs_stats_node_t *cat_node;

static stats_class<0> category_stats_class = {
{"category", 0, {}}
static ucs_stats_class_t category_stats_class = {
"category", 0, {}
};
ucs_status_t status = UCS_STATS_NODE_ALLOC(&cat_node,
&category_stats_class.cls,
ucs_status_t status = UCS_STATS_NODE_ALLOC(&cat_node, &category_stats_class,
NULL);

EXPECT_GE(status, UCS_ERR_INVALID_PARAM);
Expand Down
38 changes: 24 additions & 14 deletions test/gtest/ucs/test_stats_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,24 @@ extern "C" {
class stats_filter_test : public ucs::test {
public:

template <unsigned N>
struct stats_class {
ucs_stats_class_t cls;
const char *counter_names[N];
};
stats_filter_test() {
size_t size = sizeof(ucs_stats_class_t) +
NUM_COUNTERS * sizeof(m_data_stats_class->counter_names[0]);
m_data_stats_class = (ucs_stats_class_t*)malloc(size);
m_data_stats_class->name = "data";
m_data_stats_class->num_counters = NUM_COUNTERS;
m_data_stats_class->counter_names[0] = "counter0";
m_data_stats_class->counter_names[1] = "counter1";
m_data_stats_class->counter_names[2] = "counter2";
m_data_stats_class->counter_names[3] = "counter3";

cat_node = NULL;
data_nodes[0] = data_nodes[1] = data_nodes[2] = NULL;
}

~stats_filter_test() {
free(m_data_stats_class);
}

virtual void init() {
ucs::test::init();
Expand All @@ -47,19 +60,15 @@ class stats_filter_test : public ucs::test {
virtual std::string stats_format_config() = 0;

void prepare_nodes() {
static stats_class<0> category_stats_class = {
{"category", 0, {}}
};

static stats_class<4> data_stats_class = {
{ "data", NUM_COUNTERS, {} },
{ "counter0","counter1","counter2","counter3" }
static ucs_stats_class_t category_stats_class = {
"category", 0, {}
};

ucs_status_t status = UCS_STATS_NODE_ALLOC(&cat_node, &category_stats_class.cls, ucs_stats_get_root());
ucs_status_t status = UCS_STATS_NODE_ALLOC(&cat_node, &category_stats_class,
ucs_stats_get_root());
ASSERT_UCS_OK(status);
for (unsigned i = 0; i < NUM_DATA_NODES; ++i) {
status = UCS_STATS_NODE_ALLOC(&data_nodes[i], &data_stats_class.cls,
status = UCS_STATS_NODE_ALLOC(&data_nodes[i], m_data_stats_class,
cat_node, "-%d", i);
ASSERT_UCS_OK(status);

Expand All @@ -81,6 +90,7 @@ class stats_filter_test : public ucs::test {
static const unsigned NUM_DATA_NODES = 3;
static const unsigned NUM_COUNTERS = 4;

ucs_stats_class_t *m_data_stats_class;
ucs_stats_node_t *cat_node;
ucs_stats_node_t *data_nodes[NUM_DATA_NODES];
};
Expand Down

0 comments on commit 71dfa34

Please sign in to comment.