Skip to content

Commit 6c63af4

Browse files
committed
TEST/WIREUP: Consider distance when testing bw/latency
1 parent 8df8287 commit 6c63af4

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

test/gtest/ucp/test_ucp_wireup.cc

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1761,13 +1761,14 @@ class test_ucp_address_v2 : public test_ucp_wireup {
17611761
"tag,unified");
17621762
}
17631763

1764-
void check_fp_values(double unpacked, double original)
1764+
void
1765+
check_fp_values(const std::string &name, double unpacked, double original)
17651766
{
17661767
double max_error = original / pow(2, _UCS_FP8_MANTISSA_BITS);
1767-
EXPECT_NEAR(original, unpacked, max_error);
1768+
EXPECT_NEAR(original, unpacked, max_error) << name;
17681769
}
17691770

1770-
const uct_iface_attr_t *get_iface_attr(const ucp_address_entry_t *ae)
1771+
const ucp_worker_iface_t *get_wiface(const ucp_address_entry_t *ae)
17711772
{
17721773
ucp_worker_h worker = sender().worker();
17731774
ucp_context_h context = worker->context;
@@ -1789,7 +1790,7 @@ class test_ucp_address_v2 : public test_ucp_wireup {
17891790
ae->tl_name_csum) &&
17901791
uct_iface_is_reachable_v2(wiface->iface, &params)) {
17911792
EXPECT_EQ(ae->md_index, context->tl_rscs[rsc_index].md_index);
1792-
return &wiface->attr;
1793+
return wiface;
17931794
}
17941795
}
17951796

@@ -1825,20 +1826,22 @@ UCS_TEST_SKIP_COND_P(test_ucp_address_v2, pack_iface_attrs,
18251826

18261827
const ucp_address_entry_t *ae;
18271828
ucp_unpacked_address_for_each(ae, &unpacked_address) {
1828-
auto attr = get_iface_attr(ae);
1829-
ASSERT_NE(nullptr, attr);
1829+
auto wiface = get_wiface(ae);
1830+
ASSERT_NE(nullptr, wiface);
18301831

18311832
// Segment size is packed as a multiplicator of
18321833
// UCP_ADDRESS_IFACE_SEG_SIZE_FACTOR, thus the unpacked value may be
18331834
// smaller than the original value by up to 64 bytes.
1834-
EXPECT_LT(ucp_address_iface_seg_size(attr) - ae->iface_attr.seg_size,
1835+
EXPECT_LT(ucp_address_iface_seg_size(&wiface->attr) -
1836+
ae->iface_attr.seg_size,
18351837
UCP_ADDRESS_IFACE_SEG_SIZE_FACTOR);
1836-
check_fp_values(ae->iface_attr.overhead, attr->overhead);
1837-
check_fp_values(ae->iface_attr.lat_ovh,
1838-
ucp_tl_iface_latency(worker->context, &attr->latency));
1839-
check_fp_values(
1840-
ae->iface_attr.bandwidth,
1841-
ucp_tl_iface_bandwidth(worker->context, &attr->bandwidth));
1838+
1839+
check_fp_values("overhead", ae->iface_attr.overhead,
1840+
wiface->attr.overhead);
1841+
check_fp_values("latency", ae->iface_attr.lat_ovh,
1842+
ucp_wireup_iface_lat_distance_v2(wiface, 0));
1843+
check_fp_values("bandwidth", ae->iface_attr.bandwidth,
1844+
ucp_wireup_iface_bw_distance(wiface));
18421845
}
18431846

18441847
ucs_free(unpacked_address.address_list);

0 commit comments

Comments
 (0)