From 71dfa34ef7b9ac7abeb7a282b9aec9a7c780c3ee Mon Sep 17 00:00:00 2001 From: Yossi Itigin Date: Wed, 28 Jun 2017 22:01:06 +0300 Subject: [PATCH] IB/DC/TEST: Fix compilation with gcc 7.1 --- src/uct/ib/base/ib_md.c | 3 ++- src/uct/ib/dc/accel/dc_mlx5.c | 6 ++--- test/gtest/ucs/test_stats.cc | 42 ++++++++++++++++------------- test/gtest/ucs/test_stats_filter.cc | 38 ++++++++++++++++---------- 4 files changed, 53 insertions(+), 36 deletions(-) diff --git a/src/uct/ib/base/ib_md.c b/src/uct/ib/base/ib_md.c index 7b55e3673e0..b65a145b708 100644 --- a/src/uct/ib/base/ib_md.c +++ b/src/uct/ib/base/ib_md.c @@ -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, diff --git a/src/uct/ib/dc/accel/dc_mlx5.c b/src/uct/ib/dc/accel/dc_mlx5.c index ab4197944c3..55960ef56fd 100644 --- a/src/uct/ib/dc/accel/dc_mlx5.c +++ b/src/uct/ib/dc/accel/dc_mlx5.c @@ -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); @@ -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 { @@ -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, diff --git a/test/gtest/ucs/test_stats.cc b/test/gtest/ucs/test_stats.cc index 24aac5c292e..a8a6f447c61 100644 --- a/test/gtest/ucs/test_stats.cc +++ b/test/gtest/ucs/test_stats.cc @@ -18,11 +18,21 @@ extern "C" { class stats_test : public ucs::test { public: - template - 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(); @@ -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); @@ -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 { @@ -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); diff --git a/test/gtest/ucs/test_stats_filter.cc b/test/gtest/ucs/test_stats_filter.cc index f91008d1895..6a5b21c91a2 100644 --- a/test/gtest/ucs/test_stats_filter.cc +++ b/test/gtest/ucs/test_stats_filter.cc @@ -18,11 +18,24 @@ extern "C" { class stats_filter_test : public ucs::test { public: - template - 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(); @@ -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); @@ -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]; };