Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
f7b0e3c
UCP/CORE: Implement flush+destroy for UCT EPs on UCP Worker
dmitrygx Aug 24, 2020
627a8a5
UCP/GTEST: Complete worker_flus operation if there is no flush ops an…
dmitrygx Aug 26, 2020
e9d3b1d
UCT/IB: Fix uct_iface_flush()/uct_ep_flush(LOCAL) after uct_ep_flush(…
dmitrygx Aug 26, 2020
ecd8663
UCT/IB/UD: Reset max_psn instead of stopping TX
dmitrygx Aug 26, 2020
8d4a9f9
UCM/GTEST: Fix leftovers
dmitrygx Aug 27, 2020
d229eae
UCP/WORKER: Introduce khash to find whether UCT EP there or not
dmitrygx Aug 27, 2020
8558d4c
UCP/CORE: Fix Coverity issue
dmitrygx Aug 28, 2020
cdfe88d
UCP/UCT: Fix review comments
dmitrygx Aug 28, 2020
c1a8fee
UCP/CORE: Fix review comments
dmitrygx Aug 31, 2020
28edf67
UCP/CORE: Fix EP-by-EP flush when iface_flush returns NO_RESOURCE
dmitrygx Aug 31, 2020
022a6f2
UCP/RMA/FLUSH: Fix flush ops count check usage
dmitrygx Sep 1, 2020
46b1272
UCP/CORE: Fix tests
dmitrygx Sep 2, 2020
cb197a4
UCP/CORE: Implemented purge
dmitrygx Sep 2, 2020
5d0b3fa
UCP/CORE: Fix bug in purging
dmitrygx Sep 3, 2020
12d1c34
UCP/CORE/GTEST: Fix review comments
dmitrygx Sep 3, 2020
d1ab7d4
GTEST/UCP: Fix review comments
dmitrygx Sep 3, 2020
d809dc1
UCP/CORE/GTEST: Fix bug in purging
dmitrygx Sep 3, 2020
7e6a5b4
Merge remote-tracking branch 'origin/master' into topic/ucp/worker_di…
dmitrygx Sep 3, 2020
a0f759b
UCP/CORE: Fix review comments
dmitrygx Sep 3, 2020
46afaaf
UCP/CORE/WIREUP/GTEST: Fix leak of WIREUP MSG proxy req
dmitrygx Sep 3, 2020
e2982d5
UCP/WIREUP/GTEST: Use pointer to the UCP request to be able free it i…
dmitrygx Sep 4, 2020
7ecd09d
GTEST/UCP: Fix review comments
dmitrygx Sep 4, 2020
9ef1f34
UCP/CORE: Fix review comments
dmitrygx Sep 4, 2020
efdb4d3
GTEST/UCP: Ensure that fluah+pending_add is registered on Worker prog…
dmitrygx Sep 6, 2020
509dd6c
UCP/GTEST: Fix review comments
dmitrygx Sep 7, 2020
07b8bb3
UCP/RMA: Remove flush_ops_count_check
dmitrygx Sep 7, 2020
43c3e92
UCP/GTEST: Fix review comments
dmitrygx Sep 8, 2020
9153e50
UCP/CORE: Added useful comments
dmitrygx Sep 8, 2020
9c346d6
UCP/RMA: Add more comments for flush to make it clear + fix typo
dmitrygx Sep 8, 2020
465be85
GTEST/UCP: Fix review comments
dmitrygx Sep 8, 2020
cdb8875
UCP/CORE: Use progress instead of loop over ERR_BUSY
dmitrygx Sep 8, 2020
2a5888f
UCP/GTEST: Fix review comments
dmitrygx Sep 9, 2020
d3cf051
UCP/WORKER: Fix review comments
dmitrygx Sep 9, 2020
ea18b51
UCP/CORE: Let UCP Wireup EP be destroyed in case of error
dmitrygx Sep 9, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 76 additions & 35 deletions test/gtest/ucp/test_ucp_worker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,22 @@ class test_ucp_worker_discard : public ucp_test {
}

protected:
typedef std::map<uct_ep_h,
std::vector<uct_pending_req_t*> > ep_pending_reqs_map;
struct ep_test_info_t {
std::vector<uct_pending_req_t*> pending_reqs;
unsigned flush_count;
unsigned pending_add_count;
};
typedef std::map<uct_ep_h, ep_test_info_t> ep_test_info_map_t;

void init() {
ucp_test::init();
m_created_ep_count = 0;
m_destroyed_ep_count = 0;
m_flush_ep_count = 0;
m_pending_add_ep_count = 0;
m_fake_ep.flags = UCP_EP_FLAG_REMOTE_CONNECTED;
m_created_ep_count = 0;
m_destroyed_ep_count = 0;
m_fake_ep.flags = UCP_EP_FLAG_REMOTE_CONNECTED;

m_flush_comps.clear();
m_pending_reqs.clear();
m_ep_test_info_map.clear();
}

void add_pending_reqs(uct_ep_h uct_ep,
Expand Down Expand Up @@ -210,6 +213,23 @@ class test_ucp_worker_discard : public ucp_test {
EXPECT_UCS_OK(ucp_request_check_status(flush_req));
EXPECT_EQ(m_created_ep_count, m_destroyed_ep_count);
EXPECT_EQ(m_created_ep_count, total_ep_count);

for (unsigned i = 0; i < m_created_ep_count; i++) {
ep_test_info_t *test_info = ep_test_info_get(&eps[i]);

/* check EP flush counters */
if (ep_flush_func == ep_flush_func_return_3_no_resource_then_ok) {
EXPECT_EQ(4, test_info->flush_count);
} else if (ep_flush_func == ep_flush_func_return_in_progress) {
EXPECT_EQ(1, test_info->flush_count);
}

/* check EP pending add counters */
if (ep_pending_add_func == ep_pending_add_func_return_ok_then_busy) {
EXPECT_EQ(3, test_info->pending_add_count);
}
}

EXPECT_TRUE(m_flush_comps.empty());
EXPECT_TRUE(m_pending_reqs.empty());

Expand All @@ -227,28 +247,61 @@ class test_ucp_worker_discard : public ucp_test {
m_destroyed_ep_count++;
}

static ep_test_info_t* ep_test_info_get(uct_ep_h ep) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return type can be reference ep_test_info_t &

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

ep_test_info_t *test_info_p;
ep_test_info_map_t::iterator it = m_ep_test_info_map.find(ep);

if (it == m_ep_test_info_map.end()) {
ep_test_info_t test_info = {};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since it's c++ struct, better to implement a constructor

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


m_ep_test_info_map.insert(std::make_pair(ep, test_info));
test_info_p = &m_ep_test_info_map.find(ep)->second;
} else {
test_info_p = &it->second;
}

return test_info_p;
}

static unsigned
ep_test_info_flush_inc(uct_ep_h ep) {
ep_test_info_t *test_info = ep_test_info_get(ep);
test_info->flush_count++;
return test_info->flush_count;
}

static unsigned
ep_test_info_pending_add_inc(uct_ep_h ep) {
ep_test_info_t *test_info = ep_test_info_get(ep);
test_info->pending_add_count++;
return test_info->pending_add_count;
}

static ucs_status_t
ep_flush_func_return_3_no_resource_then_ok(uct_ep_h ep, unsigned flags,
uct_completion_t *comp) {
EXPECT_LT(m_flush_ep_count, 4 * m_created_ep_count);
return (++m_flush_ep_count < 3 * m_created_ep_count) ?
unsigned flush_ep_count = ep_test_info_flush_inc(ep);
EXPECT_LE(flush_ep_count, 4);
return (flush_ep_count < 4) ?
UCS_ERR_NO_RESOURCE : UCS_OK;
}

static ucs_status_t
ep_flush_func_return_in_progress(uct_ep_h ep, unsigned flags,
uct_completion_t *comp) {
EXPECT_LT(m_flush_ep_count, m_created_ep_count);
unsigned flush_ep_count = ep_test_info_flush_inc(ep);
EXPECT_LE(flush_ep_count, m_created_ep_count);
m_flush_comps.push_back(comp);
return UCS_INPROGRESS;
}

static ucs_status_t
ep_pending_add_func_return_ok_then_busy(uct_ep_h ep, uct_pending_req_t *req,
unsigned flags) {
EXPECT_LT(m_pending_add_ep_count, 3 * m_created_ep_count);
unsigned pending_add_ep_count = ep_test_info_pending_add_inc(ep);
EXPECT_LE(pending_add_ep_count, m_created_ep_count);

if (++m_pending_add_ep_count < m_created_ep_count) {
if (pending_add_ep_count < m_created_ep_count) {
m_pending_reqs.push_back(req);
return UCS_OK;
}
Expand Down Expand Up @@ -286,28 +339,20 @@ class test_ucp_worker_discard : public ucp_test {
static ucs_status_t
ep_pending_add_save_req(uct_ep_h ep, uct_pending_req_t *req,
unsigned flags) {
ep_pending_reqs_map::iterator it = m_pending_reqs_map.find(ep);
if (it == m_pending_reqs_map.end()) {
std::vector<uct_pending_req_t*> vec;
vec.push_back(req);
m_pending_reqs_map.insert(std::make_pair(ep, vec));
} else {
std::vector<uct_pending_req_t*> *req_vec = &it->second;
req_vec->push_back(req);
}
ep_test_info_t *test_info = ep_test_info_get(ep);
test_info->pending_reqs.push_back(req);
return UCS_OK;
}

static void
ep_pending_purge_func_iter_reqs(uct_ep_h ep,
uct_pending_purge_callback_t cb,
void *arg) {
uct_pending_purge_callback_t cb,
void *arg) {
ep_test_info_t *test_info = ep_test_info_get(ep);
uct_pending_req_t *req;
for (unsigned i = 0; i < m_pending_purge_reqs_count; i++) {
ep_pending_reqs_map::iterator it = m_pending_reqs_map.find(ep);
ASSERT_NE(it, m_pending_reqs_map.end());

std::vector<uct_pending_req_t*> *req_vec = &it->second;
for (unsigned i = 0; i < m_pending_purge_reqs_count; i++) {
std::vector<uct_pending_req_t*> *req_vec = &test_info->pending_reqs;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::vector<uct_pending_req_t*> &req_vec = ...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

if (req_vec->size() == 0) {
break;
}
Expand All @@ -321,26 +366,22 @@ class test_ucp_worker_discard : public ucp_test {
protected:
static unsigned m_created_ep_count;
static unsigned m_destroyed_ep_count;
static unsigned m_flush_ep_count;
static unsigned m_pending_add_ep_count;
static ucp_ep_t m_fake_ep;
static const unsigned m_pending_purge_reqs_count;

static std::vector<uct_completion_t*> m_flush_comps;
static std::vector<uct_pending_req_t*> m_pending_reqs;
static ep_pending_reqs_map m_pending_reqs_map;
static ep_test_info_map_t m_ep_test_info_map;
};

unsigned test_ucp_worker_discard::m_created_ep_count = 0;
unsigned test_ucp_worker_discard::m_destroyed_ep_count = 0;
unsigned test_ucp_worker_discard::m_flush_ep_count = 0;
unsigned test_ucp_worker_discard::m_pending_add_ep_count = 0;
ucp_ep_t test_ucp_worker_discard::m_fake_ep = {};
const unsigned test_ucp_worker_discard::m_pending_purge_reqs_count = 10;

std::vector<uct_completion_t*> test_ucp_worker_discard::m_flush_comps;
std::vector<uct_pending_req_t*> test_ucp_worker_discard::m_pending_reqs;
test_ucp_worker_discard::ep_pending_reqs_map test_ucp_worker_discard::m_pending_reqs_map;
std::vector<uct_completion_t*> test_ucp_worker_discard::m_flush_comps;
std::vector<uct_pending_req_t*> test_ucp_worker_discard::m_pending_reqs;
test_ucp_worker_discard::ep_test_info_map_t test_ucp_worker_discard::m_ep_test_info_map;


UCS_TEST_P(test_ucp_worker_discard, flush_ok) {
Expand Down