Skip to content

Commit

Permalink
Merge pull request openucx#6 from zheng871026/huawei
Browse files Browse the repository at this point in the history
TEST/GTEST: testing non-contiguous datatypes in UCG
  • Loading branch information
nsosnsos authored Nov 19, 2020
2 parents 89ad99c + 58cb4ea commit 57c6432
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 20 deletions.
36 changes: 24 additions & 12 deletions test/gtest/ucg/test_cb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,9 @@ TEST_F(ucg_cb_test, test_send_cb) {
ucg_collective_params_t *params = create_allreduce_params();
int8_t *current_data_buffer = NULL;
ucg_builtin_op_step_t *step = new ucg_builtin_op_step_t();
ucp_datatype_t dtype = ucp_dt_make_contig(sizeof(int));

ucs_status_t ret = ucg_builtin_step_create(phase, extra_flags, base_am_id, group_id,
ucs_status_t ret = ucg_builtin_step_create(phase, dtype, dtype, extra_flags, base_am_id, group_id,
params, &current_data_buffer, step);
ASSERT_EQ(UCS_OK, ret);

Expand All @@ -182,8 +183,9 @@ TEST_F(ucg_cb_test, test_recv_cb_recv_one) {
ucg_collective_params_t *params = create_allreduce_params();
int8_t *current_data_buffer = NULL;
ucg_builtin_op_step_t *step = new ucg_builtin_op_step_t();
ucp_datatype_t dtype = ucp_dt_make_contig(sizeof(int));

ucs_status_t ret = ucg_builtin_step_create(phase, extra_flags, base_am_id, group_id,
ucs_status_t ret = ucg_builtin_step_create(phase, dtype, dtype, extra_flags, base_am_id, group_id,
params, &current_data_buffer, step);
ASSERT_EQ(UCS_OK, ret);

Expand Down Expand Up @@ -222,8 +224,9 @@ TEST_F(ucg_cb_test, test_recv_cb_recv_many) {
ucg_collective_params_t *params = create_allreduce_params();
int8_t *current_data_buffer = NULL;
ucg_builtin_op_step_t *step = new ucg_builtin_op_step_t();
ucp_datatype_t dtype = ucp_dt_make_contig(sizeof(int));

ucs_status_t ret = ucg_builtin_step_create(phase, extra_flags, base_am_id, group_id,
ucs_status_t ret = ucg_builtin_step_create(phase, dtype, dtype, extra_flags, base_am_id, group_id,
params, &current_data_buffer, step);
ASSERT_EQ(UCS_OK, ret);

Expand Down Expand Up @@ -274,8 +277,9 @@ TEST_F(ucg_cb_test, test_recv_cb_reduce_one) {
ucg_collective_params_t *params = create_allreduce_params();
int8_t *current_data_buffer = NULL;
ucg_builtin_op_step_t *step = new ucg_builtin_op_step_t();
ucp_datatype_t dtype = ucp_dt_make_contig(sizeof(int));

ucs_status_t ret = ucg_builtin_step_create(phase, extra_flags, base_am_id, group_id,
ucs_status_t ret = ucg_builtin_step_create(phase, dtype, dtype, extra_flags, base_am_id, group_id,
params, &current_data_buffer, step);
ASSERT_EQ(UCS_OK, ret);

Expand Down Expand Up @@ -310,8 +314,9 @@ TEST_F(ucg_cb_test, test_recv_cb_reduce_many) {
ucg_collective_params_t *params = create_allreduce_params();
int8_t *current_data_buffer = NULL;
ucg_builtin_op_step_t *step = new ucg_builtin_op_step_t();
ucp_datatype_t dtype = ucp_dt_make_contig(sizeof(int));

ucs_status_t ret = ucg_builtin_step_create(phase, extra_flags, base_am_id, group_id,
ucs_status_t ret = ucg_builtin_step_create(phase, dtype, dtype, extra_flags, base_am_id, group_id,
params, &current_data_buffer, step);
ASSERT_EQ(UCS_OK, ret);

Expand Down Expand Up @@ -361,8 +366,9 @@ TEST_F(ucg_cb_test, test_recv_cb_reduce_full) {
ucg_collective_params_t *params = create_allreduce_params();
int8_t *current_data_buffer = NULL;
ucg_builtin_op_step_t *step = new ucg_builtin_op_step_t();
ucp_datatype_t dtype = ucp_dt_make_contig(sizeof(int));

ucs_status_t ret = ucg_builtin_step_create(phase, extra_flags, base_am_id, group_id,
ucs_status_t ret = ucg_builtin_step_create(phase, dtype, dtype, extra_flags, base_am_id, group_id,
params, &current_data_buffer, step);
ASSERT_EQ(UCS_OK, ret);

Expand Down Expand Up @@ -406,8 +412,9 @@ TEST_F(ucg_cb_test, test_recv_cb_wait) {
ucg_collective_params_t *params = create_allreduce_params();
int8_t *current_data_buffer = NULL;
ucg_builtin_op_step_t *step = new ucg_builtin_op_step_t();
ucp_datatype_t dtype = ucp_dt_make_contig(sizeof(int));

ucs_status_t ret = ucg_builtin_step_create(phase, extra_flags, base_am_id, group_id,
ucs_status_t ret = ucg_builtin_step_create(phase, dtype, dtype, extra_flags, base_am_id, group_id,
params, &current_data_buffer, step);
ASSERT_EQ(UCS_OK, ret);

Expand Down Expand Up @@ -442,8 +449,9 @@ TEST_F(ucg_cb_test, test_recv_cb_last_barrier) {
ucg_collective_params_t *params = create_allreduce_params();
int8_t *current_data_buffer = NULL;
ucg_builtin_op_step_t *step = new ucg_builtin_op_step_t();
ucp_datatype_t dtype = ucp_dt_make_contig(sizeof(int));

ucs_status_t ret = ucg_builtin_step_create(phase, extra_flags, base_am_id, group_id,
ucs_status_t ret = ucg_builtin_step_create(phase, dtype, dtype, extra_flags, base_am_id, group_id,
params, &current_data_buffer, step);
ASSERT_EQ(UCS_OK, ret);

Expand Down Expand Up @@ -479,8 +487,9 @@ TEST_F(ucg_cb_test, test_zcopy_step_check_cb) {
ucg_collective_params_t *params = create_allreduce_params();
int8_t *current_data_buffer = NULL;
ucg_builtin_op_step_t *step = new ucg_builtin_op_step_t();
ucp_datatype_t dtype = ucp_dt_make_contig(sizeof(int));

ucs_status_t ret = ucg_builtin_step_create(phase, extra_flags, base_am_id, group_id,
ucs_status_t ret = ucg_builtin_step_create(phase, dtype, dtype, extra_flags, base_am_id, group_id,
params, &current_data_buffer, step);
ASSERT_EQ(UCS_OK, ret);

Expand Down Expand Up @@ -509,8 +518,9 @@ TEST_F(ucg_cb_test, test_zcopy_prep) {
ucg_collective_params_t *params = create_allreduce_params();
int8_t *current_data_buffer = NULL;
ucg_builtin_op_step_t *step = new ucg_builtin_op_step_t();
ucp_datatype_t dtype = ucp_dt_make_contig(sizeof(int));

ucs_status_t ret = ucg_builtin_step_create(phase, extra_flags, base_am_id, group_id,
ucs_status_t ret = ucg_builtin_step_create(phase, dtype, dtype, extra_flags, base_am_id, group_id,
params, &current_data_buffer, step);
ASSERT_EQ(UCS_OK, ret);

Expand All @@ -529,8 +539,9 @@ TEST_F(ucg_cb_test, test_bcopy_to_zcopy) {
ucg_collective_params_t *params = create_allreduce_params();
int8_t *current_data_buffer = NULL;
ucg_builtin_op_step_t *step = new ucg_builtin_op_step_t();
ucp_datatype_t dtype = ucp_dt_make_contig(sizeof(int));

ucs_status_t ret = ucg_builtin_step_create(phase, extra_flags, base_am_id, group_id,
ucs_status_t ret = ucg_builtin_step_create(phase, dtype, dtype, extra_flags, base_am_id, group_id,
params, &current_data_buffer, step);
ASSERT_EQ(UCS_OK, ret);

Expand Down Expand Up @@ -662,8 +673,9 @@ TEST_F(ucg_cb_test, test_op_collback_select) {
ucg_builtin_plan_t *plan = create_method_plan(method[i]);
ucg_builtin_op_init_cb_t *init_cb = new ucg_builtin_op_init_cb_t;
ucg_builtin_op_final_cb_t *final_cb = new ucg_builtin_op_final_cb_t;
ucp_datatype_t dtype = ucp_dt_make_contig(sizeof(int));

ucs_status_t ret = ucg_builtin_op_select_callback(plan, init_cb, final_cb);
ucs_status_t ret = ucg_builtin_op_select_callback(plan, dtype, dtype, init_cb, final_cb);

ASSERT_EQ(UCS_OK, ret);
}
Expand Down
24 changes: 16 additions & 8 deletions test/gtest/ucg/test_step.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ TEST_F(ucg_step_test, test_step_create_method) {
ucg_collective_params_t *params = create_allreduce_params();
int8_t *current_data_buffer = NULL;
ucg_builtin_op_step_t *step = new ucg_builtin_op_step_t();
ucp_datatype_t dtype = ucp_dt_make_contig(sizeof(int));

ucs_status_t ret = ucg_builtin_step_create(phase, extra_flags, base_am_id, group_id,
ucs_status_t ret = ucg_builtin_step_create(phase, dtype, dtype, extra_flags, base_am_id, group_id,
params, &current_data_buffer, step);

if (method[i] == UCG_PLAN_METHOD_NEIGHBOR) {
Expand Down Expand Up @@ -130,8 +131,9 @@ TEST_F(ucg_step_test, test_step_create_short) {
ucg_group_id_t group_id = 0;
int8_t *current_data_buffer = NULL;
ucg_builtin_op_step_t *step = new ucg_builtin_op_step_t();
ucp_datatype_t dtype = ucp_dt_make_contig(sizeof(int));

ucs_status_t ret = ucg_builtin_step_create(phase, extra_flags, base_am_id, group_id,
ucs_status_t ret = ucg_builtin_step_create(phase, dtype, dtype, extra_flags, base_am_id, group_id,
params, &current_data_buffer, step);
ASSERT_EQ(UCS_OK, ret);
ASSERT_EQ(UCG_BUILTIN_OP_STEP_FLAG_SEND_AM_SHORT, step->flags & UCG_BUILTIN_OP_STEP_FLAG_SEND_AM_SHORT);
Expand Down Expand Up @@ -167,8 +169,9 @@ TEST_F(ucg_step_test, test_step_create_bcopy) {
ucg_group_id_t group_id = 0;
int8_t *current_data_buffer = NULL;
ucg_builtin_op_step_t *step = new ucg_builtin_op_step_t();
ucp_datatype_t dtype = ucp_dt_make_contig(sizeof(int));

ucs_status_t ret = ucg_builtin_step_create(phase, extra_flags, base_am_id, group_id,
ucs_status_t ret = ucg_builtin_step_create(phase, dtype, dtype, extra_flags, base_am_id, group_id,
params, &current_data_buffer, step);
ASSERT_EQ(UCS_OK, ret);
ASSERT_EQ(UCG_BUILTIN_OP_STEP_FLAG_SEND_AM_BCOPY, step->flags & UCG_BUILTIN_OP_STEP_FLAG_SEND_AM_BCOPY);
Expand Down Expand Up @@ -208,8 +211,9 @@ TEST_F(ucg_step_test, test_step_create_zcopy) {
ucg_group_id_t group_id = 0;
int8_t *current_data_buffer = NULL;
ucg_builtin_op_step_t *step = new ucg_builtin_op_step_t();
ucp_datatype_t dtype = ucp_dt_make_contig(sizeof(int));

ucs_status_t ret = ucg_builtin_step_create(phase, extra_flags, base_am_id, group_id,
ucs_status_t ret = ucg_builtin_step_create(phase, dtype, dtype, extra_flags, base_am_id, group_id,
params, &current_data_buffer, step);
ASSERT_EQ(UCS_OK, ret);
ASSERT_EQ(UCG_BUILTIN_OP_STEP_FLAG_SEND_AM_ZCOPY, step->flags & UCG_BUILTIN_OP_STEP_FLAG_SEND_AM_ZCOPY);
Expand All @@ -231,8 +235,9 @@ TEST_F(ucg_step_test, test_msg_process) {
ucg_collective_params_t *params = create_allreduce_params();
int8_t *current_data_buffer = NULL;
ucg_builtin_op_step_t *step = new ucg_builtin_op_step_t();
ucp_datatype_t dtype = ucp_dt_make_contig(sizeof(int));

ucs_status_t ret = ucg_builtin_step_create(phase, extra_flags, base_am_id, group_id,
ucs_status_t ret = ucg_builtin_step_create(phase, dtype, dtype, extra_flags, base_am_id, group_id,
params, &current_data_buffer, step);
ASSERT_EQ(UCS_OK, ret);

Expand Down Expand Up @@ -286,8 +291,9 @@ TEST_F(ucg_step_test, test_step_execute_short) {
ucg_collective_params_t *params = create_allreduce_params();
int8_t *current_data_buffer = NULL;
ucg_builtin_op_step_t *step = new ucg_builtin_op_step_t();
ucp_datatype_t dtype = ucp_dt_make_contig(sizeof(int));

ucs_status_t ret = ucg_builtin_step_create(phase, extra_flags, base_am_id, group_id,
ucs_status_t ret = ucg_builtin_step_create(phase, dtype, dtype, extra_flags, base_am_id, group_id,
params, &current_data_buffer, step);
ASSERT_EQ(UCS_OK, ret);

Expand Down Expand Up @@ -317,8 +323,9 @@ TEST_F(ucg_step_test, test_step_execute_bcopy) {
ucg_collective_params_t *params = create_allreduce_params();
int8_t *current_data_buffer = NULL;
ucg_builtin_op_step_t *step = new ucg_builtin_op_step_t();
ucp_datatype_t dtype = ucp_dt_make_contig(sizeof(int));

ucs_status_t ret = ucg_builtin_step_create(phase, extra_flags, base_am_id, group_id,
ucs_status_t ret = ucg_builtin_step_create(phase, dtype, dtype, extra_flags, base_am_id, group_id,
params, &current_data_buffer, step);
ASSERT_EQ(UCS_OK, ret);

Expand Down Expand Up @@ -350,8 +357,9 @@ TEST_F(ucg_step_test, test_step_execute_zcopy) {
ucg_collective_params_t *params = create_allreduce_params();
int8_t *current_data_buffer = NULL;
ucg_builtin_op_step_t *step = new ucg_builtin_op_step_t();
ucp_datatype_t dtype = ucp_dt_make_contig(sizeof(int));

ucs_status_t ret = ucg_builtin_step_create(phase, extra_flags, base_am_id, group_id,
ucs_status_t ret = ucg_builtin_step_create(phase, dtype, dtype, extra_flags, base_am_id, group_id,
params, &current_data_buffer, step);
ASSERT_EQ(UCS_OK, ret);

Expand Down

0 comments on commit 57c6432

Please sign in to comment.