Skip to content

Commit

Permalink
Merge pull request #30 from zheng871026/huawei
Browse files Browse the repository at this point in the history
Fix UT test for discontig datatype
  • Loading branch information
nsosnsos authored Dec 29, 2020
2 parents ab78b38 + 311962d commit 6ba90bc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/gtest/ucg/test_cb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ TEST_F(ucg_cb_test, test_op_cb_init) {
((ucg_builtin_op_t *)op)->send_dt = dt_gen;
((ucg_builtin_op_t *)op)->recv_dt = dt_gen;
ucg_builtin_op_step_t *step = &((ucg_builtin_op_t *)op)->steps[0];
step->bcopy.pack_state.dt.generic.state = (void *)step->recv_buffer;
step->bcopy.unpack_state.dt.generic.state = (void *)step->recv_buffer;
step->non_contig.pack_state.dt.generic.state = (void *)step->recv_buffer;
step->non_contig.unpack_state.dt.generic.state = (void *)step->recv_buffer;
int *send_buf = (int *)params->send.buf;
int *recv_buf = (int *)params->recv.buf;
ucg_builtin_request_t *req = new ucg_builtin_request_t;
Expand Down Expand Up @@ -188,8 +188,8 @@ TEST_F(ucg_cb_test, test_op_cb_final) {
recv_buf[i] = i;
}
step->recv_buffer = (int8_t *)recv_buf;
step->bcopy.pack_state.dt.generic.state = (void *)step->recv_buffer;
step->bcopy.unpack_state.dt.generic.state = (void *)step->recv_buffer;
step->non_contig.pack_state.dt.generic.state = (void *)step->recv_buffer;
step->non_contig.unpack_state.dt.generic.state = (void *)step->recv_buffer;

ucg_builtin_request_t *req = new ucg_builtin_request_t;
req->op = (ucg_builtin_op_t *)op;
Expand Down Expand Up @@ -288,7 +288,7 @@ TEST_F(ucg_cb_test, test_recv_cb_recv_one) {
ASSERT_EQ(UCS_OK, ret);

ucg_builtin_request_t *req = create_request(step);
req->step->bcopy.unpack_state.dt.generic.state = (void *)step->recv_buffer;
req->step->non_contig.unpack_state.dt.generic.state = (void *)step->recv_buffer;
req->op->recv_dt = dt_gen;
req->op->recv_dt->ops.unpack = coll_ucx_generic_datatype_unpack;

Expand Down Expand Up @@ -350,7 +350,7 @@ TEST_F(ucg_cb_test, test_recv_cb_recv_many) {
ASSERT_EQ(UCS_OK, ret);

ucg_builtin_request_t *req = create_request(step);
req->step->bcopy.unpack_state.dt.generic.state = (void *)step->recv_buffer;
req->step->non_contig.unpack_state.dt.generic.state = (void *)step->recv_buffer;
req->op->recv_dt = dt_gen;
req->op->recv_dt->ops.unpack = coll_ucx_generic_datatype_unpack;

Expand Down
6 changes: 6 additions & 0 deletions test/gtest/ucg/ucg_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ ucs_status_t resolve_address_callback(void *cb_group_obj, ucg_group_member_index
return UCS_OK;
}

static ucg_group_member_index_t mpi_global_idx_dummy(void *cb_group_obj, ucg_group_member_index_t index)
{
return 0;
}

ucg_group_params_t *ucg_resource_factory::create_group_params(
ucg_rank_info my_rank_info, const std::vector<ucg_rank_info> &rank_infos)
{
Expand All @@ -187,6 +192,7 @@ ucg_group_params_t *ucg_resource_factory::create_group_params(
args->mpi_dt_convert = mca_coll_ucg_datatype_convert_for_ut;
args->distance = (ucg_group_member_distance *) malloc(args->member_count * sizeof(*args->distance));
args->node_index = (uint16_t *) malloc(args->member_count * sizeof(*args->node_index));
args->mpi_global_idx_f = mpi_global_idx_dummy;

for (size_t i = 0; i < rank_infos.size(); i++) {
if (rank_infos[i].rank == my_rank_info.rank) {
Expand Down

0 comments on commit 6ba90bc

Please sign in to comment.