Skip to content

Commit

Permalink
CORE: Fix gtest
Browse files Browse the repository at this point in the history
  • Loading branch information
nsarka committed Aug 20, 2024
1 parent f2a67ca commit e9d3913
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions test/gtest/asym_mem/test_asymmetric_memory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,17 @@ class test_asymmetric_memory : public ucc::test,

root = ctxs[i]->args->root;

if (i == root) {
dst_mem_type = ctxs[root]->args->dst.info.mem_type;
if (i == root || ctxs[i]->args->coll_type == UCC_COLL_TYPE_SCATTER) {
dst_mem_type = ctxs[i]->args->dst.info.mem_type;

rst = (uint8_t*) ucc_malloc(ctxs[root]->rbuf_size, "validation buf");
rst = (uint8_t*) ucc_malloc(ctxs[i]->rbuf_size, "validation buf");
EXPECT_NE(rst, nullptr);

UCC_CHECK(ucc_mc_memcpy(rst, ctxs[root]->args->dst.info.buffer,
ctxs[root]->rbuf_size,
UCC_CHECK(ucc_mc_memcpy(rst, ctxs[i]->args->dst.info.buffer,
ctxs[i]->rbuf_size,
UCC_MEMORY_TYPE_HOST, dst_mem_type));

for (int j = 0; j < ctxs[root]->rbuf_size; j++) {
for (int j = 0; j < ctxs[i]->rbuf_size; j++) {
if (result != rst[j]) {
ret = false;
break;
Expand All @@ -146,22 +146,25 @@ class test_asymmetric_memory : public ucc::test,
size_t msglen = 2048;
size_t src_modifier = 1;
ucc_coll_type_t coll_type = ctxs[0]->args->coll_type;
int root = ctxs[0]->args->root;
ucc_memory_type_t src_mem_type = ctxs[0]->args->src.info.mem_type;

if (coll_type == UCC_COLL_TYPE_SCATTER) {
src_modifier = tsize;
}

for (int i = 0; i < tsize; i++) {
ucc_coll_args_t *coll = ctxs[i]->args;
uint8_t *sbuf = (uint8_t*)ctxs[i]->init_buf;
for (int j = 0; j < msglen * src_modifier; j++) {
sbuf[j] = (uint8_t) data;
if (i == root || coll_type != UCC_COLL_TYPE_SCATTER) {
ucc_coll_args_t *coll = ctxs[i]->args;
uint8_t *sbuf = (uint8_t*)ctxs[i]->init_buf;
for (int j = 0; j < msglen * src_modifier; j++) {
sbuf[j] = (uint8_t) data;
}
UCC_CHECK(ucc_mc_memcpy(coll->src.info.buffer,
ctxs[i]->init_buf,
msglen * src_modifier, src_mem_type,
UCC_MEMORY_TYPE_HOST));
}
UCC_CHECK(ucc_mc_memcpy(coll->src.info.buffer,
ctxs[i]->init_buf,
msglen * src_modifier, src_mem_type,
UCC_MEMORY_TYPE_HOST));
}
}
};
Expand Down

0 comments on commit e9d3913

Please sign in to comment.